Search in sources :

Example 1 with TriangleDoubleXYZ

use of com.revolsys.geometry.model.impl.TriangleDoubleXYZ 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;
}
Also used : IdObjectQuadTree(com.revolsys.geometry.index.quadtree.IdObjectQuadTree) QuadTree(com.revolsys.geometry.index.quadtree.QuadTree) BaseBoundingBox(com.revolsys.geometry.model.impl.BaseBoundingBox) BoundingBox(com.revolsys.geometry.model.BoundingBox) AbstractTriangle(com.revolsys.geometry.model.impl.AbstractTriangle) Triangle(com.revolsys.geometry.model.Triangle) TriangleDoubleXYZ(com.revolsys.geometry.model.impl.TriangleDoubleXYZ)

Example 2 with TriangleDoubleXYZ

use of com.revolsys.geometry.model.impl.TriangleDoubleXYZ 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);
}
Also used : Triangle(com.revolsys.geometry.model.Triangle) ArrayList(java.util.ArrayList) TriangleDoubleXYZ(com.revolsys.geometry.model.impl.TriangleDoubleXYZ)

Example 3 with TriangleDoubleXYZ

use of com.revolsys.geometry.model.impl.TriangleDoubleXYZ in project com.revolsys.open by revolsys.

the class QuadEdgeSubdivision method forEachTriangle.

public void forEachTriangle(final Consumer<? super Triangle> action) {
    forEachTriangle((x1, y1, z1, x2, y2, z2, x3, y3, z3) -> {
        final Triangle triangle = new TriangleDoubleXYZ(x1, y1, z1, x2, y2, z2, x3, y3, z3);
        action.accept(triangle);
    });
}
Also used : Triangle(com.revolsys.geometry.model.Triangle) TriangleDoubleXYZ(com.revolsys.geometry.model.impl.TriangleDoubleXYZ)

Aggregations

Triangle (com.revolsys.geometry.model.Triangle)3 TriangleDoubleXYZ (com.revolsys.geometry.model.impl.TriangleDoubleXYZ)3 IdObjectQuadTree (com.revolsys.geometry.index.quadtree.IdObjectQuadTree)1 QuadTree (com.revolsys.geometry.index.quadtree.QuadTree)1 BoundingBox (com.revolsys.geometry.model.BoundingBox)1 AbstractTriangle (com.revolsys.geometry.model.impl.AbstractTriangle)1 BaseBoundingBox (com.revolsys.geometry.model.impl.BaseBoundingBox)1 ArrayList (java.util.ArrayList)1