Interface TriangleMesh

    • Method Detail

      • fromPolygons

        static TriangleMesh fromPolygons​(Collection<? extends Polygon3d> polygons)
        Returns a new instance of a TriangleMesh given the polygons that form it. The polygons will be triangulated.
        Parameters:
        polygons - the polygons forming the mesh that will be triangulated
        Returns:
        the TriangleMesh
        Since:
        9.10.2
      • toPointCollection

        Collection<Vector3d> toPointCollection()
        Returns a new collection containing all the vertices of all the triangles in this TriangleMesh. If an iterable to the mesh's points is enough, use the faster getPoints().
        Returns:
        a new collection containing all the vertices of all the triangles in this TriangleMesh.
        Since:
        9.10.2
      • getBoundingBox

        Optional<AABB3d> getBoundingBox()
        Returns the axis aligned bounding box of the TriangleMesh.
        Returns:
        the bounding box if it exists
        Since:
        9.10.2
      • getPoints

        Iterable<Vector3d> getPoints()
        Returns an iterable of all the vertices of all the triangles in the TriangleMesh.
        Returns:
        an iterable of all the vertices in this TriangleMesh
        Since:
        9.10.2
      • encloses

        boolean encloses​(Vector3d point)
        Returns true if the TriangleMesh is closed and the given point is inside this TriangleMesh.
        Parameters:
        point - the given point
        Returns:
        true if the point is inside the TriangleMesh
        Since:
        9.10.2
      • isInsideOut

        boolean isInsideOut()
        Returns true if the closed TriangleMesh is inside-out, meaning that the normals of the surface triangles point inwards instead of outwards. An inside-out mesh is produced when its triangles are oriented clockwise when looking from the outside, instead of being oriented counter-clockwise. When a clockwise mesh is joined to a counter-clockwise mesh, their volume is subtracted instead of added, and some of the mesh algorithms may return unintuitive or incorrect results. The result of this method is meaningful only for closed meshes that have self-consistent triangle orientation.
        Returns:
        true if the TriangleMesh surface is oriented inside-out
        Since:
        9.10.2
      • flipped

        TriangleMesh flipped()
        Returns a version of this TriangleMesh where all the triangles have flipped normals, with the effect of exchanging the external faces with the internal faces if the mesh is closed. This method can be used to retrieve a corrected version of an inside-out mesh resulting from a transformation that did not preserve the orientation of the triangles in the mesh.
        Returns:
        the flipped version of this TriangleMesh
        Since:
        9.10.2
      • getArea

        double getArea()
        Returns the total area of the triangles in this TriangleMesh.
        Returns:
        the total area of the triangles in this TriangleMesh
        Since:
        9.10.2
      • getVolume

        double getVolume()
        Returns the total volume enclosed by this TriangleMesh. This method will produce a meaningful result only if the TriangleMesh is closed and does not contain intersecting solids.
        Returns:
        the total volume enclosed by this TriangleMesh
        Since:
        9.10.2
      • shortestPathTo

        Optional<Segment3d> shortestPathTo​(Vector3d point)
        Returns the shortest path from this TriangleMesh to a given point, if such path exists.
        Parameters:
        point - the point as Vector3d
        Returns:
        the shortest path connecting this TriangleMesh to the given point, if it exists
        Since:
        9.10.2
      • shortestVerticalPathTo

        Optional<Segment3d> shortestVerticalPathTo​(Vector3d point)
        Returns the shortest vertical path from this TriangleMesh to a point, if such path exists.
        Parameters:
        point - the point as Vector3d
        Returns:
        the shortest vertical path connecting this TriangleMesh to the point, if it exists
        Since:
        9.10.2
      • shortestVerticalPathTo

        Optional<Segment3d> shortestVerticalPathTo​(TriangleMesh other)
        Returns the shortest vertical path from this TriangleMesh to another, if such path exists.
        Parameters:
        other - the other TriangleMesh
        Returns:
        the shortest vertical path connecting this TriangleMesh to the other, if it exists
        Since:
        9.10.2
      • shortestHorizontalPathTo

        Optional<Segment3d> shortestHorizontalPathTo​(Vector3d point)
        Returns the shortest horizontal path from this TriangleMesh to a point, if such path exists.
        Parameters:
        point - the point as Vector3d
        Returns:
        the shortest horizontal path connecting this TriangleMesh to the point, if it exists
        Since:
        9.10.2
      • shortestHorizontalPathTo

        Optional<Segment3d> shortestHorizontalPathTo​(TriangleMesh other)
        Returns the shortest horizontal path from this TriangleMesh to another, if such path exists.
        Parameters:
        other - the other TriangleMesh
        Returns:
        the shortest horizontal path connecting this TriangleMesh to the other, if it exists
        Since:
        9.10.2
      • shortest2dPathInXYPlaneProjectionTo

        Optional<Segment2d> shortest2dPathInXYPlaneProjectionTo​(Vector3d point)
        Returns the shortest 2D path from the projection of this TriangleMesh to the projection of a point in the XY-plane, if such path exists.
        Parameters:
        point - the point as Vector3d
        Returns:
        the shortest 2D path between the projection of the TriangleMesh and the point, if it exists
        Since:
        9.10.2
      • shortest2dPathInXYPlaneProjectionTo

        Optional<Segment2d> shortest2dPathInXYPlaneProjectionTo​(TriangleMesh other)
        Returns the shortest 2D path from the projection of this TriangleMesh to the projection of another TriangleMesh in the XY-plane, if such path exists.
        Parameters:
        other - the other TriangleMesh
        Returns:
        the shortest 2D path between the projections of the two TriangleMeshes, if it exists
        Since:
        9.10.2