Skip to content

Commit f6913ab

Browse files
committed
bring point contact distance in line with snap methods
1 parent dea8c22 commit f6913ab

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • src/main/java/eu/mihosoft/vrl/v3d

src/main/java/eu/mihosoft/vrl/v3d/CSG.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ public CSG processPolygonsToTriangles(ArrayList<Polygon> polygons) throws Coline
341341
*/
342342
private static int intern(Vertex v, Map<String, Integer> index, List<Vector3d> list) {
343343

344-
double precision = 0.0001;// 0.1d/Plane.getEPSILON();
344+
double precision = 1.0d/POINTS_CONTACT_DISTANCE;//0.1d/Plane.getEPSILON();
345345

346346
long x = Math.round(v.pos.x * precision);
347347
long y = Math.round(v.pos.y * precision);
@@ -1896,6 +1896,8 @@ public StringBuilder toStlString(StringBuilder sb) {
18961896
// }
18971897

18981898
public CSG makeManifold() throws ColinearPointsException {
1899+
if(getNumberOfTriangles()<4)
1900+
return this;
18991901
// if (fix && needsDegeneratesPruned)
19001902
// triangulated = false;
19011903
// if (triangulated)
@@ -1925,12 +1927,12 @@ public CSG makeManifold() throws ColinearPointsException {
19251927

19261928
ArrayList<Polygon> polygons = generatePolygonsFromMesh();
19271929
do {
1928-
long np = vertCount;
19291930
long numberOfPolygons = getNumberOfTriangles();
1931+
long np = numberOfPolygons*3;
19301932

19311933
int extraSpace = ExtraSpace;
19321934
long longLength = 1 + np + ((numberOfPolygons + 1) * extraSpace);
1933-
if (longLength * 4 > Integer.MAX_VALUE)
1935+
if (longLength > Integer.MAX_VALUE)
19341936
new RuntimeException("Mesh too large to process with integers!").printStackTrace();
19351937
else {
19361938
System.err.println("Processing Mesh Manifold with " + longLength * 4 + " byte buffer");

0 commit comments

Comments
 (0)