Package boofcv.io.points
Class StlDataStructure
java.lang.Object
boofcv.io.points.StlDataStructure
Data structure used to store 3D objects that is native to the STL file format [1,2]. One deviation is that vertexes are stored as an integer reference. This is done to reduce storage size and make verifying the correctness of a solid easier.
All Facets have exactly 3 vertexes.
Rules from specification:
- Vertex-to-vertex rule. Each triangle must share two vertices with each of its adjacent triangles. In other words, a vertex of one triangle cannot lie on the side of another.
- Facet orientation. The facets define the surface of a 3-dimensional object. As such, each facet is part of the boundary between the interior and the exterior of the object. The orientation of the facets (which way is “out” and which way is “in”) is specified redundantly in two ways which must be consistent. First, the direction of the normal is outward. Second, the vertices are listed in counterclockwise order when looking at the object from the outside (right-hand rule).
[1] StereoLithography Interface Specification, 3D Systems, Inc., October 1989
[2] The STL Format
-
Field Summary
Modifier and TypeFieldDescriptionMapping from vertex in a Facet to the value of a vertex in 3D stored in vertexesWhat's the name of this SolidNormals stored in a compact format3D location of each vertex -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFacet
(int vertIdx1, int vertIdx2, int vertIdx3, Vector3D_F64 normal) void
addFacet
(Point3D_F64 v1, Point3D_F64 v2, Point3D_F64 v3) Adds the facet.void
addFacet
(Point3D_F64 v1, Point3D_F64 v2, Point3D_F64 v3, Vector3D_F64 normal) Adds the facet with the provided normal vectorint
Number of Facets in this solidvoid
getFacet
(int which, Vector3D_F64 outNormal, DogArray<Point3D_F64> outVertexes) Retrieves the 3D structure of a facetvoid
reset()
setTo
(StlDataStructure src) int
size()
Same asfacetCount()
toAccess()
Wraps the data structure insideMeshPolygonAccess
.toMesh
(@Nullable VertexMesh out) Converts this into aVertexMesh
.
-
Field Details
-
vertexes
3D location of each vertex -
normals
Normals stored in a compact format -
facetVertsIdx
Mapping from vertex in a Facet to the value of a vertex in 3D stored in vertexes -
name
What's the name of this Solid
-
-
Constructor Details
-
StlDataStructure
public StlDataStructure()
-
-
Method Details
-
reset
public void reset() -
setTo
-
addFacet
Adds the facet with the provided normal vector -
addFacet
Adds the facet. Computes the normal vector using cross product on the input points -
addFacet
-
facetCount
public int facetCount()Number of Facets in this solid -
size
public int size()Same asfacetCount()
-
getFacet
Retrieves the 3D structure of a facet- Parameters:
which
- Which facet in this solid is being requested.outNormal
- The normal vector of the facetoutVertexes
- All the vertexes for this facet
-
toMesh
Converts this into aVertexMesh
. Information about normals and the name are discarded.- Parameters:
out
- Storage for output mesh. Can be null.- Returns:
- The converted mesh.
-
toAccess
Wraps the data structure insideMeshPolygonAccess
.
-