HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO::PointBVHT< NAXES > Class Template Reference

#include <GEO_BVH.h>

+ Inheritance diagram for GEO::PointBVHT< NAXES >:

Public Types

using Parent = BVHBase< NAXES, PointBVHT< NAXES >>
 
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 >
 
- Public Types inherited from GEO::BVHBase< NAXES, PointBVHT< NAXES > >
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
 

Public Member Functions

SYS_FORCE_INLINE PointBVHT () noexcept
 
SYS_FORCE_INLINE ~PointBVHT () noexcept
 
SYS_FORCE_INLINE void init (const GA_Detail &detail, const GA_ROHandleT< VectorType > &P, const float radius=0.0f, const GA_Range *point_range=nullptr, const bool force_rebalance=false) noexcept
 NOTE: With this signature, radius is the point radius. More...
 
SYS_FORCE_INLINE void init (const GA_Detail &detail, const GA_ROHandleF &P, const float radius=0.0f, const GA_Range *point_range=nullptr, const bool force_rebalance=false) noexcept
 
SYS_FORCE_INLINE void init (const GA_Detail &detail, const GA_ROHandleT< VectorType > &P, const GA_ROHandleF &pscale, const float radscale=1.0f, const GA_Range *point_range=nullptr, const bool force_rebalance=false) noexcept
 
SYS_FORCE_INLINE void init (const GA_Detail &detail, const GA_ROHandleF &P, const GA_ROHandleF &pscale, const float radscale=1.0f, const GA_Range *point_range=nullptr, const bool force_rebalance=false) noexcept
 
SYS_FORCE_INLINE void init (const exint n, const VectorType *P, const float radius=0.0f, const bool rebalance=true) noexcept
 NOTE: With this signature, radius is the point radius. More...
 
GEO_API void init (const exint n, const VectorType *P, const float *pscale, const float radscale=1.0f, const bool rebalance=true) noexcept
 
SYS_FORCE_INLINE void findClosestPoints (const VectorType &query_pt, UT::BVHOrderedStack &stack, UT::BVHOrderedStack &output_queue, exint max_points=std::numeric_limits< uint >::max(), float max_distance_squared=std::numeric_limits< float >::max()) const noexcept
 
SYS_FORCE_INLINE void findFarthestPoints (const VectorType &query_pt, UT::BVHOrderedStack &stack, UT::BVHOrderedStack &output_queue, exint max_points=std::numeric_limits< uint >::max(), float min_distance_squared=0.0f) const noexcept
 
template<bool farthest>
GEO_API void sortResults (UT::BVHOrderedStack &closepts) const noexcept
 
template<bool farthest>
GEO_API void findMaximalPoints (const VectorType &query_pt, UT::BVHOrderedStack &stack, UT::BVHOrderedStack &output_queue, exint max_points, float max_distance_squared) const noexcept
 
GEO_API const exintgetPointsArray () const noexcept
 
- Public Member Functions inherited from GEO::BVHBase< NAXES, PointBVHT< NAXES > >
 BVHBase () noexcept
 
 ~BVHBase () noexcept
 
SYS_FORCE_INLINE bool isEmpty () const noexcept
 
void sendRay (const VectorType &origin, const VectorType &direction, HitInfoType &hit_info, float tmin=0, float tmax=std::numeric_limits< float >::max()) const noexcept
 
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
 
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
 
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
 
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
 
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
 
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...
 
bool getAttribute (const CommonHitInfo &hit_info, const GA_ROHandleT< T > &attrib, const GEO_Detail &detail, DEST_T &value) const noexcept
 
SingleBoxType getBBox () const noexcept
 

Protected Member Functions

GEO_API void fillPositionArray (const GA_ROHandleT< VectorType > &P, const GA_Range *point_range, const bool topology_changed, const GA_Size npoints) noexcept
 
GEO_API void fillPositionArray (const GA_ROHandleF &P, const GA_Range *point_range, const bool topology_changed, const GA_Size npoints) noexcept
 
template<typename T >
GEO_API void initAttribCommon (const GA_Detail &detail, const GA_ROHandleT< T > &P, const GA_ROHandleF &pscale, const float radscale, const GA_Range *point_range, const bool force_rebalance) noexcept
 This is instantiated for VectorType and float. More...
 
GEO_API void initCommon (bool topology_changed, const VectorType *orig_order_positions, const float *orig_order_radii) noexcept
 
template<bool farthest, bool rm_backface, bool reverse, typename FUNCTOR >
SYS_FORCE_INLINE 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>
SYS_FORCE_INLINE 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>
SYS_FORCE_INLINE 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
 
- Protected Member Functions inherited from GEO::BVHBase< NAXES, PointBVHT< NAXES > >
void clear () noexcept
 
SYS_FORCE_INLINE PointBVHT
< NAXES > * 
subclass () noexcept
 
SYS_FORCE_INLINE const
PointBVHT< NAXES > * 
subclass () const noexcept
 
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 Attributes

static constexpr bool theHasPrimitives = false
 
static constexpr bool theReordersPositions = true
 
- Static Protected Attributes inherited from GEO::BVHBase< NAXES, PointBVHT< NAXES > >
static constexpr uint BVH_N
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::BVHBase< NAXES, PointBVHT< NAXES > >
static void pointUVWToPolar (VectorType &uvw) noexcept
 
- Protected Types inherited from GEO::BVHBase< NAXES, PointBVHT< NAXES > >
using NodeData = BoxType
 
- Protected Attributes inherited from GEO::BVHBase< NAXES, PointBVHT< NAXES > >
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
 

Detailed Description

template<uint NAXES>
class GEO::PointBVHT< NAXES >

Definition at line 360 of file GEO_BVH.h.

Member Typedef Documentation

template<uint NAXES>
using GEO::BVHBase< NAXES, SUBCLASS >::BoxType = UT::Box<v4uf,NAXES>

Definition at line 45 of file GEO_BVH.h.

template<uint NAXES>
using GEO::PointBVHT< NAXES >::Parent = BVHBase<NAXES,PointBVHT<NAXES>>

Definition at line 363 of file GEO_BVH.h.

template<uint NAXES>
using GEO::BVHBase< NAXES, SUBCLASS >::SingleBoxType = UT::Box<float,NAXES>

Definition at line 41 of file GEO_BVH.h.

template<uint NAXES>
using GEO::BVHBase< NAXES, SUBCLASS >::UintVectorType = typename SYS_SelectType<UT_FixedVector<uint,2>,UT_FixedVector<uint,3>,NAXES==3>::type

Definition at line 40 of file GEO_BVH.h.

template<uint NAXES>
using GEO::BVHBase< NAXES, SUBCLASS >::VectorType = typename SYS_SelectType<UT_Vector2,UT_Vector3,NAXES==3>::type

Definition at line 39 of file GEO_BVH.h.

Constructor & Destructor Documentation

template<uint NAXES>
SYS_FORCE_INLINE GEO::PointBVHT< NAXES >::PointBVHT ( )
inlinenoexcept

Definition at line 369 of file GEO_BVH.h.

template<uint NAXES>
SYS_FORCE_INLINE GEO::PointBVHT< NAXES >::~PointBVHT ( )
inlinenoexcept

Definition at line 370 of file GEO_BVH.h.

Member Function Documentation

template<uint NAXES>
template<bool farthest>
SYS_FORCE_INLINE void GEO::PointBVHT< NAXES >::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
inlineprotectednoexcept

Definition at line 571 of file GEO_BVH.h.

template<uint NAXES>
GEO_API void GEO::PointBVHT< NAXES >::fillPositionArray ( const GA_ROHandleT< VectorType > &  P,
const GA_Range point_range,
const bool  topology_changed,
const GA_Size  npoints 
)
protectednoexcept
template<uint NAXES>
GEO_API void GEO::PointBVHT< NAXES >::fillPositionArray ( const GA_ROHandleF P,
const GA_Range point_range,
const bool  topology_changed,
const GA_Size  npoints 
)
protectednoexcept
template<uint NAXES>
SYS_FORCE_INLINE void GEO::PointBVHT< NAXES >::findClosestPoints ( const VectorType query_pt,
UT::BVHOrderedStack stack,
UT::BVHOrderedStack output_queue,
exint  max_points = std::numeric_limits<uint>::max(),
float  max_distance_squared = std::numeric_limits<float>::max() 
) const
inlinenoexcept

Finds the closest points (up to max_points of them) within sqrt(max_distance_squared) of query_pt

Definition at line 474 of file GEO_BVH.h.

template<uint NAXES>
SYS_FORCE_INLINE void GEO::PointBVHT< NAXES >::findFarthestPoints ( const VectorType query_pt,
UT::BVHOrderedStack stack,
UT::BVHOrderedStack output_queue,
exint  max_points = std::numeric_limits<uint>::max(),
float  min_distance_squared = 0.0f 
) const
inlinenoexcept

Finds the farthest points (up to max_points of them) at least sqrt(min_distance_squared) away from query_pt

Definition at line 488 of file GEO_BVH.h.

template<uint NAXES>
template<bool farthest>
GEO_API void GEO::PointBVHT< NAXES >::findMaximalPoints ( const VectorType query_pt,
UT::BVHOrderedStack stack,
UT::BVHOrderedStack output_queue,
exint  max_points,
float  max_distance_squared 
) const
noexcept
template<uint NAXES>
GEO_API const exint* GEO::PointBVHT< NAXES >::getPointsArray ( ) const
noexcept

Don't call this unless you really need to. It might have to change in the future. The array is owned by myPoints.

template<uint NAXES>
SYS_FORCE_INLINE void GEO::PointBVHT< NAXES >::init ( const GA_Detail detail,
const GA_ROHandleT< VectorType > &  P,
const float  radius = 0.0f,
const GA_Range point_range = nullptr,
const bool  force_rebalance = false 
)
inlinenoexcept

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

Definition at line 374 of file GEO_BVH.h.

template<uint NAXES>
SYS_FORCE_INLINE void GEO::PointBVHT< NAXES >::init ( const GA_Detail detail,
const GA_ROHandleF P,
const float  radius = 0.0f,
const GA_Range point_range = nullptr,
const bool  force_rebalance = false 
)
inlinenoexcept

NOTE: With this signature, P can have a tuple size other than 3, though if tuple size is more than 3, only the first 3 components will be used, and if tuple size is less than 3, the remaining components will be treated as having value 0.0. NOTE: With this signature, radius is the point radius.

Definition at line 389 of file GEO_BVH.h.

template<uint NAXES>
SYS_FORCE_INLINE void GEO::PointBVHT< NAXES >::init ( const GA_Detail detail,
const GA_ROHandleT< VectorType > &  P,
const GA_ROHandleF pscale,
const float  radscale = 1.0f,
const GA_Range point_range = nullptr,
const bool  force_rebalance = false 
)
inlinenoexcept

NOTE: With this signature, radscale scales the pscale attribute if it's a valid attribute, else it's the point radius.

Definition at line 401 of file GEO_BVH.h.

template<uint NAXES>
SYS_FORCE_INLINE void GEO::PointBVHT< NAXES >::init ( const GA_Detail detail,
const GA_ROHandleF P,
const GA_ROHandleF pscale,
const float  radscale = 1.0f,
const GA_Range point_range = nullptr,
const bool  force_rebalance = false 
)
inlinenoexcept

NOTE: With this signature, P can have a tuple size other than 3, though if tuple size is more than 3, only the first 3 components will be used, and if tuple size is less than 3, the remaining components will be treated as having value 0.0. NOTE: With this signature, radscale scales the pscale attribute if it's a valid attribute, else it's the point radius.

Definition at line 418 of file GEO_BVH.h.

template<uint NAXES>
SYS_FORCE_INLINE void GEO::PointBVHT< NAXES >::init ( const exint  n,
const VectorType P,
const float  radius = 0.0f,
const bool  rebalance = true 
)
inlinenoexcept

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

Definition at line 434 of file GEO_BVH.h.

template<uint NAXES>
GEO_API void GEO::PointBVHT< NAXES >::init ( const exint  n,
const VectorType P,
const float *  pscale,
const float  radscale = 1.0f,
const bool  rebalance = true 
)
noexcept

NOTE: With this signature, radscale scales the pscale values if it's non-null, else it's the point radius.

template<uint NAXES>
template<typename T >
GEO_API void GEO::PointBVHT< NAXES >::initAttribCommon ( const GA_Detail detail,
const GA_ROHandleT< T > &  P,
const GA_ROHandleF pscale,
const float  radscale,
const GA_Range point_range,
const bool  force_rebalance 
)
protectednoexcept

This is instantiated for VectorType and float.

template<uint NAXES>
GEO_API void GEO::PointBVHT< NAXES >::initCommon ( bool  topology_changed,
const VectorType orig_order_positions,
const float *  orig_order_radii 
)
protectednoexcept
template<uint NAXES>
template<bool farthest, bool rm_backface, bool reverse, typename FUNCTOR >
SYS_FORCE_INLINE bool GEO::PointBVHT< NAXES >::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
inlineprotectednoexcept

Definition at line 561 of file GEO_BVH.h.

template<uint NAXES>
template<GA_AttributeOwner owner, typename T , typename DEST_T >
SYS_FORCE_INLINE bool GEO::PointBVHT< NAXES >::primAttribute ( const CommonHitInfo &  hit_info,
const GA_ROHandleT< T > &  attrib,
const GEO_Detail detail,
DEST_T &  value 
) const
inlineprotectednoexcept

Definition at line 591 of file GEO_BVH.h.

template<uint NAXES>
SYS_FORCE_INLINE void GEO::PointBVHT< NAXES >::primDerivs ( const CommonHitInfo &  hit_info,
VectorType dP_du,
VectorType dP_dv 
) const
inlineprotectednoexcept

Definition at line 586 of file GEO_BVH.h.

template<uint NAXES>
template<bool normalize>
SYS_FORCE_INLINE VectorType GEO::PointBVHT< NAXES >::primGeometricNormal ( const CommonHitInfo &  hit_info) const
inlineprotectednoexcept

Definition at line 581 of file GEO_BVH.h.

template<uint NAXES>
template<bool farthest>
GEO_API void GEO::PointBVHT< NAXES >::sortResults ( UT::BVHOrderedStack closepts) const
noexcept

Sorts results from findClosestPoints or findFarthestPoints by distance squared, and, in the case of ties, by the point offsets. If farthest is true, it puts farther distances first, and breaks ties with larger offsets first.

Member Data Documentation

template<uint NAXES>
constexpr bool GEO::PointBVHT< NAXES >::theHasPrimitives = false
staticprotected

Definition at line 519 of file GEO_BVH.h.

template<uint NAXES>
constexpr bool GEO::PointBVHT< NAXES >::theReordersPositions = true
staticprotected

Definition at line 520 of file GEO_BVH.h.


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