#include <opennurbs_quickhull3d.h>
◆ FaceIndexFlags
Bit flags controlling the index format returned by GetFaces() and Print(). Combine them with operator|. The default (NONE) is counter-clockwise, hull-relative, and zero-based.
| Enumerator |
|---|
| None | ccw, hull-relative, zero-based (the default)
|
| Clockwise | list face vertices clockwise rather than ccw
|
| IndexedFromOne | number vertices starting at 1
|
| IndexedFromZero | number vertices starting at 0 (the default)
|
| PointRelative | number relative to the original input points
|
◆ ON_QuickHull3D()
| ON_QuickHull3D::ON_QuickHull3D |
( |
| ) |
|
◆ ~ON_QuickHull3D()
| ON_QuickHull3D::~ON_QuickHull3D |
( |
| ) |
|
◆ Build() [1/6]
| bool ON_QuickHull3D::Build |
( |
const double * |
coords, |
|
|
int |
point_count |
|
) |
| |
◆ Build() [2/6]
| bool ON_QuickHull3D::Build |
( |
const ON_3dPoint * |
points, |
|
|
int |
point_count |
|
) |
| |
Description: Build the convex hull of a set of 3d points. Parameters: points - [in] input points (point_count of them). point_count - [in] number of input points; must be >= 4. coords - [in] flat array of 3*point_count doubles (x0,y0,z0,x1,...). point_cloud - [in] input points; if it carries per-point colors (HasPointColors()) the colors of the hull vertices are captured and emitted by ToMesh(). Returns: True if a hull was built. If the input is null, has fewer than four points, or is degenerate (coincident, colinear, or coplanar within the distance tolerance) ON_ERROR is called and false is returned.
◆ Build() [3/6]
Description: Build the convex hull of a set of 3d points, also returning the vertex indices of each hull face. Parameters: points - [in] input points (point_count of them). point_count - [in] number of input points; must be >= 4. facets - [out] one entry per hull face, each containing the indices, into the points array, of that face's vertices - equivalent to GetFaces(facets, FaceIndexFlags::PointRelative), but returned directly from Build() without a separate call. Emptied if the hull could not be built. Returns: True if a hull was built. See Build(const ON_3dPoint*, int) for the conditions under which this fails.
◆ Build() [4/6]
◆ Build() [5/6]
Description: Build the convex hull of a point cloud, also returning the vertex indices of each hull face. Parameters: point_cloud - [in] input points; if it carries per-point colors (HasPointColors()) the colors of the hull vertices are captured and emitted by ToMesh(). facets - [out] one entry per hull face, each containing the indices, into point_cloud, of that face's vertices - equivalent to GetFaces(facets, FaceIndexFlags::PointRelative), but returned directly from Build() without a separate call. Emptied if the hull could not be built. Returns: True if a hull was built. See Build(const ON_PointCloud&) for the conditions under which this fails.
◆ Build() [6/6]
◆ GetDistanceTolerance()
| double ON_QuickHull3D::GetDistanceTolerance |
( |
| ) |
const |
Distance tolerance used to decide when faces are unambiguously convex and when points are unambiguously above or below a face plane. By default it is computed automatically from the input point data. Setting an explicit tolerance that is not a valid positive number restores that default, and GetExplicitDistanceTolerance() then returns ON_UNSET_VALUE.
◆ GetExplicitDistanceTolerance()
| double ON_QuickHull3D::GetExplicitDistanceTolerance |
( |
| ) |
const |
◆ GetFaces()
Description: Get the vertex indices of each hull face. Parameters: faces - [out] emptied, then filled with one entry per hull face, each containing the indices of that face's vertices. index_flags - [in] any combination of FaceIndexFlags values. Returns: The number of hull faces.
◆ GetNumFaces()
| int ON_QuickHull3D::GetNumFaces |
( |
| ) |
const |
◆ GetNumVertices()
| int ON_QuickHull3D::GetNumVertices |
( |
| ) |
const |
Number of vertices / faces in the most recently built hull.
◆ GetVertexPointIndices()
| int ON_QuickHull3D::GetVertexPointIndices |
( |
ON_SimpleArray< int > & |
indices | ) |
const |
Description: Get, for each hull vertex, the index of the input point it came from. Parameters: indices - [out] emptied, then filled with one input point index per hull vertex. Returns: The number of hull vertices.
◆ GetVertices() [1/2]
| int ON_QuickHull3D::GetVertices |
( |
double * |
coords | ) |
const |
Copies the hull vertex coordinates into coords (3*GetNumVertices() doubles) and returns the number of vertices, or 0 if coords is null.
◆ GetVertices() [2/2]
Description: Get the hull vertex points. Parameters: vertices - [out] emptied, then filled with the hull vertex points. Returns: The number of hull vertices.
◆ HasVertexColors()
| bool ON_QuickHull3D::HasVertexColors |
( |
| ) |
const |
Returns true if the most recent Build() captured per-point colors that ToMesh() will emit as per-vertex colors on the output mesh.
◆ IsValid() [1/2]
| bool ON_QuickHull3D::IsValid |
( |
ON_TextLog * |
text_log | ) |
const |
Description: Verify the hull: no face is non-convex and no input point lies outside any face, both measured against the distance tolerance. Parameters: text_log - [in] destination for diagnostic messages; may be null. tol - [in] distance tolerance to test against. Returns: True if the hull is valid.
◆ IsValid() [2/2]
| bool ON_QuickHull3D::IsValid |
( |
ON_TextLog * |
text_log, |
|
|
double |
tolerance |
|
) |
| const |
◆ SetExplicitDistanceTolerance()
| void ON_QuickHull3D::SetExplicitDistanceTolerance |
( |
double |
tol | ) |
|
◆ ToMesh()
Description: Populate an ON_Mesh from the hull. Triangular faces become triangles (ON_MeshFace with vi[2]==vi[3]); merged quads become quads; merged faces of five or more sides are fan-triangulated and the tessellation triangles are grouped as a single ON_MeshNgon so the original hull face is preserved. Face and vertex normals are computed. Per-vertex colors are set when HasVertexColors() is true. Parameters: mesh - [in] if not nullptr, this mesh is destroyed and reused to return the result; otherwise a new ON_Mesh is allocated. Returns: A pointer to the populated mesh (mesh, or a newly allocated ON_Mesh when mesh is nullptr), or nullptr if no hull has been built, in which case a caller-supplied mesh is left untouched.
◆ Triangulate()
| void ON_QuickHull3D::Triangulate |
( |
| ) |
|
Triangulates any non-triangular hull faces in place.