Skip to content

Commit 5e8f1b8

Browse files
committed
use the get polygon from index method
1 parent bdb6bda commit 5e8f1b8

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

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

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -237,24 +237,14 @@ public CSG(ArrayList<Polygon> polygons) throws ColinearPointsException {
237237
}
238238

239239
public ArrayList<Polygon> generatePolygonsFromMesh() throws ColinearPointsException {
240-
double[] verts = vertices; // flat [x0,y0,z0, x1,y1,z1, ...]
241-
long[] tris = triangles; // flat [i0,i1,i2, i3,i4,i5, ...]
242-
243240
if (triCount == 0)
244241
return new ArrayList<>();
245242

246243
ArrayList<Polygon> polygons = new ArrayList<Polygon>();
247244

248-
for (int t = 0; t < triCount; t++) {
249-
int base = t * 3;
250-
251-
Vector3d p0 = vertexAt(verts, (int) tris[base]);
252-
Vector3d p1 = vertexAt(verts, (int) tris[base + 1]);
253-
Vector3d p2 = vertexAt(verts, (int) tris[base + 2]);
254-
255-
List<Vertex> vertices = Arrays.asList(new Vertex(p0), new Vertex(p1), new Vertex(p2));
256-
257-
polygons.add(new Polygon(vertices));
245+
for (long t = 0; t < triCount; t++) {
246+
int base =(int) (t * 3);
247+
polygons.add(getPolygonByIndex(base));
258248
}
259249
return polygons;
260250
}

0 commit comments

Comments
 (0)