MeshLib C Docs
Loading...
Searching...
No Matches
MRAABBTree.h File Reference
#include <MRCMesh/MRBox.h>
#include <MRCMesh/MRId.h>
#include <MRCMisc/common.h>
#include <MRCMisc/exports.h>
#include <stddef.h>

Go to the source code of this file.

Typedefs

typedef struct MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f
typedef struct MR_AABBTreeNode_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f MR_AABBTreeNode_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f
typedef struct MR_FaceBMap MR_FaceBMap
typedef struct MR_FaceBitSet MR_FaceBitSet
typedef struct MR_MeshPart MR_MeshPart
typedef struct MR_NodeBitSet MR_NodeBitSet
typedef struct MR_Vector_MR_AABBTreeNode_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f_MR_NodeId MR_Vector_MR_AABBTreeNode_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f_MR_NodeId
 std::vector<T>-like container that requires specific indexing type,
typedef struct MR_VertBitSet MR_VertBitSet
typedef struct MR_std_vector_MR_NodeId MR_std_vector_MR_NodeId
typedef struct MR_AABBTree MR_AABBTree

Functions

MRC_API MR_AABBTreeMR_AABBTree_DefaultConstruct (void)
MRC_API MR_AABBTreeMR_AABBTree_DefaultConstructArray (size_t num_elems)
MRC_API const MR_AABBTreeMR_AABBTree_OffsetPtr (const MR_AABBTree *ptr, ptrdiff_t i)
MRC_API MR_AABBTreeMR_AABBTree_OffsetMutablePtr (MR_AABBTree *ptr, ptrdiff_t i)
MRC_API const MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3fMR_AABBTree_UpcastTo_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f (const MR_AABBTree *object)
MRC_API MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3fMR_AABBTree_MutableUpcastTo_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f (MR_AABBTree *object)
MRC_API const MR_AABBTreeMR_AABBTree_StaticDowncastFrom_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f (const MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f *object)
MRC_API MR_AABBTreeMR_AABBTree_MutableStaticDowncastFrom_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f (MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f *object)
MRC_API MR_AABBTreeMR_AABBTree_ConstructFromAnother (MR_PassBy _other_pass_by, MR_AABBTree *_other)
MRC_API MR_AABBTreeMR_AABBTree_Construct (const MR_MeshPart *mp)
MRC_API void MR_AABBTree_Destroy (const MR_AABBTree *_this)
 Destroys a heap-allocated instance of MR_AABBTree. Does nothing if the pointer is null.
MRC_API void MR_AABBTree_DestroyArray (const MR_AABBTree *_this)
 Destroys a heap-allocated array of MR_AABBTree. Does nothing if the pointer is null.
MRC_API MR_AABBTreeMR_AABBTree_AssignFromAnother (MR_AABBTree *_this, MR_PassBy _other_pass_by, MR_AABBTree *_other)
MRC_API void MR_AABBTree_refit (MR_AABBTree *_this, const MR_Mesh *mesh, const MR_VertBitSet *changedVerts)
MRC_API const MR_Vector_MR_AABBTreeNode_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f_MR_NodeIdMR_AABBTree_nodes (const MR_AABBTree *_this)
MRC_API const MR_AABBTreeNode_MR_AABBTreeTraits_MR_FaceTag_MR_Box3fMR_AABBTree_index (const MR_AABBTree *_this, MR_NodeId nid)
MRC_API MR_NodeId MR_AABBTree_rootNodeId (void)
MRC_API MR_Box3f MR_AABBTree_getBoundingBox (const MR_AABBTree *_this)
MRC_API MR_uint64_t MR_AABBTree_heapBytes (const MR_AABBTree *_this)
MRC_API MR_uint64_t MR_AABBTree_numLeaves (const MR_AABBTree *_this)
MRC_API MR_std_vector_MR_NodeIdMR_AABBTree_getSubtrees (const MR_AABBTree *_this, int minNum)
MRC_API MR_FaceBitSetMR_AABBTree_getSubtreeLeaves (const MR_AABBTree *_this, MR_NodeId subtreeRoot)
MRC_API MR_NodeBitSetMR_AABBTree_getNodesFromLeaves (const MR_AABBTree *_this, const MR_FaceBitSet *leaves)
MRC_API void MR_AABBTree_getLeafOrder (const MR_AABBTree *_this, MR_FaceBMap *leafMap)
MRC_API void MR_AABBTree_getLeafOrderAndReset (MR_AABBTree *_this, MR_FaceBMap *leafMap)

Typedef Documentation

◆ MR_AABBTree

typedef struct MR_AABBTree MR_AABBTree

bounding volume hierarchy Generated from class MR::AABBTree. Base classes: Direct: (non-virtual) MR::AABBTreeBase<MR::AABBTreeTraits<MR::FaceTag, MR::Box3f>> Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f

base class for most AABB-trees (except for AABBTreePoints) Generated from class MR::AABBTreeBase<MR::AABBTreeTraits<MR::FaceTag, MR::Box3f>>. Derived classes: Direct: (non-virtual) MR::AABBTree Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Copy, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_AABBTreeNode_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f

Generated from class MR::AABBTreeNode<MR::AABBTreeTraits<MR::FaceTag, MR::Box3f>>. Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Copy, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_FaceBitSet

typedef struct MR_FaceBitSet MR_FaceBitSet

Vector<bool, I> like container (random-access, I - index type, bool - value type) with all bits after size() considered off during testing Generated from class MR::FaceBitSet. Base classes: Direct: (non-virtual) MR::BitSet Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Copy, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_FaceBMap

typedef struct MR_FaceBMap MR_FaceBMap

flat map: I -> T Generated from class MR::FaceBMap. Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_MeshPart

typedef struct MR_MeshPart MR_MeshPart

stores reference on whole mesh (if region is nullptr) or on its part (if region pointer is valid) Generated from class MR::MeshPart. Supported MR_PassBy modes: MR_PassBy_Copy (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_NodeBitSet

typedef struct MR_NodeBitSet MR_NodeBitSet

Vector<bool, I> like container (random-access, I - index type, bool - value type) with all bits after size() considered off during testing Generated from class MR::NodeBitSet. Base classes: Direct: (non-virtual) MR::BitSet Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Copy, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_std_vector_MR_NodeId

Generated from C++ container std::vector<MR::NodeId>. Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Copy, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_Vector_MR_AABBTreeNode_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f_MR_NodeId

std::vector<T>-like container that requires specific indexing type,

Template Parameters
Ttype of stored elements
Itype of index (shall be convertible to size_t) Generated from class MR::Vector<MR::AABBTreeNode<MR::AABBTreeTraits<MR::FaceTag, MR::Box3f>>, MR::NodeId>. Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Copy, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_VertBitSet

typedef struct MR_VertBitSet MR_VertBitSet

Vector<bool, I> like container (random-access, I - index type, bool - value type) with all bits after size() considered off during testing Generated from class MR::VertBitSet. Base classes: Direct: (non-virtual) MR::BitSet Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Copy, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

Function Documentation

◆ MR_AABBTree_AssignFromAnother()

MRC_API MR_AABBTree * MR_AABBTree_AssignFromAnother ( MR_AABBTree * _this,
MR_PassBy _other_pass_by,
MR_AABBTree * _other )

Generated from method MR::AABBTree::operator=. Parameter _this can not be null. It is a single object. The reference to things referred to by the parameter _other (if any) might be preserved in this object. The returned pointer will never be null. It is non-owning, do NOT destroy it. The reference to this object might be preserved in the return value. When this function is called, this object will drop any object references it held previously.

◆ MR_AABBTree_Construct()

MRC_API MR_AABBTree * MR_AABBTree_Construct ( const MR_MeshPart * mp)

creates tree for given mesh or its part Generated from constructor MR::AABBTree::AABBTree. Parameter mp can not be null. It is a single object. The reference to the parameter mp might be preserved in the constructed object. Never returns null. Returns an instance allocated on the heap! Must call MR_AABBTree_Destroy() to free it when you're done using it.

◆ MR_AABBTree_ConstructFromAnother()

MRC_API MR_AABBTree * MR_AABBTree_ConstructFromAnother ( MR_PassBy _other_pass_by,
MR_AABBTree * _other )

Generated from constructor MR::AABBTree::AABBTree. The reference to things referred to by the parameter _other (if any) might be preserved in the constructed object. Never returns null. Returns an instance allocated on the heap! Must call MR_AABBTree_Destroy() to free it when you're done using it.

◆ MR_AABBTree_DefaultConstruct()

MRC_API MR_AABBTree * MR_AABBTree_DefaultConstruct ( void )

Constructs an empty (default-constructed) instance. Never returns null. Returns an instance allocated on the heap! Must call MR_AABBTree_Destroy() to free it when you're done using it.

◆ MR_AABBTree_DefaultConstructArray()

MRC_API MR_AABBTree * MR_AABBTree_DefaultConstructArray ( size_t num_elems)

Constructs an array of empty (default-constructed) instances, of the specified size. Will never return null. The array must be destroyed using MR_AABBTree_DestroyArray(). Use MR_AABBTree_OffsetMutablePtr() and MR_AABBTree_OffsetPtr() to access the array elements.

◆ MR_AABBTree_Destroy()

MRC_API void MR_AABBTree_Destroy ( const MR_AABBTree * _this)

Destroys a heap-allocated instance of MR_AABBTree. Does nothing if the pointer is null.

◆ MR_AABBTree_DestroyArray()

MRC_API void MR_AABBTree_DestroyArray ( const MR_AABBTree * _this)

Destroys a heap-allocated array of MR_AABBTree. Does nothing if the pointer is null.

◆ MR_AABBTree_getBoundingBox()

MRC_API MR_Box3f MR_AABBTree_getBoundingBox ( const MR_AABBTree * _this)

returns the root node bounding box Generated from method MR::AABBTree::getBoundingBox. Parameter _this can not be null. It is a single object.

◆ MR_AABBTree_getLeafOrder()

MRC_API void MR_AABBTree_getLeafOrder ( const MR_AABBTree * _this,
MR_FaceBMap * leafMap )

fills map: LeafId -> leaf#; buffer in leafMap must be resized before the call, and caller is responsible for filling missing leaf elements Generated from method MR::AABBTree::getLeafOrder. Parameter _this can not be null. It is a single object. Parameter leafMap can not be null. It is a single object.

◆ MR_AABBTree_getLeafOrderAndReset()

MRC_API void MR_AABBTree_getLeafOrderAndReset ( MR_AABBTree * _this,
MR_FaceBMap * leafMap )

fills map: LeafId -> leaf#, then resets leaf order to 0,1,2,...; buffer in leafMap must be resized before the call, and caller is responsible for filling missing leaf elements Generated from method MR::AABBTree::getLeafOrderAndReset. Parameter _this can not be null. It is a single object. Parameter leafMap can not be null. It is a single object.

◆ MR_AABBTree_getNodesFromLeaves()

MRC_API MR_NodeBitSet * MR_AABBTree_getNodesFromLeaves ( const MR_AABBTree * _this,
const MR_FaceBitSet * leaves )

returns set of nodes containing among direct or indirect children given leaves Generated from method MR::AABBTree::getNodesFromLeaves. Parameter _this can not be null. It is a single object. Parameter leaves can not be null. It is a single object. Never returns null. Returns an instance allocated on the heap! Must call MR_NodeBitSet_Destroy() to free it when you're done using it.

◆ MR_AABBTree_getSubtreeLeaves()

MRC_API MR_FaceBitSet * MR_AABBTree_getSubtreeLeaves ( const MR_AABBTree * _this,
MR_NodeId subtreeRoot )

returns all leaves in the subtree with given root Generated from method MR::AABBTree::getSubtreeLeaves. Parameter _this can not be null. It is a single object. Never returns null. Returns an instance allocated on the heap! Must call MR_FaceBitSet_Destroy() to free it when you're done using it.

◆ MR_AABBTree_getSubtrees()

MRC_API MR_std_vector_MR_NodeId * MR_AABBTree_getSubtrees ( const MR_AABBTree * _this,
int minNum )

returns at least given number of top-level not-intersecting subtrees, union of which contain all tree leaves Generated from method MR::AABBTree::getSubtrees. Parameter _this can not be null. It is a single object. Never returns null. Returns an instance allocated on the heap! Must call MR_std_vector_MR_NodeId_Destroy() to free it when you're done using it.

◆ MR_AABBTree_heapBytes()

MRC_API MR_uint64_t MR_AABBTree_heapBytes ( const MR_AABBTree * _this)

returns the amount of memory this object occupies on heap Generated from method MR::AABBTree::heapBytes. Parameter _this can not be null. It is a single object.

◆ MR_AABBTree_index()

MRC_API const MR_AABBTreeNode_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f * MR_AABBTree_index ( const MR_AABBTree * _this,
MR_NodeId nid )

const-access to any node Generated from method MR::AABBTree::operator[]. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_AABBTree_MutableStaticDowncastFrom_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f()

MRC_API MR_AABBTree * MR_AABBTree_MutableStaticDowncastFrom_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f ( MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f * object)

Downcasts an instance of MR::AABBTreeBase<MR::AABBTreeTraits<MR::FaceTag, MR::Box3f>> to a derived class MR::AABBTree. This is a static downcast, it trusts the programmer that the target type is correct. Results in UB and returns an invalid pointer otherwise. The reference to the parameter object might be preserved in the return value.

◆ MR_AABBTree_MutableUpcastTo_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f()

MRC_API MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f * MR_AABBTree_MutableUpcastTo_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f ( MR_AABBTree * object)

Upcasts an instance of MR::AABBTree to its base class MR::AABBTreeBase<MR::AABBTreeTraits<MR::FaceTag, MR::Box3f>>. The reference to the parameter object might be preserved in the return value.

◆ MR_AABBTree_nodes()

const-access to all nodes Generated from method MR::AABBTree::nodes. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_AABBTree_numLeaves()

MRC_API MR_uint64_t MR_AABBTree_numLeaves ( const MR_AABBTree * _this)

returns the number of leaves in whole tree Generated from method MR::AABBTree::numLeaves. Parameter _this can not be null. It is a single object.

◆ MR_AABBTree_OffsetMutablePtr()

MRC_API MR_AABBTree * MR_AABBTree_OffsetMutablePtr ( MR_AABBTree * ptr,
ptrdiff_t i )

Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element. The reference to the parameter ptr might be preserved in the return value.

◆ MR_AABBTree_OffsetPtr()

MRC_API const MR_AABBTree * MR_AABBTree_OffsetPtr ( const MR_AABBTree * ptr,
ptrdiff_t i )

Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element. The reference to the parameter ptr might be preserved in the return value.

◆ MR_AABBTree_refit()

MRC_API void MR_AABBTree_refit ( MR_AABBTree * _this,
const MR_Mesh * mesh,
const MR_VertBitSet * changedVerts )

updates bounding boxes of the nodes containing changed vertices; this is a faster alternative to full tree rebuild (but the tree after refit might be less efficient)

Parameters
meshsame mesh for which this tree was constructed but with updated coordinates;
changedVertsvertex ids with modified coordinates (since tree construction or last refit) Generated from method MR::AABBTree::refit. Parameter _this can not be null. It is a single object. Parameter mesh can not be null. It is a single object. Parameter changedVerts can not be null. It is a single object.

◆ MR_AABBTree_rootNodeId()

MRC_API MR_NodeId MR_AABBTree_rootNodeId ( void )

returns root node id Generated from method MR::AABBTree::rootNodeId.

◆ MR_AABBTree_StaticDowncastFrom_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f()

MRC_API const MR_AABBTree * MR_AABBTree_StaticDowncastFrom_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f ( const MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f * object)

Downcasts an instance of MR::AABBTreeBase<MR::AABBTreeTraits<MR::FaceTag, MR::Box3f>> to a derived class MR::AABBTree. This is a static downcast, it trusts the programmer that the target type is correct. Results in UB and returns an invalid pointer otherwise. This version is acting on mutable pointers. The reference to the parameter object might be preserved in the return value.

◆ MR_AABBTree_UpcastTo_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f()

MRC_API const MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f * MR_AABBTree_UpcastTo_MR_AABBTreeBase_MR_AABBTreeTraits_MR_FaceTag_MR_Box3f ( const MR_AABBTree * object)

Upcasts an instance of MR::AABBTree to its base class MR::AABBTreeBase<MR::AABBTreeTraits<MR::FaceTag, MR::Box3f>>. This version is acting on mutable pointers. The reference to the parameter object might be preserved in the return value.