8 #ifndef __BV_OBBTree_h__
9 #define __BV_OBBTree_h__
27 #define CONVEX_HULL_DEBUG 0
86 typedef std::map<UT_Vector3, BV_CHPointInfo, BV_CHPointInfo>
TPointInfoMap;
119 {
return myDoRestart; }
137 TEdgeInfoSet::iterator myTraversalIt;
140 bool myIsAboutToReset;
145 #if CONVEX_HULL_DEBUG
190 {
return myIsDeleted; }
192 {
return myVertices[
index]; }
200 bool myIsNormalValid;
213 BV_OBB(
int startLeaf,
int numLeaves);
219 void save(std::ostream &os,
bool onlyStructure)
const;
222 int64 getMemoryUsage()
const;
226 {
return mySize < 0; }
277 const char *
getType()
const override;
287 buildInternal(leafIt,
true);
296 void setUseConvexHull(
bool bValue);
297 bool getUseConvexHull();
318 bool onlyStructure)
const override;
320 bool onlyStructure)
override;
325 buildInternal(leafIt,
false);
336 fpreal tol)
const override;
345 BV_OBB *createTree(
int startprim,
int numleaves,
349 bool updateExtentsRecurse(
BV_OBB &node,
358 void calcOBB(
BV_OBB &node);
361 void calcSize(
BV_OBB &node);
375 fpreal tol,
int identities)
const;
378 static int compareLeaves(
const void *t1,
const void *t2);
380 void calculateSortKeys(bvLeaf *prims,
int numleaves,
virtual void saveSubclass(std::ostream &os, bool onlyStructure) const =0
uint getVertex(int index) const
TPointArray & getPoints()
UT_Vector3 myTrans
Center, relative to parent.
void buildSubclass(BV_LeafIterator &leafIt) override
UT_Vector3 myRadii
Radii in each axis (half of the dimension)
void edgeSanityCheck()
Checks for valid edge counts. Debug.
void clearAssocPoints()
Clears all points associated with this triangle.
virtual bool loadSubclass(UT_IStream &is, bool onlyStructure)=0
GA_API const UT_StringHolder rot
GLboolean GLboolean GLboolean GLboolean a
virtual BV_Status intersectSubclass(BV_Callback &callback, const BV_Tree &treeb, const UT_DMatrix4 &startxforma, const UT_DMatrix4 &startxformb, const UT_DMatrix4 &endxforma, const UT_DMatrix4 &endxformb, fpreal tol) const =0
const BV_CHEdgeInfo * edgeTraversalNext()
BV_CHTriangle(BV_CHDataManager &parent_manager, uint point1_idx, uint point2_idx, uint point3_idx)
int myStartLeaf
Index of first leaf.
const BV_CHEdgeInfo * edgeTraversalBegin()
Traverse edges.
void reset()
Resets the manager for the next iteration.
void getNormal(UT_Vector3 &normal)
Gets triangle normal. Cached.
bool isDisabled() const
Hackish way of determining if a leaf is disabled or not.
bool operator()(const UT_Vector3 &s1, const UT_Vector3 &s2) const
virtual void updateExtentsSubclass(BV_LeafIterator &leafIt)=0
virtual int64 getMemoryUsageSubclass() const =0
void onTriangleCreated(BV_CHTriangle *triangle_in)
Called every time a triangle is deleted or is marked as deleted.
A single node in a BV_OBBTree.
Callback for bounding volume hierarchy intersection operation.
void markDeleted(bool do_call_manager=true)
GA_API const UT_StringHolder trans
UT_LinkListT< BV_CHTriangle * > TTriArray
void addPoint(const UT_Vector3 point_in)
Accumulated the point position.
void buildLazy(BV_LeafIterator &leafIt)
bool getIsBad() const
Returns true if this is a "bad" triangle, false otherwise.
UT_Array< BV_CHSimpleTriangle > TSimpleTriangleArray
bool myUseConvexHullForBBoxes
int myNumLeaves
How many leaves I own.
bool findMostDistantAssocPoint(uint &point_idx_out)
Find the most distant point associated with this triangle.
UT_Array< bvLeaf > myLeaves
UT_Array< UT_Vector3 > TPointArray
BV_LeafIterator * myLeafIt
fpreal jigglePointTetra(BV_CHTriangle *coplanar_triangle, int iPointIndex)
Jiggles a point to lie more than FLT_EPSILON away from the triangle.
bool canSee(const uint point_index)
Checks whether this triangle can see the given point or not.
GLboolean GLboolean GLboolean b
UT_Array< int > TPointIndexArray
GLint GLint GLsizei GLsizei GLsizei depth
UT_Matrix3 myRot
Orientation of the bounding box, relative to parent.
BV_CHDataManager(const TPointArray &points_in)
Constructs the manager, welds input points.
virtual BV_Tree * cloneSubclass() const =0
virtual const BV_Tree * castTo(const char *type) const
fpreal getSignedDistance(const uint point_index)
Gets signed distance from the given point to the triangle.
UT_Array< fpreal > TFloatArray
void getAssocPoints(TPointIndexArray &points_idx_out)
Appends this triangle's associated points to rPointsOut array.
UT_Vector3 getAveragePoint() const
Returns an average point position accumulated so far.
LeafData & operator=(const LeafData &)=delete
std::map< UT_Vector3, BV_CHPointInfo, BV_CHPointInfo > TPointInfoMap
std::set< BV_CHEdgeInfo, BV_CHEdgeInfo > TEdgeInfoSet
void onTriangleDeleted(BV_CHTriangle *triangle_in)
Called every time a triangle is created.
bool operator()(const BV_CHEdgeInfo &s1, const BV_CHEdgeInfo &s2) const
void associatePoints(TPointIndexArray &points_in, bool do_ignore_restart_flag)
void weldPoints(const TPointArray &points_in, TPointArray &merged_pts_out)
bool getIsDeleted() const
const BV_CHEdgeInfo * findEdge(int curr_v1_idx, int curr_v2_idx) const
Find an edge between two vertices.
virtual const char * getType() const =0
virtual int getNumLeavesSubclass() const =0
bool getDoRestart() const