HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU::BVH Class Reference

#include <GU_BVH.h>

+ Inheritance diagram for GU::BVH:

Classes

class  gu_HeightIsect
 
struct  Options
 

Public Member Functions

SYS_FORCE_INLINE BVH () noexcept
 
SYS_FORCE_INLINE ~BVH () noexcept
 
SYS_FORCE_INLINE GA_Offset primitiveOffset (exint prim_index) const noexcept
 
void clear () noexcept
 
SYS_FORCE_INLINE GA_Size numItems () const noexcept
 
GA_DataId topologyId () const
 
GA_DataId primlistId () const
 
void init (const GEO_Detail &detail, const GA_ROHandleT< VectorType > &P, const Options &options, const GA_ROHandleF &pscale, const float radscale=1.0f, const bool force_rebalance=false, SecondaryTreeMap *secondary_trees=nullptr, SecondaryDetailMap *secondary_details=nullptr, UT_Lock *secondary_lock=nullptr) noexcept
 
void init (const GEO_Detail &detail, const GA_ROHandleT< VectorType > &P, const Options &options, const float radius=0.0f, const bool force_rebalance=false) noexcept
 NOTE: With this signature, radius is the point radius. More...
 
SYS_FORCE_INLINE bool isNGon (exint index) const noexcept
 
UT_Vector3 findNGonUVW (exint index, const UT_Vector3 &position, const GEO_Detail &detail) const noexcept
 
SYS_FORCE_INLINE bool isPacked (exint index) const noexcept
 
- Public Member Functions inherited from GEO::BVHBase< NAXES, SUBCLASS >
 BVHBase () noexcept
 
 ~BVHBase () noexcept
 
SYS_FORCE_INLINE bool isEmpty () const noexcept
 
template<bool farthest = false, bool rm_backface = false, bool reverse = false, typename HitInfoType >
void sendRay (const VectorType &origin, const VectorType &direction, HitInfoType &hit_info, float tmin=0, float tmax=std::numeric_limits< float >::max()) const noexcept
 
template<bool farthest = false, bool rm_backface = false, bool reverse = false, typename HitInfoType >
void sendRayRad (const VectorType &origin, const VectorType &direction, HitInfoType &hit_info, float default_radius, float tmin=0, float tmax=std::numeric_limits< float >::max()) const noexcept
 
template<bool rm_backface = false, bool reverse = false, bool sort = true, typename HitInfoType >
void sendRayAll (const VectorType &origin, const VectorType &direction, UT_Array< HitInfoType > &hit_info, UT_Array< exint > *nesting_temp_array=nullptr, float duplicate_tolerance=0, float tmin=0, float tmax=std::numeric_limits< float >::max()) const noexcept
 
template<bool rm_backface = false, bool reverse = false, bool sort = true, typename HitInfoType >
void sendRayAllRad (const VectorType &origin, const VectorType &direction, UT_Array< HitInfoType > &hit_info, float default_radius, UT_Array< exint > *nesting_temp_array=nullptr, float duplicate_tolerance=0, float tmin=0, float tmax=std::numeric_limits< float >::max()) const noexcept
 
template<bool farthest, bool rm_backface, bool reverse, typename FUNCTOR >
void sendRayGeneric (VectorType origin, VectorType direction, FUNCTOR &hit_info, float tmin=0, float tmax=std::numeric_limits< float >::max()) const noexcept
 
void findClosestToLine (VectorType origin, VectorType direction, const exint max_points, const float max_dist_squared, UT::BVHOrderedStack &output_queue) const noexcept
 Finds the closest points to the infinite line containing origin with direction direction. More...
 
void findClosestToSegment (VectorType p0, VectorType p1, const exint max_points, const float max_dist_squared, UT::BVHOrderedStack &output_queue) const noexcept
 Finds the closest points to the line segment with endpoints p0 and p1. More...
 
void findClosestInCone (VectorType origin, VectorType direction, const float angle, const exint max_points, const float max_dist_squared, UT::BVHOrderedStack &output_queue) const noexcept
 
template<bool farthest>
void findClosest (VectorType origin, MinInfo &min_info, float max_dist_squared=std::numeric_limits< float >::max()) const noexcept
 
void getIntersectingBoxes (const SingleBoxType &query_box, UT_Array< exint > &box_indices) const noexcept
 
SYS_FORCE_INLINE exint numPoints () const noexcept
 
SYS_FORCE_INLINE GA_Offset pointOffset (exint item_index) const noexcept
 
template<bool normalize = true>
VectorType getGeometricNormal (const CommonHitInfo &hit_info) const noexcept
 
void getDerivs (const CommonHitInfo &hit_info, VectorType &dP_du, VectorType &dP_dv) const noexcept
 Fills in the values of dP/du and dP/dv for the hit surface. More...
 
template<GA_AttributeOwner owner, typename T , typename DEST_T >
bool getAttribute (const CommonHitInfo &hit_info, const GA_ROHandleT< T > &attrib, const GEO_Detail &detail, DEST_T &value) const noexcept
 
SingleBoxType getBBox () const noexcept
 
template<bool normalize>
BVHBase< NAXES, SUBCLASS >
::VectorType 
getGeometricNormal (const CommonHitInfo &hit_info) const noexcept
 

Protected Member Functions

template<bool farthest, bool rm_backface, bool reverse, typename FUNCTOR >
bool intersectPrim (uint index, const VectorType &origin, const VectorType &direction, const VectorType &inverse_direction, int &max_dir, VectorType &N0, VectorType &N1, float &outer_tmax, float &outer_tmin, FUNCTOR &hit_info) const noexcept
 
template<bool farthest>
void closestPrim (uint index, const VectorType &origin, float &max_dist_squared, exint &hit_index, UT_Vector3 &hit_uvw, VectorType &hit_position, const UT_FixedVector< v4uf, NAXES > &vorigin, UT_Array< exint > *nesting_array, exint nesting_array_base) const noexcept
 
template<bool normalize>
VectorType primGeometricNormal (const CommonHitInfo &hit_info) const noexcept
 
SYS_FORCE_INLINE void primDerivs (const CommonHitInfo &hit_info, VectorType &dP_du, VectorType &dP_dv) const noexcept
 
template<GA_AttributeOwner owner, typename T , typename DEST_T >
SYS_FORCE_INLINE bool primAttribute (const CommonHitInfo &hit_info, const GA_ROHandleT< T > &attrib, const GEO_Detail &detail, DEST_T &value) const noexcept
 
void clearPrimDataAllocations () noexcept
 
void clearSecondary () noexcept
 
- Protected Member Functions inherited from GEO::BVHBase< NAXES, SUBCLASS >
void clear () noexcept
 
SYS_FORCE_INLINE SUBCLASS * subclass () noexcept
 
SYS_FORCE_INLINE const SUBCLASS * subclass () const noexcept
 
template<bool farthest, typename QUERY_POINT >
void findMaximalPointsCommon (const QUERY_POINT &query_point, UT::BVHOrderedStack &stack, UT::BVHOrderedStack &output_queue, exint max_points, float max_dist_squared) const noexcept
 

Static Protected Member Functions

template<bool farthest, bool rm_backface, bool reverse, bool bidirectional = false, typename FUNCTOR >
static SYS_FORCE_INLINE bool intersectQuad (const UT_Vector3 &origin, const UT_Vector3 &inverse_direction, const UT_Vector3 pos[4], const int max_dir, const UT_Vector3 &N0, const UT_Vector3 &N1, const PrimData &prim_data, float &outer_tmin, float &outer_tmax, const uint index, FUNCTOR &hit_info)
 
template<bool farthest, bool rm_backface, bool reverse, bool bidirectional = false, typename FUNCTOR >
static SYS_FORCE_INLINE bool intersectTet (const UT_Vector3 &origin, const UT_Vector3 &inverse_direction, const UT_Vector3 pos[4], const PrimData &prim_data, float &outer_tmin, float &outer_tmax, const uint index, FUNCTOR &hit_info)
 
template<bool farthest>
static SYS_FORCE_INLINE bool triClosestPoint (uint index, const VectorType &origin, const VectorType pos[3], const PrimData &prim_data, const UT_Vector3 &normal, float &max_dist_squared, exint &hit_index, UT_Vector3 &hit_uvw, UT_Vector3 &hit_position)
 
template<bool farthest>
static SYS_FORCE_INLINE bool quadClosestPoint (uint index, const VectorType &origin, const UT_FixedVector< v4uf, 3 > &vorigin, const VectorType pos[4], const PrimData &prim_data, float &max_dist_squared, exint &hit_index, UT_Vector3 &hit_uvw, UT_Vector3 &hit_position)
 
template<typename V3_ARRAY >
static SYS_FORCE_INLINE void addTriangleData (GA_Offset *&tri_points, const V3_ARRAY &positions, const GA_ROHandleT< VectorType > &posattrib, PrimData *primdata, SingleBoxType *prim_box_start, exint &tri_primnum, GA_Offset primoff, int data_int=-1, float data_float=0) noexcept
 
template<typename V3_ARRAY >
static SYS_FORCE_INLINE void addQuadData (GA_Offset *&quad_points, const V3_ARRAY &positions, const GA_ROHandleT< VectorType > &posattrib, PrimData *primdata, SingleBoxType *prim_box_start, exint &quad_primnum, GA_Offset primoff, int data_int=-1, float data_float=0) noexcept
 
static SYS_FORCE_INLINE void addRayPrimInfo (PrimData &primdata, GA_Offset primoff, SingleBoxType &primbox, GU_RayPrimInfo *rayprim, exint &other_primnum, const GEO_Detail &detail, float w=0) noexcept
 

Friends

class ::GU_RayHeightFieldInfo
 

Additional Inherited Members

- Public Types inherited from GEO::BVHBase< NAXES, SUBCLASS >
using VectorType = typename SYS_SelectType< UT_Vector2, UT_Vector3, NAXES==3 >::type
 
using UintVectorType = typename SYS_SelectType< UT_FixedVector< uint, 2 >, UT_FixedVector< uint, 3 >, NAXES==3 >::type
 
using SingleBoxType = UT::Box< float, NAXES >
 
using BoxType = UT::Box< v4uf, NAXES >
 
using PosAttribType = GA_ROHandleT< VectorType >
 
using RadAttribType = GA_ROHandleF
 
- Static Public Member Functions inherited from GEO::BVHBase< NAXES, SUBCLASS >
static void pointUVWToPolar (VectorType &uvw) noexcept
 
- Protected Types inherited from GEO::BVHBase< NAXES, SUBCLASS >
using NodeData = BoxType
 
- Protected Attributes inherited from GEO::BVHBase< NAXES, SUBCLASS >
UT_BVH< BVH_NmyTree
 
UT_UniquePtr< BoxType[]> myNodeBoxes
 
UT_UniquePtr< UT_FixedVector
< int32, BVH_N >[]> 
myNodeNItems
 
UT_Array< VectorTypemyPositions
 Positions for points. More...
 
UT_Array< float > myRadii
 Radii for disconnected points. More...
 
PosAttribType myPosAttrib
 
RadAttribType myRadAttrib
 
GA_OffsetList myPoints
 Disconnected points. More...
 
bool myHasCurvesOrPoints
 
GA_DataId myPositionsDataId
 
GA_DataId myRadiiDataId
 
- Static Protected Attributes inherited from GEO::BVHBase< NAXES, SUBCLASS >
static constexpr uint BVH_N = 4
 

Detailed Description

Definition at line 33 of file GU_BVH.h.

Constructor & Destructor Documentation

SYS_FORCE_INLINE GU::BVH::BVH ( )
inlinenoexcept

Definition at line 241 of file GU_BVH.h.

SYS_FORCE_INLINE GU::BVH::~BVH ( )
inlinenoexcept

Definition at line 256 of file GU_BVH.h.

Member Function Documentation

template<typename V3_ARRAY >
static SYS_FORCE_INLINE void GU::BVH::addQuadData ( GA_Offset *&  quad_points,
const V3_ARRAY &  positions,
const GA_ROHandleT< VectorType > &  posattrib,
PrimData *  primdata,
SingleBoxType prim_box_start,
exint quad_primnum,
GA_Offset  primoff,
int  data_int = -1,
float  data_float = 0 
)
staticprotectednoexcept
static SYS_FORCE_INLINE void GU::BVH::addRayPrimInfo ( PrimData &  primdata,
GA_Offset  primoff,
SingleBoxType primbox,
GU_RayPrimInfo rayprim,
exint other_primnum,
const GEO_Detail detail,
float  w = 0 
)
staticprotectednoexcept
template<typename V3_ARRAY >
static SYS_FORCE_INLINE void GU::BVH::addTriangleData ( GA_Offset *&  tri_points,
const V3_ARRAY &  positions,
const GA_ROHandleT< VectorType > &  posattrib,
PrimData *  primdata,
SingleBoxType prim_box_start,
exint tri_primnum,
GA_Offset  primoff,
int  data_int = -1,
float  data_float = 0 
)
staticprotectednoexcept
void GU::BVH::clear ( )
noexcept
void GU::BVH::clearPrimDataAllocations ( )
protectednoexcept

These are just used in the init function to change the decision about clearing after some things have been initialized.

void GU::BVH::clearSecondary ( )
protectednoexcept

These are just used in the init function to change the decision about clearing after some things have been initialized.

template<bool farthest>
void GU::BVH::closestPrim ( uint  index,
const VectorType origin,
float &  max_dist_squared,
exint hit_index,
UT_Vector3 hit_uvw,
VectorType hit_position,
const UT_FixedVector< v4uf, NAXES > &  vorigin,
UT_Array< exint > *  nesting_array,
exint  nesting_array_base 
) const
protectednoexcept
UT_Vector3 GU::BVH::findNGonUVW ( exint  index,
const UT_Vector3 position,
const GEO_Detail detail 
) const
noexcept

The UVWs returned for n-gons are for the sub-polygons, so we need to compute the true UVWs from the positions.

void GU::BVH::init ( const GEO_Detail detail,
const GA_ROHandleT< VectorType > &  P,
const Options options,
const GA_ROHandleF pscale,
const float  radscale = 1.0f,
const bool  force_rebalance = false,
SecondaryTreeMap secondary_trees = nullptr,
SecondaryDetailMap secondary_details = nullptr,
UT_Lock secondary_lock = nullptr 
)
noexcept

NOTE: If options is different from what it was before, you must set force_rebalance to true. NOTE: With this signature, radscale scales the pscale attribute if it's a valid attribute, else it's the point radius.

void GU::BVH::init ( const GEO_Detail detail,
const GA_ROHandleT< VectorType > &  P,
const Options options,
const float  radius = 0.0f,
const bool  force_rebalance = false 
)
inlinenoexcept

NOTE: With this signature, radius is the point radius.

Definition at line 318 of file GU_BVH.h.

template<bool farthest, bool rm_backface, bool reverse, typename FUNCTOR >
bool GU::BVH::intersectPrim ( uint  index,
const VectorType origin,
const VectorType direction,
const VectorType inverse_direction,
int max_dir,
VectorType N0,
VectorType N1,
float &  outer_tmax,
float &  outer_tmin,
FUNCTOR &  hit_info 
) const
protectednoexcept
template<bool farthest, bool rm_backface, bool reverse, bool bidirectional = false, typename FUNCTOR >
static SYS_FORCE_INLINE bool GU::BVH::intersectQuad ( const UT_Vector3 origin,
const UT_Vector3 inverse_direction,
const UT_Vector3  pos[4],
const int  max_dir,
const UT_Vector3 N0,
const UT_Vector3 N1,
const PrimData &  prim_data,
float &  outer_tmin,
float &  outer_tmax,
const uint  index,
FUNCTOR &  hit_info 
)
staticprotected
template<bool farthest, bool rm_backface, bool reverse, bool bidirectional = false, typename FUNCTOR >
static SYS_FORCE_INLINE bool GU::BVH::intersectTet ( const UT_Vector3 origin,
const UT_Vector3 inverse_direction,
const UT_Vector3  pos[4],
const PrimData &  prim_data,
float &  outer_tmin,
float &  outer_tmax,
const uint  index,
FUNCTOR &  hit_info 
)
staticprotected
SYS_FORCE_INLINE bool GU::BVH::isNGon ( exint  index) const
inlinenoexcept

Definition at line 328 of file GU_BVH.h.

SYS_FORCE_INLINE bool GU::BVH::isPacked ( exint  index) const
inlinenoexcept

Definition at line 342 of file GU_BVH.h.

SYS_FORCE_INLINE GA_Size GU::BVH::numItems ( ) const
inlinenoexcept

Definition at line 268 of file GU_BVH.h.

template<GA_AttributeOwner owner, typename T , typename DEST_T >
SYS_FORCE_INLINE bool GU::BVH::primAttribute ( const CommonHitInfo hit_info,
const GA_ROHandleT< T > &  attrib,
const GEO_Detail detail,
DEST_T &  value 
) const
protectednoexcept
SYS_FORCE_INLINE void GU::BVH::primDerivs ( const CommonHitInfo hit_info,
VectorType dP_du,
VectorType dP_dv 
) const
protectednoexcept
template<bool normalize>
VectorType GU::BVH::primGeometricNormal ( const CommonHitInfo hit_info) const
protectednoexcept
SYS_FORCE_INLINE GA_Offset GU::BVH::primitiveOffset ( exint  prim_index) const
inlinenoexcept

Definition at line 261 of file GU_BVH.h.

GA_DataId GU::BVH::primlistId ( ) const
inline

Definition at line 274 of file GU_BVH.h.

template<bool farthest>
static SYS_FORCE_INLINE bool GU::BVH::quadClosestPoint ( uint  index,
const VectorType origin,
const UT_FixedVector< v4uf, 3 > &  vorigin,
const VectorType  pos[4],
const PrimData &  prim_data,
float &  max_dist_squared,
exint hit_index,
UT_Vector3 hit_uvw,
UT_Vector3 hit_position 
)
staticprotected
GA_DataId GU::BVH::topologyId ( ) const
inline

Definition at line 273 of file GU_BVH.h.

template<bool farthest>
static SYS_FORCE_INLINE bool GU::BVH::triClosestPoint ( uint  index,
const VectorType origin,
const VectorType  pos[3],
const PrimData &  prim_data,
const UT_Vector3 normal,
float &  max_dist_squared,
exint hit_index,
UT_Vector3 hit_uvw,
UT_Vector3 hit_position 
)
staticprotected

Friends And Related Function Documentation

friend class ::GU_RayHeightFieldInfo
friend

Definition at line 465 of file GU_BVH.h.


The documentation for this class was generated from the following file: