HDK

#include <bboxCache.h>
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 Usd_ValueResolution 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::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  (  UsdGeomBBoxCache const &  other  ) 
Copy constructor.
USDGEOM_API void UsdGeomBBoxCache::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 359 of file bboxCache.h.
USDGEOM_API GfBBox3d UsdGeomBBoxCache::ComputeLocalBound  (  const UsdPrim &  prim  ) 
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 261 of file bboxCache.h.
USDGEOM_API bool UsdGeomBBoxCache::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 233 of file bboxCache.h.
USDGEOM_API bool UsdGeomBBoxCache::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 291 of file bboxCache.h.
USDGEOM_API bool UsdGeomBBoxCache::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 204 of file bboxCache.h.
USDGEOM_API bool UsdGeomBBoxCache::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 UsdGeomBBoxCache::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
.
USDGEOM_API GfBBox3d UsdGeomBBoxCache::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.
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 UsdGeomBBoxCache::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.
USDGEOM_API GfBBox3d UsdGeomBBoxCache::ComputeWorldBound  (  const UsdPrim &  prim  ) 
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.

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

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

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

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

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

inline 
Return true if this cache has a baseTime that's been explicitly set, false otherwise.
Definition at line 365 of file bboxCache.h.
USDGEOM_API UsdGeomBBoxCache& 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 347 of file bboxCache.h.
USDGEOM_API void UsdGeomBBoxCache::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 UsdGeomBBoxCache::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.

friend 