Rhino C++ API
8.10
|
#include <opennurbs_plus_trimesh.h>
Public Member Functions | |
ON_TriangleMesh () | |
ON_TriangleMesh (const ON_TriangleMesh &) | |
~ON_TriangleMesh () | |
bool | Create (const class ON_Mesh *mesh, bool bPersistentMeshReference) |
bool | CreateTriangleRTree (class ON_RTree &rtree) const |
void | Destroy () |
void | DestroyCachedInformation () |
bool | EvNormal (const struct ON_TriangleMeshPoint *triangle_point, double normal[3]) const |
bool | EvNormal (unsigned int triangle_index, const double tri_bc[3], double normal[3]) const |
bool | EvNormal (unsigned int triangle_index, double a, double b, double c, double normal[3]) const |
bool | EvPoint (const struct ON_TriangleMeshPoint *triangle_point, double point[3]) const |
bool | EvPoint (unsigned int triangle_index, const double tri_bc[3], double point[3]) const |
bool | EvPoint (unsigned int triangle_index, double a, double b, double c, double point[3]) const |
bool | EvPointAndNormal (const struct ON_TriangleMeshPoint *triangle_point, double point[3], double normal[3]) const |
bool | EvPointAndNormal (unsigned int triangle_index, const double tri_bc[3], double point[3], double normal[3]) const |
bool | EvPointAndNormal (unsigned int triangle_index, double a, double b, double c, double point[3], double normal[3]) const |
bool | GetClosestPoint (const class ON_3dPoint *test_point, double maximum_distance_tolerance, unsigned int *triangle_index, double triangle_bc[3]) const |
bool | IntersectLine (const double p0[3], const double p1[3], double tolerance, bool ON_CALLBACK_CDECL resultCallback(void *context, const double line_t[2], const struct ON_TriangleMeshPoint tri_t[2], struct ON_RTreeCapsule *capsule), void *context) const |
class ON_Mesh * | MeshForm (class ON_Mesh *mesh) const |
const class ON_Mesh * | MeshReference () const |
bool | OffsetMesh (double offset_distance) |
bool | OffsetMesh (double offset_distance, const double(*N)[3], double(*offset_V)[3]) const |
bool | OffsetMesh (double offset_distance, const float(*N)[3], double(*offset_V)[3]) const |
ON_TriangleMesh & | operator= (const ON_TriangleMesh &) |
const class ON_TrianglePlane * | PlaneEquation (unsigned int triangle_index) const |
void | SetStatus (unsigned int triangle_index, unsigned int status) |
unsigned int | Status (unsigned int triangle_index) const |
const unsigned int * | StatusArray () const |
unsigned int | StatusCount () const |
const class ON_RTree * | TriangleRTree () const |
const unsigned int * | VertexMap () const |
const ON_3dPoint * | VertexPoints () const |
Static Public Member Functions | |
static bool | BarycentricTriToQuad (unsigned int T_flags, const double tri_bc[3], double quad_bc[4]) |
static bool | BarycentricTriToQuad (unsigned int T_flags, double a, double b, double c, double quad_bc[4]) |
static int | CompareLocation (const double a[3], const double b[3]) |
Public Attributes | |
const double(* | m_N )[3] |
optional vertex unit normals More... | |
const unsigned int(* | m_T )[3] |
unsigned int | m_T_count |
number of triangles in m_T[] More... | |
const unsigned int * | m_T_flags |
const unsigned int * | m_T_id |
const double(* | m_V )[3] |
vertex locations More... | |
unsigned int | m_V_count |
number of vertices in m_V[] More... | |
ON_TriangleMesh::ON_TriangleMesh | ( | ) |
ON_TriangleMesh::ON_TriangleMesh | ( | const ON_TriangleMesh & | ) |
ON_TriangleMesh::~ON_TriangleMesh | ( | ) |
|
static |
Description: Convert triangle barycentric coordinates to quad barycentric coordinates. Parameters: T_flags - [in] The value of (0x1F & Tflags) specifies the correspondence between the corners of the triangle and the corners of the quad. A table of the values and correspondences is in the description of the m_T_flags member variable above. tri_bc - [in] Three triangle barycentric coordinates quad_bc - [out] For quad barycentric coordinates. The corner of the quad that does not correspond to a triangle corner will have value of 0.0. Returns: True if the value of (0x1F & Tflags) was a valid and quad_bc was set from tri_bc. False if the value of (0x1F & Tflags) was not valid and quad_bc was set to (0.0,0.0,0.0,0.0).
|
static |
Description: Convert triangle barycentric coordinates to quad barycentric coordinates. Parameters: T_flags - [in] The value of (0x1F & Tflags) specifies the correspondence between the corners of the triangle and the corners of the quad. A table of the values and correspondences is in the description of the m_T_flags member variable above. a - [in] b - [in] c - [in] (a,b,c) are the triangle barycentric coordinates quad_bc - [out] For quad barycentric coordinates. The corner of the quad that does not correspond to a triangle corner will have value of 0.0. Returns: True if the value of (0x1F & Tflags) was a valid and quad_bc was set from tri_bc. False if the value of (0x1F & Tflags) was not valid and quad_bc was set to (0.0,0.0,0.0,0.0).
|
static |
Parameters: a - [in] b - [in] Returns: < 0: a < b in dictionary ordering = 0: a = b < 0: a > b in dictionary ordering Remarks: null pointers are considered less than non-null pointers.
bool ON_TriangleMesh::Create | ( | const class ON_Mesh * | mesh, |
bool | bPersistentMeshReference | ||
) |
Description: Create a double precision triangle mesh from an ON_Mesh. Parameters: mesh - [in] Mesh to use for triangle references. bPersistentMeshReference - in If bPersistentMeshReference is true, then the caller is responsible for making sure "mesh" persists unchanged for the life of this ON_TriangleMesh class and as much mesh information as possible will be referenced. If bPersistentMeshReference is false, all information will be copied to heap managed by this ON_TriangleMesh class. Remarks: The index of the ON_Mesh::m_F[] facet used to generate the triangle is m_T[][3].
If ON_Mesh::m_F[fi] facet is a quad, then two triangles will be made using one of the following vertex sets from ON_MeshFace::vi[] array. (0,1,2,fi) and (0,2,3,fi), or (1,2,3,fi) and (1,3,0,fi)
bool ON_TriangleMesh::CreateTriangleRTree | ( | class ON_RTree & | rtree | ) | const |
Description: Get an r-tree made from triangle bounding boxes and their indices that is managed by the caller.
void ON_TriangleMesh::Destroy | ( | ) |
void ON_TriangleMesh::DestroyCachedInformation | ( | ) |
Description: Deletes any cached bounding box, triangle plane, R-tree or Vmap information. Remarks: If you modify the length or values of the m_V[] of m_T[] arrays, then any cached bounding box, triangle plane, R-tree or Vmap information may be invalid and should be destroyed.
bool ON_TriangleMesh::EvNormal | ( | const struct ON_TriangleMeshPoint * | triangle_point, |
double | normal[3] | ||
) | const |
bool ON_TriangleMesh::EvNormal | ( | unsigned int | triangle_index, |
const double | tri_bc[3], | ||
double | normal[3] | ||
) | const |
Description: Evaluate normal on the triangle mesh. Parameters: triangle_index - [in] index of the triangle tri_bc - [in] barycentric coordinates of the point a, b, c - [in] barycentric coordinates of the point
bool ON_TriangleMesh::EvNormal | ( | unsigned int | triangle_index, |
double | a, | ||
double | b, | ||
double | c, | ||
double | normal[3] | ||
) | const |
bool ON_TriangleMesh::EvPoint | ( | const struct ON_TriangleMeshPoint * | triangle_point, |
double | point[3] | ||
) | const |
bool ON_TriangleMesh::EvPoint | ( | unsigned int | triangle_index, |
const double | tri_bc[3], | ||
double | point[3] | ||
) | const |
Description: Evaluate point on the triangle mesh. Parameters: triangle_index - [in] index of the triangle tri_bc - [in] barycentric coordinates of the point a, b, c - [in] barycentric coordinates of the point
bool ON_TriangleMesh::EvPoint | ( | unsigned int | triangle_index, |
double | a, | ||
double | b, | ||
double | c, | ||
double | point[3] | ||
) | const |
bool ON_TriangleMesh::EvPointAndNormal | ( | const struct ON_TriangleMeshPoint * | triangle_point, |
double | point[3], | ||
double | normal[3] | ||
) | const |
bool ON_TriangleMesh::EvPointAndNormal | ( | unsigned int | triangle_index, |
const double | tri_bc[3], | ||
double | point[3], | ||
double | normal[3] | ||
) | const |
Description: Evaluate normal on the triangle mesh. Parameters: triangle_index - [in] index of the triangle tri_bc - [in] barycentric coordinates of the point a, b, c - [in] barycentric coordinates of the point
bool ON_TriangleMesh::EvPointAndNormal | ( | unsigned int | triangle_index, |
double | a, | ||
double | b, | ||
double | c, | ||
double | point[3], | ||
double | normal[3] | ||
) | const |
bool ON_TriangleMesh::GetClosestPoint | ( | const class ON_3dPoint * | test_point, |
double | maximum_distance_tolerance, | ||
unsigned int * | triangle_index, | ||
double | triangle_bc[3] | ||
) | const |
Description: Find a point on the triangle mesh that is closest to test_point. Parameters: test_point - [in] maximum_distance_tolerance - [in] If maximum_distance_tolerance >= 0.0, then an answer is returned only if the distance from the point on the triangle mesh to test_point is <= maximum_distance_tolerance. Otherwise the closest point is returned. triangle_index - [out] triangle_bc - [out] If the return value is true, then triangle_index identifies a triangle on the mesh that is closest to test_point.
The barycentric coordinates of the point on this triangle are returned in triangle_bc[0,1,2]. If the return value is false, then triangle_index is set to 0xFFFFFFFF and t is set to (ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE).
bool ON_TriangleMesh::IntersectLine | ( | const double | p0[3], |
const double | p1[3], | ||
double | tolerance, | ||
bool ON_CALLBACK_CDECL | resultCallbackvoid *context, const double line_t[2], const struct ON_TriangleMeshPoint tri_t[2], struct ON_RTreeCapsule *capsule, | ||
void * | context | ||
) | const |
Description: Find the intersection points of a line segment and the triangle mesh. Parameters: p0 - [in] p1 - [in] The line segment begins at p0 and ends at p1. tolerance - [in] The distance between the returned points on the line segment and the mesh will be <= tolerance. resultCallback - [in] Each time an intersection point is found, resultCallback is called. If resultCallback() returns true, the search for additional intersection points continues. If resultCallback() returns false, the search is terminated. The "line_t" and "tri"t" parameters provide the location of the intersection point. If the intersection is a single point, then line_t[0] = line_t[1] and tri_t[0] = tri_t[1]. If the line and triangle overlap, then 0 <= line_t[0] < line_t[1] <= 1. The capsule parameter may be shrunk as needed to speed searching in applications like ray shooting. See ON_RTree::Search() for more details about capsule shrinking. context - [in] This pointer is passed as the first argument to resultCallback(). Returns: True if intersection points were found.
Description: Get an ON_Mesh that looks like this triangle mesh. Parameters: mesh - [in] null or the mesh to store the result. Returns: Null if this mesh is not valid, otherwise a pointer to an ON_Mesh class that looks like this triangle mesh. If the mesh input parameter is null, then the returned mesh is on the heap and must be managed by the caller.
const class ON_Mesh* ON_TriangleMesh::MeshReference | ( | ) | const |
bool ON_TriangleMesh::OffsetMesh | ( | double | offset_distance | ) |
bool ON_TriangleMesh::OffsetMesh | ( | double | offset_distance, |
const double(*) | N[3], | ||
double(*) | offset_V[3] | ||
) | const |
Description: Offset a triangle mesh. Parameters: offset_distance - [in] N - [in] array of m_V_count vertex unit length normals. offset_V - [out] Offset vertex locations are returned here. Pass const_cast< double (*)[3] > m_V if you want to offset this mesh in place. Returns: True if successful. False if input parameters are not valid.
bool ON_TriangleMesh::OffsetMesh | ( | double | offset_distance, |
const float(*) | N[3], | ||
double(*) | offset_V[3] | ||
) | const |
ON_TriangleMesh& ON_TriangleMesh::operator= | ( | const ON_TriangleMesh & | ) |
const class ON_TrianglePlane* ON_TriangleMesh::PlaneEquation | ( | unsigned int | triangle_index | ) | const |
void ON_TriangleMesh::SetStatus | ( | unsigned int | triangle_index, |
unsigned int | status | ||
) |
unsigned int ON_TriangleMesh::Status | ( | unsigned int | triangle_index | ) | const |
const unsigned int* ON_TriangleMesh::StatusArray | ( | ) | const |
Returns: nullptr if SetStatus has not been called. Otherwise a pointer to the m_status[] array. If you const_cast<> this array and modify it, then the value returned by SetStatus() will not be reliable.
unsigned int ON_TriangleMesh::StatusCount | ( | ) | const |
Returns: Number of non-zero status values.
const class ON_RTree* ON_TriangleMesh::TriangleRTree | ( | ) | const |
Description: Get an r-tree made from triangle bounding boxes and their indices that is managed by the ON_TriangleMesh class.
const unsigned int* ON_TriangleMesh::VertexMap | ( | ) | const |
Description: Get a Returns: A permutation of {0,1, ..., m_V_count-1} such that all ON_TriangleMesh::CompareLocation( Vmap[i], Vmap[i+1] ) <= 0.
const ON_3dPoint* ON_TriangleMesh::VertexPoints | ( | ) | const |
Returns: Vertex locations as an array of ON_3dPoints saving you the cast operation.
const double(* ON_TriangleMesh::m_N)[3] |
optional vertex unit normals
const unsigned int(* ON_TriangleMesh::m_T)[3] |
triangles m_V[m_T[ti][0]], m_V[m_T[ti][1]], m_V[m_T[ti][2]]
unsigned int ON_TriangleMesh::m_T_count |
number of triangles in m_T[]
const unsigned int* ON_TriangleMesh::m_T_flags |
triangle flags m_T_flags can be nullptr. If it is not nullptr, then information about triangle m_T[ti] is encoded in m_T_flags[ti] as follows:
(m_T_flags[ti] & 0x3F): The low six bits (m_T_flags[ti] & 0x3F) specifies how to convert triangle barycentric coordinates (a,b,c) to ON_MeshFace barycentric coordinates. q[ 0x03 & T_flags ] = a q[(0x0C & T_flags)>>2] = b q[(0x30 & T_flags)>>4] = c q[other element] = 0.0 The static function BarycentricTriToQuad() will perform the conversion.
(m_T_flags[ti] & 0x01C0): The next 3 bits are used to indicate when an edge of a triangle is not an edge of the original mesh object. For example, when a quad is split into two triangles, the triangles edges corresponding to the splitting diagonal have their bits set. 0 != (m_T_flags[ti] & 0x0040) means the triangle edge opposite vertex m_T[ti][0] is not an edge in the original mesh. 0 != (m_T_flags[ti] & 0x0080) means the triangle edge opposite vertex m_T[ti][1] is not an edge in the original mesh. 0 != (m_T_flags[ti] & 0x0100) means the triangle edge opposite vertex m_T[ti][2] is not an edge in the original mesh. triangle flags
const unsigned int* ON_TriangleMesh::m_T_id |
m_T[i][4] = "id" value used in various ways m_T[i][4] = "id" value used in various ways triangle "id" values depend on context and can set as needed.
const double(* ON_TriangleMesh::m_V)[3] |
vertex locations
unsigned int ON_TriangleMesh::m_V_count |
number of vertices in m_V[]