use of com.revolsys.geometry.model.Triangle in project com.revolsys.open by revolsys.
the class IntArrayScaleTriangulatedIrregularNetwork method forEachTriangle.
@Override
public void forEachTriangle(final Consumer<? super Triangle> action) {
for (int i = 0; i < this.triangleCount; i++) {
final Triangle triangle = newTriangle(i);
action.accept(triangle);
}
}
use of com.revolsys.geometry.model.Triangle in project com.revolsys.open by revolsys.
the class IntArrayScaleTriangulatedIrregularNetwork method getTriangleSpatialIndex.
public QuadTree<Triangle> getTriangleSpatialIndex() {
if (this.triangleSpatialIndex == null) {
final QuadTree<Triangle> index = new QuadTree<>(this.geometryFactory);
forEachTriangle((x1, y1, z1, x2, y2, z2, x3, y3, z3) -> {
final Triangle triangle = new TriangleDoubleXYZ(x1, y1, z1, x2, y2, z2, x3, y3, z3);
final BoundingBox boundingBox = triangle.getBoundingBox();
index.insertItem(boundingBox, triangle);
});
this.triangleSpatialIndex = index;
}
return this.triangleSpatialIndex;
}
use of com.revolsys.geometry.model.Triangle in project com.revolsys.open by revolsys.
the class IntArrayScaleTriangulatedIrregularNetwork method forEachTriangle.
@Override
public void forEachTriangle(final BoundingBox boundingBox, final Consumer<? super Triangle> action) {
if (this.spatialIndexUseTriangles) {
final QuadTree<Triangle> index = getTriangleSpatialIndex();
index.forEach(boundingBox, (triangle) -> {
action.accept(triangle);
});
} else {
final QuadTree<Integer> index = getTriangleIdSpatialIndex();
index.forEach(boundingBox, triangleIndex -> {
final Triangle triangle = newTriangle(triangleIndex);
if (triangle != null) {
action.accept(triangle);
}
});
}
}
use of com.revolsys.geometry.model.Triangle in project com.revolsys.open by revolsys.
the class TriangulatedIrregularNetwork method getTriangles.
default List<Triangle> getTriangles(final LineSegment segment) {
final BoundingBox boundingBox = segment.getBoundingBox();
final List<Triangle> triangles = new ArrayList<>();
forEachTriangle(boundingBox, triangles::add);
return triangles;
}
use of com.revolsys.geometry.model.Triangle in project com.revolsys.open by revolsys.
the class QuadEdgeSubdivision method getTrianglesPolygonal.
/**
* Gets the geometry for the triangles in a triangulated subdivision as a {@link Polygonal}.
*
* @param geometryFactory the GeometryFactory to use
* @return a GeometryCollection of triangular Polygons
*/
public Polygonal getTrianglesPolygonal(final GeometryFactory geometryFactory) {
final List<Triangle> triangles = new ArrayList<>();
forEachTriangle((final double x1, final double y1, final double z1, final double x2, final double y2, final double z2, final double x3, final double y3, final double z3) -> {
final Triangle triangle = new TriangleDoubleXYZ(x1, y1, z1, x2, y2, z2, x3, y3, z3);
triangles.add(triangle);
});
return geometryFactory.polygonal(triangles);
}
Aggregations