public interface TriangleMesh extends Iterable<Triangle3d>
TriangleMesh is also an Iterable of triangles. Since this is an
iterable, using iterating over it from multi threads at the same time is not safe, since the iterations conflict with
each other. For multi-threaded access, be sure to call toTriangleCollection or toPointCollection and
use those collections.| Modifier and Type | Method and Description |
|---|---|
static TriangleMesh |
createEmpty()
Returns a new instance of an empty
TriangleMesh. |
boolean |
encloses(Vector3d point)
Returns true if the
TriangleMesh is closed and the given point is inside this TriangleMesh. |
TriangleMesh |
filter(Predicate<Triangle3d> filter)
Returns a new
TriangleMesh composed of all the triangles of this TriangleMesh that
satisfy the given Predicate. |
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. |
static TriangleMesh |
fromPolygons(Collection<? extends Polygon3d> polygons)
Returns a new instance of a
TriangleMesh given the polygons that form it. |
static TriangleMesh |
fromTriangles(Collection<? extends Triangle3d> triangles)
Returns a new instance of a
TriangleMesh given the triangles it contains. |
double |
getArea()
Returns the total area of the triangles in this
TriangleMesh. |
Optional<AABB3d> |
getBoundingBox()
Returns the axis aligned bounding box of the
TriangleMesh. |
Iterable<Vector3d> |
getPoints()
Returns an iterable of all the vertices of all the triangles in the
TriangleMesh. |
double |
getVolume()
Returns the total volume enclosed by this
TriangleMesh. |
boolean |
intersects(TriangleMesh other)
Returns true if this
TriangleMesh intersects the given TriangleMesh. |
boolean |
isInsideOut()
Returns true if the closed
TriangleMesh is inside-out, meaning that the normals of the surface triangles
point inwards instead of outwards. |
TriangleMesh |
mergedWith(TriangleMesh other)
Returns a new
TriangleMesh composed of all the triangles of this TriangleMesh and
another TriangleMesh. |
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. |
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. |
Optional<Segment3d> |
shortestHorizontalPathTo(TriangleMesh other)
Returns the shortest horizontal path from this
TriangleMesh to another, if such path exists. |
Optional<Segment3d> |
shortestHorizontalPathTo(Vector3d point)
Returns the shortest horizontal path from this
TriangleMesh to a point, if such path exists. |
Optional<Segment3d> |
shortestPathTo(TriangleMesh other)
Returns the shortest path from this
TriangleMesh to another, if such path exists. |
Optional<Segment3d> |
shortestPathTo(Vector3d point)
Returns the shortest path from this
TriangleMesh to a given point, if such path exists. |
Optional<Segment3d> |
shortestVerticalPathTo(TriangleMesh other)
Returns the shortest vertical path from this
TriangleMesh to another, if such path exists. |
Optional<Segment3d> |
shortestVerticalPathTo(Vector3d point)
Returns the shortest vertical path from this
TriangleMesh to a point, if such path exists. |
Collection<Vector3d> |
toPointCollection()
Returns a new collection containing all the vertices of all the triangles in this
TriangleMesh. |
Collection<Triangle3d> |
toTriangleCollection()
Returns a new collection containing the triangles in this
TriangleMesh. |
TriangleMesh |
transform(Function<Triangle3d,Triangle3d> mapping)
Returns a new
TriangleMesh composed of all the triangles of this TriangleMesh transformed
according to the given mapping function. |
TriangleMesh |
withPolygon(Polygon3d polygon)
Returns a new
TriangleMesh composed of this TriangleMesh and an additional polygon. |
TriangleMesh |
withPolygons(Collection<? extends Polygon3d> polygons)
Returns a new
TriangleMesh composed of this TriangleMesh and additional polygons. |
TriangleMesh |
withTriangle(Triangle3d triangle)
Returns a new
TriangleMesh composed of this TriangleMesh and an additional triangle. |
TriangleMesh |
withTriangles(Collection<? extends Triangle3d> triangles)
Returns a new
TriangleMesh composed of this TriangleMesh and additional triangles. |
forEach, iterator, spliteratorstatic TriangleMesh createEmpty()
TriangleMesh.TriangleMeshstatic TriangleMesh fromTriangles(Collection<? extends Triangle3d> triangles)
TriangleMesh given the triangles it contains.triangles - the triangles of the new meshTriangleMeshstatic TriangleMesh fromPolygons(Collection<? extends Polygon3d> polygons)
TriangleMesh given the polygons that form it.
The polygons will be triangulated.polygons - the polygons forming the mesh that will be triangulatedTriangleMeshCollection<Triangle3d> toTriangleCollection()
TriangleMesh.
If an iterable to the mesh's triangles is enough, use directly TriangleMesh
as an Iterable.TriangleMeshCollection<Vector3d> toPointCollection()
TriangleMesh.
If an iterable to the mesh's points is enough, use the faster getPoints().TriangleMesh.TriangleMesh withTriangle(Triangle3d triangle)
TriangleMesh composed of this TriangleMesh and an additional triangle.triangle - the triangle to add to the TriangleMeshTriangleMeshTriangleMesh withPolygon(Polygon3d polygon)
TriangleMesh composed of this TriangleMesh and an additional polygon.polygon - the polygon to add to the TriangleMeshTriangleMeshTriangleMesh withTriangles(Collection<? extends Triangle3d> triangles)
TriangleMesh composed of this TriangleMesh and additional triangles.triangles - the triangles to add to the TriangleMeshTriangleMeshTriangleMesh withPolygons(Collection<? extends Polygon3d> polygons)
TriangleMesh composed of this TriangleMesh and additional polygons.polygons - the polygons to add to the TriangleMeshTriangleMeshTriangleMesh mergedWith(TriangleMesh other)
TriangleMesh composed of all the triangles of this TriangleMesh and
another TriangleMesh.other - the triangles to add to the TriangleMeshTriangleMeshTriangleMesh filter(Predicate<Triangle3d> filter)
TriangleMesh composed of all the triangles of this TriangleMesh that
satisfy the given Predicate.filter - the given PredicateTriangleMeshTriangleMesh transform(Function<Triangle3d,Triangle3d> mapping)
TriangleMesh composed of all the triangles of this TriangleMesh transformed
according to the given mapping function.mapping - the given mapping function, describing how a Triangle3d is transformedTriangleMeshOptional<AABB3d> getBoundingBox()
TriangleMesh.Iterable<Vector3d> getPoints()
TriangleMesh.TriangleMeshboolean intersects(TriangleMesh other)
TriangleMesh intersects the given TriangleMesh.other - the other TriangleMeshTriangleMesh and the given TriangleMesh intersects, false otherwiseboolean encloses(Vector3d point)
TriangleMesh is closed and the given point is inside this TriangleMesh.point - the given pointTriangleMeshboolean isInsideOut()
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.TriangleMesh surface is oriented inside-outTriangleMesh flipped()
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.TriangleMeshdouble getArea()
TriangleMesh.TriangleMeshdouble getVolume()
TriangleMesh.
This method will produce a meaningful result only if the TriangleMesh is closed
and does not contain intersecting solids.TriangleMeshOptional<Segment3d> shortestPathTo(Vector3d point)
TriangleMesh to a given point, if such path exists.point - the point as Vector3dTriangleMesh to the given point, if it existsOptional<Segment3d> shortestPathTo(TriangleMesh other)
TriangleMesh to another, if such path exists.other - the other TriangleMeshTriangleMesh to the other, if it existsOptional<Segment3d> shortestVerticalPathTo(Vector3d point)
TriangleMesh to a point, if such path exists.point - the point as Vector3dTriangleMesh to the point, if it existsOptional<Segment3d> shortestVerticalPathTo(TriangleMesh other)
TriangleMesh to another, if such path exists.other - the other TriangleMeshTriangleMesh to the other, if it existsOptional<Segment3d> shortestHorizontalPathTo(Vector3d point)
TriangleMesh to a point, if such path exists.point - the point as Vector3dTriangleMesh to the point, if it existsOptional<Segment3d> shortestHorizontalPathTo(TriangleMesh other)
TriangleMesh to another, if such path exists.other - the other TriangleMeshTriangleMesh to the other, if it existsOptional<Segment2d> shortest2dPathInXYPlaneProjectionTo(Vector3d point)
TriangleMesh to the projection of a
point in the XY-plane, if such path exists.point - the point as Vector3dTriangleMesh and the point, if it existsOptional<Segment2d> shortest2dPathInXYPlaneProjectionTo(TriangleMesh other)
TriangleMesh to the projection of another
TriangleMesh in the XY-plane, if such path exists.other - the other TriangleMeshTriangleMeshes, if it existsCopyright © 2020 Solibri, Inc.. All rights reserved.