
Caches bounds by recursively computing and aggregating bounds of children in world space and aggregating the result back into local space. More...
Public Member Functions  
USDGEOM_API  UsdGeomBBoxCache (UsdTimeCode time, TfTokenVector includedPurposes, bool useExtentsHint=false, bool ignoreVisibility=false) 
Construct a new BBoxCache for a specific time and set of includedPurposes . More...  
USDGEOM_API  UsdGeomBBoxCache (UsdGeomBBoxCache const &other) 
Copy constructor. More...  
USDGEOM_API UsdGeomBBoxCache &  operator= (UsdGeomBBoxCache const &other) 
Copy assignment. More...  
USDGEOM_API GfBBox3d  ComputeWorldBound (const UsdPrim &prim) 
Compute the bound of the given prim in world space, leveraging any preexisting, cached bounds. More...  
USDGEOM_API GfBBox3d  ComputeWorldBoundWithOverrides (const UsdPrim &prim, const SdfPathSet &pathsToSkip, const GfMatrix4d &primOverride, const TfHashMap< SdfPath, GfMatrix4d, SdfPath::Hash > &ctmOverrides) 
Computes the bound of the prim's descendents in world space while excluding the subtrees rooted at the paths in pathsToSkip . More...  
USDGEOM_API GfBBox3d  ComputeRelativeBound (const UsdPrim &prim, const UsdPrim &relativeToAncestorPrim) 
Compute the bound of the given prim in the space of an ancestor prim, relativeToAncestorPrim , leveraging any preexisting cached bounds. More...  
USDGEOM_API GfBBox3d  ComputeLocalBound (const UsdPrim &prim) 
Computes the oriented bounding box of the given prim, leveraging any preexisting, cached bounds. More...  
USDGEOM_API GfBBox3d  ComputeUntransformedBound (const UsdPrim &prim) 
Computes the bound of the prim's children leveraging any preexisting, cached bounds, but does not include the transform (if any) authored on the prim itself. More...  
USDGEOM_API GfBBox3d  ComputeUntransformedBound (const UsdPrim &prim, const SdfPathSet &pathsToSkip, const TfHashMap< SdfPath, GfMatrix4d, SdfPath::Hash > &ctmOverrides) 
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the bound of the prim's descendents while excluding the subtrees rooted at the paths in pathsToSkip . More...  
USDGEOM_API bool  ComputePointInstanceWorldBounds (const UsdGeomPointInstancer &instancer, int64_t const *instanceIdBegin, size_t numIds, GfBBox3d *result) 
Compute the bound of the given point instances in world space. More...  
GfBBox3d  ComputePointInstanceWorldBound (const UsdGeomPointInstancer &instancer, int64_t instanceId) 
Compute the bound of the given point instance in world space. More...  
USDGEOM_API bool  ComputePointInstanceRelativeBounds (const UsdGeomPointInstancer &instancer, int64_t const *instanceIdBegin, size_t numIds, const UsdPrim &relativeToAncestorPrim, GfBBox3d *result) 
Compute the bounds of the given point instances in the space of an ancestor prim relativeToAncestorPrim . More...  
GfBBox3d  ComputePointInstanceRelativeBound (const UsdGeomPointInstancer &instancer, int64_t instanceId, const UsdPrim &relativeToAncestorPrim) 
Compute the bound of the given point instance in the space of an ancestor prim relativeToAncestorPrim . More...  
USDGEOM_API bool  ComputePointInstanceLocalBounds (const UsdGeomPointInstancer &instancer, int64_t const *instanceIdBegin, size_t numIds, GfBBox3d *result) 
Compute the oriented bounding boxes of the given point instances. More...  
GfBBox3d  ComputePointInstanceLocalBound (const UsdGeomPointInstancer &instancer, int64_t instanceId) 
Compute the oriented bounding boxes of the given point instances. More...  
USDGEOM_API bool  ComputePointInstanceUntransformedBounds (const UsdGeomPointInstancer &instancer, int64_t const *instanceIdBegin, size_t numIds, GfBBox3d *result) 
Computes the bound of the given point instances, but does not include the transform (if any) authored on the instancer itself. More...  
GfBBox3d  ComputePointInstanceUntransformedBound (const UsdGeomPointInstancer &instancer, int64_t instanceId) 
Computes the bound of the given point instances, but does not include the instancer's transform. More...  
USDGEOM_API void  Clear () 
Clears all precached values. More...  
USDGEOM_API void  SetIncludedPurposes (const TfTokenVector &includedPurposes) 
Indicate the set of includedPurposes to use when resolving child bounds. More...  
const TfTokenVector &  GetIncludedPurposes () 
Get the current set of included purposes. More...  
bool  GetUseExtentsHint () const 
Returns whether authored extent hints are used to compute bounding boxes. More...  
bool  GetIgnoreVisibility () const 
Returns whether prim visibility should be ignored when computing bounding boxes. More...  
USDGEOM_API void  SetTime (UsdTimeCode time) 
Use the new time when computing values and may clear any existing values cached for the previous time. More...  
UsdTimeCode  GetTime () const 
Get the current time from which this cache is reading values. More...  
void  SetBaseTime (UsdTimeCode baseTime) 
Set the base time value for this bbox cache. More...  
UsdTimeCode  GetBaseTime () const 
Return the base time if set, otherwise GetTime(). More...  
void  ClearBaseTime () 
Clear this cache's baseTime if one has been set. More...  
bool  HasBaseTime () const 
Return true if this cache has a baseTime that's been explicitly set, false otherwise. More...  
Friends  
size_t  hash_value (const _PrimContext &key) 
Caches bounds by recursively computing and aggregating bounds of children in world space and aggregating the result back into local space.
The cache is configured for a specific time and UsdGeomImageable::GetPurposeAttr() set of purposes. When querying a bound, transforms and extents are read either from the time specified or UsdTimeCode::Default(), following TimeSamples, Defaults, and Value Resolution standard timesample value resolution. As noted in SetIncludedPurposes(), changing the included purposes does not invalidate the cache, because we cache purpose along with the geometric data.
Child prims that are invisible at the requested time are excluded when computing a prim's bounds. However, if a bound is requested directly for an excluded prim, it will be computed. Additionally, only prims deriving from UsdGeomImageable are included in child bounds computations.
Unlike standard UsdStage traversals, the traversal performed by the UsdGeomBBoxCache includes prims that are unloaded (see UsdPrim::IsLoaded()). This makes it possible to fetch bounds for a UsdStage that has been opened without forcePopulate , provided the unloaded model prims have authored extent hints (see UsdGeomModelAPI::GetExtentsHint()).
This class is optimized for computing tight untransformed "object" space bounds for componentmodels. In the absence of component models, bounds are optimized for worldspace, since there is no other easily identifiable space for which to optimize, and we cannot optimize for every prim's local space without performing quadratic work.
The TfDebug flag, USDGEOM_BBOX, is provided for debugging.
Warnings:
Definition at line 87 of file bboxCache.h.
USDGEOM_API UsdGeomBBoxCache  (  UsdTimeCode  time, 
TfTokenVector  includedPurposes,  
bool  useExtentsHint = false , 

bool  ignoreVisibility = false 

) 
Construct a new BBoxCache for a specific time
and set of includedPurposes
.
Only prims with a purpose that matches the includedPurposes
will be considered when accumulating child bounds. See UsdGeomImageable for allowed purpose values.
If useExtentsHint
is true, then when computing the bounds for any modelroot prim, if the prim is visible at time
, we will fetch its extents hint (via UsdGeomModelAPI::GetExtentsHint()). If it is authored, we use it to compute the bounding box for the selected combination of includedPurposes by combining bounding box hints that have been cached for various values of purposes.
If ignoreVisibility
is true invisible prims will be included during bounds computations.
USDGEOM_API UsdGeomBBoxCache  (  UsdGeomBBoxCache const &  other  ) 
Copy constructor.
USDGEOM_API void Clear  (  ) 
Clears all precached values.

inline 
Clear this cache's baseTime if one has been set.
After calling this, the cache will use its time as the baseTime value.
Definition at line 378 of file bboxCache.h.
Computes the oriented bounding box of the given prim, leveraging any preexisting, cached bounds.
The computed bound includes the transform authored on the prim itself, but does not include any ancestor transforms (it does not include the localtoworld transform).
See ComputeWorldBound() for notes on performance and error handling.

inline 
Compute the oriented bounding boxes of the given point instances.
Definition at line 280 of file bboxCache.h.
USDGEOM_API bool ComputePointInstanceLocalBounds  (  const UsdGeomPointInstancer &  instancer, 
int64_t const *  instanceIdBegin,  
size_t  numIds,  
GfBBox3d *  result  
) 
Compute the oriented bounding boxes of the given point instances.
The computed bounds include the transform authored on the instancer itself, but does not include any ancestor transforms (it does not include the localtoworld transform).
The result
pointer must point to numIds
GfBBox3d instances to be filled.

inline 
Compute the bound of the given point instance in the space of an ancestor prim relativeToAncestorPrim
.
Definition at line 252 of file bboxCache.h.
USDGEOM_API bool ComputePointInstanceRelativeBounds  (  const UsdGeomPointInstancer &  instancer, 
int64_t const *  instanceIdBegin,  
size_t  numIds,  
const UsdPrim &  relativeToAncestorPrim,  
GfBBox3d *  result  
) 
Compute the bounds of the given point instances in the space of an ancestor prim relativeToAncestorPrim
.
Write the results to result
.
The computed bound excludes the local transform at relativeToAncestorPrim
. The computed bound may be incorrect if relativeToAncestorPrim
is not an ancestor of prim
.
The result
pointer must point to numIds
GfBBox3d instances to be filled.

inline 
Computes the bound of the given point instances, but does not include the instancer's transform.
Definition at line 310 of file bboxCache.h.
USDGEOM_API bool ComputePointInstanceUntransformedBounds  (  const UsdGeomPointInstancer &  instancer, 
int64_t const *  instanceIdBegin,  
size_t  numIds,  
GfBBox3d *  result  
) 
Computes the bound of the given point instances, but does not include the transform (if any) authored on the instancer itself.
IMPORTANT: while the BBox does not contain the local transformation, in general it may still contain a nonidentity transformation matrix to put the bounds in the correct space. Therefore, to obtain the correct axisaligned bounding box, the client must call ComputeAlignedRange().
The result
pointer must point to numIds
GfBBox3d instances to be filled.

inline 
Compute the bound of the given point instance in world space.
Definition at line 223 of file bboxCache.h.
USDGEOM_API bool ComputePointInstanceWorldBounds  (  const UsdGeomPointInstancer &  instancer, 
int64_t const *  instanceIdBegin,  
size_t  numIds,  
GfBBox3d *  result  
) 
Compute the bound of the given point instances in world space.
The bounds of each instance is computed and then transformed to world space. The result
pointer must point to numIds
GfBBox3d instances to be filled.
USDGEOM_API GfBBox3d ComputeRelativeBound  (  const UsdPrim &  prim, 
const UsdPrim &  relativeToAncestorPrim  
) 
Compute the bound of the given prim in the space of an ancestor prim, relativeToAncestorPrim
, leveraging any preexisting cached bounds.
The computed bound excludes the local transform at relativeToAncestorPrim
. The computed bound may be incorrect if relativeToAncestorPrim
is not an ancestor of prim
.
Computes the bound of the prim's children leveraging any preexisting, cached bounds, but does not include the transform (if any) authored on the prim itself.
IMPORTANT: while the BBox does not contain the local transformation, in general it may still contain a nonidentity transformation matrix to put the bounds in the correct space. Therefore, to obtain the correct axisaligned bounding box, the client must call ComputeAlignedRange().
See ComputeWorldBound() for notes on performance and error handling.
USDGEOM_API GfBBox3d ComputeUntransformedBound  (  const UsdPrim &  prim, 
const SdfPathSet &  pathsToSkip,  
const TfHashMap< SdfPath, GfMatrix4d, SdfPath::Hash > &  ctmOverrides  
) 
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the bound of the prim's descendents while excluding the subtrees rooted at the paths in pathsToSkip
.
Additionally, the parameter ctmOverrides
is used to specify overrides to the CTM values of certain paths underneath the prim. The CTM values in the ctmOverrides
map are in the space of the given prim, prim
.
This leverages any preexisting, cached bounds, but does not include the transform (if any) authored on the prim itself.
IMPORTANT: while the BBox does not contain the local transformation, in general it may still contain a nonidentity transformation matrix to put the bounds in the correct space. Therefore, to obtain the correct axisaligned bounding box, the client must call ComputeAlignedRange().
See ComputeWorldBound() for notes on performance and error handling.
Compute the bound of the given prim in world space, leveraging any preexisting, cached bounds.
The bound of the prim is computed, including the transform (if any) authored on the node itself, and then transformed to world space.
Error handling note: No checking of prim
validity is performed. If prim
is invalid, this method will abort the program; therefore it is the client's responsibility to ensure prim
is valid.
USDGEOM_API GfBBox3d ComputeWorldBoundWithOverrides  (  const UsdPrim &  prim, 
const SdfPathSet &  pathsToSkip,  
const GfMatrix4d &  primOverride,  
const TfHashMap< SdfPath, GfMatrix4d, SdfPath::Hash > &  ctmOverrides  
) 
Computes the bound of the prim's descendents in world space while excluding the subtrees rooted at the paths in pathsToSkip
.
Additionally, the parameter primOverride
overrides the localtoworld transform of the prim and ctmOverrides
is used to specify overrides the localtoworld transforms of certain paths underneath the prim.
This leverages any preexisting, cached bounds, but does not include the transform (if any) authored on the prim itself.
See ComputeWorldBound() for notes on performance and error handling.

inline 
Return the base time if set, otherwise GetTime().
Use HasBaseTime() to observe if a base time has been set.
Definition at line 372 of file bboxCache.h.

inline 
Returns whether prim visibility should be ignored when computing bounding boxes.
Definition at line 345 of file bboxCache.h.

inline 
Get the current set of included purposes.
Definition at line 335 of file bboxCache.h.

inline 
Get the current time from which this cache is reading values.
Definition at line 356 of file bboxCache.h.

inline 
Returns whether authored extent hints are used to compute bounding boxes.
Definition at line 339 of file bboxCache.h.

inline 
Return true if this cache has a baseTime that's been explicitly set, false otherwise.
Definition at line 384 of file bboxCache.h.
USDGEOM_API UsdGeomBBoxCache& operator=  (  UsdGeomBBoxCache const &  other  ) 
Copy assignment.

inline 
Set the base time value for this bbox cache.
This value is used only when computing bboxes for point instancer instances (see ComputePointInstanceWorldBounds(), for example). See UsdGeomPointInstancer::ComputeExtentAtTime() for more information. If unset, the bbox cache uses its time (GetTime() / SetTime()) for this value.
Note that setting the base time does not invalidate any cache entries.
Definition at line 366 of file bboxCache.h.
USDGEOM_API void SetIncludedPurposes  (  const TfTokenVector &  includedPurposes  ) 
Indicate the set of includedPurposes
to use when resolving child bounds.
Each child's purpose must match one of the elements of this set to be included in the computation; if it does not, child is excluded.
Note the use of child in the docs above, purpose is ignored for the prim for whose bounds are directly queried.
Changing this value does not invalidate existing caches.
USDGEOM_API void SetTime  (  UsdTimeCode  time  ) 
Use the new time
when computing values and may clear any existing values cached for the previous time.
Setting time
to the current time is a noop.