| 1 |
NAME SoGetBoundingBoxAction SoBBoxAct "SO_BBOX_ACT_" { |
| 2 |
computes bounding box of a scene |
| 3 |
} |
| 4 |
|
| 5 |
INCLUDE actions/SoGetBoundingBoxAction.h |
| 6 |
|
| 7 |
DESC { |
| 8 |
This class is used to compute a 3D bounding box enclosing objects |
| 9 |
defined by a scene graph. The box is a rectangular prism. The action |
| 10 |
also computes the center point, which is defined differently for |
| 11 |
different objects. (For example, the center of an \cSoFaceSet\. is |
| 12 |
the average of its vertices' coordinates.) For a group, the center |
| 13 |
point is defined as the average of the centers of all shapes in it. |
| 14 |
\p |
| 15 |
Each bounding box is calculated as a \cSbXfBox3f\., where the |
| 16 |
transformation matrix is defined so that the bounding box can be |
| 17 |
stored in the object space of the \cSoShape\.. When two bounding boxes |
| 18 |
are combined by a group node, the combination is performed so as to |
| 19 |
produce the smaller untransformed box. The result of the calculation |
| 20 |
by the action can be returned as an \cSbXfBox3f\. or as a |
| 21 |
world-space-aligned \cSbBox3f\.. |
| 22 |
\p |
| 23 |
To calculate the bounding box of a subgraph bounded by two paths, |
| 24 |
specify the left edge of the subgraph with \msetResetPath()\., and |
| 25 |
apply the action to the path that defines the right edge of the |
| 26 |
subgraph. The accumulated bounding box and transformation will be |
| 27 |
reset when the tail of the reset path is traversed. |
| 28 |
\p |
| 29 |
If the subgraph being traversed does not contain any shapes, the returned |
| 30 |
bounding box will be empty (that is, |
| 31 |
\m\+box.isEmpty()\.\-SbBox3fIsEmpty()\.\. |
| 32 |
will return TRUE). |
| 33 |
} |
| 34 |
|
| 35 |
ENUM ResetType { |
| 36 |
TRANSFORM "Transformation", |
| 37 |
BBOX "Bounding Box", |
| 38 |
ALL "Both Transform and Bounding Box" |
| 39 |
} |
| 40 |
|
| 41 |
METHOD "" SoGetBoundingBoxAction(const SbViewportRegion &viewportRegion) { |
| 42 |
Constructor takes viewport region to use for picking. Even |
| 43 |
though the bounding box computation may not involve a window |
| 44 |
per se, some nodes need this information to determine their |
| 45 |
size and placement. |
| 46 |
} |
| 47 |
|
| 48 |
METHOD setVPReg void setViewportRegion(const SbViewportRegion &newRegion) {} |
| 49 |
METHOD getVPReg const SbViewportRegion &getViewportRegion() const { |
| 50 |
Sets/returns current viewport region to use for action. |
| 51 |
} |
| 52 |
|
| 53 |
METHOD getBBox SbBox3f getBoundingBox() const { |
| 54 |
Returns computed bounding box in world space. |
| 55 |
} |
| 56 |
|
| 57 |
METHOD getXfBBox SbXfBox3f & getXfBoundingBox() { |
| 58 |
Returns computed bounding box before transformation into world space. |
| 59 |
} |
| 60 |
|
| 61 |
METHOD "" const SbVec3f & getCenter() const { |
| 62 |
Returns computed center point in world space. |
| 63 |
} |
| 64 |
|
| 65 |
METHOD setInCamSpace void setInCameraSpace(SbBool flag) { |
| 66 |
Set this flag to TRUE if you want the returned bounding box to be in |
| 67 |
the space of whatever camera is in the graph. Camera space is defined |
| 68 |
to have the viewpoint at the origin, with the direction of view along |
| 69 |
the negative z axis. This space can be used to determine distances of |
| 70 |
objects from the camera. |
| 71 |
} |
| 72 |
|
| 73 |
METHOD isInCamSpace SbBool isInCameraSpace() const { |
| 74 |
Returns camera space flag. |
| 75 |
} |
| 76 |
|
| 77 |
METHOD "" void setResetPath(const SoPath *path, SbBool resetBefore = TRUE, |
| 78 |
ResetType what = ALL) { |
| 79 |
If a non-NULL path is specified, the action will reset the computed |
| 80 |
bounding box to be empty and/or the current transformation to |
| 81 |
identity. The \aresetBefore\. flag indicates whether to perform the |
| 82 |
reset before or after the tail node of the path is traversed. |
| 83 |
} |
| 84 |
|
| 85 |
METHOD "" const SoPath * getResetPath() const { |
| 86 |
Returns the current reset path, or NULL. |
| 87 |
} |
| 88 |
|
| 89 |
METHOD "" SbBool isResetPath() const { |
| 90 |
Returns TRUE if the current reset path is not NULL. |
| 91 |
} |
| 92 |
|
| 93 |
METHOD "" SbBool isResetBefore() const { |
| 94 |
Returns TRUE if the \aresetBefore\. flag was specified for the reset path. |
| 95 |
} |
| 96 |
|
| 97 |
BEGIN C++ |
| 98 |
METHOD "" SoGetBoundingBoxAction::ResetType getWhatReset() const { |
| 99 |
Returns what flags were specified to be reset for the reset path. |
| 100 |
} |
| 101 |
END |
| 102 |
BEGIN C |
| 103 |
METHOD "" SoBBoxActResetType getWhatReset() const { |
| 104 |
Returns what flags were specified to be reset for the reset path. |
| 105 |
} |
| 106 |
END |
| 107 |
|
| 108 |
ALSO { SbBox3f, SbXfBox3f, SoGetMatrixAction } |
| 109 |
|
| 110 |
|