1SoGetBoundingBoxAction(3IV)() SoGetBoundingBoxAction(3IV)()
2
3
4
6 SoGetBoundingBoxAction — computes bounding box of a scene
7
9 SoAction > SoGetBoundingBoxAction
10
12 #include <Inventor/actions/SoGetBoundingBoxAction.h>
13
14 enum ResetType {
15 SoGetBoundingBoxAction::TRANSFORM
16 Transformation
17 SoGetBoundingBoxAction::BBOX Bounding Box
18 SoGetBoundingBoxAction::ALL Both Transform and Bounding Box
19 }
20
21 Methods from class SoGetBoundingBoxAction:
22
23 SoGetBoundingBoxAction(const SbViewportRegion
24 &viewportRegion)
25 void setViewportRegion(const SbViewportRegion
26 &newRegion)
27 const SbViewportRegion & getViewportRegion() const
28 SbBox3f getBoundingBox() const
29 SbXfBox3f & getXfBoundingBox()
30 const SbVec3f & getCenter() const
31 void setInCameraSpace(SbBool flag)
32 SbBool isInCameraSpace() const
33 void setResetPath(const SoPath *path, SbBool reset‐
34 Before = TRUE, ResetType what = ALL)
35 const SoPath * getResetPath() const
36 SbBool isResetPath() const
37 SbBool isResetBefore() const
38 SoGetBoundingBoxAction::ResetType
39 getWhatReset() const
40
41 Methods from class SoAction:
42
43 virtual void apply(SoNode *node)
44 virtual void apply(SoPath *path)
45 virtual void apply(const SoPathList &pathList, SbBool obeysRules =
46 FALSE)
47 static SoType getClassTypeId()
48 virtual SoType getTypeId()
49 virtual SbBool isOfType(SoType type)
50 virtual void invalidateState()
51
52
54 This class is used to compute a 3D bounding box enclosing objects
55 defined by a scene graph. The box is a rectangular prism. The action
56 also computes the center point, which is defined differently for dif‐
57 ferent objects. (For example, the center of an SoFaceSet is the average
58 of its vertices' coordinates.) For a group, the center point is defined
59 as the average of the centers of all shapes in it.
60
61 Each bounding box is calculated as a SbXfBox3f, where the transforma‐
62 tion matrix is defined so that the bounding box can be stored in the
63 object space of the SoShape. When two bounding boxes are combined by a
64 group node, the combination is performed so as to produce the smaller
65 untransformed box. The result of the calculation by the action can be
66 returned as an SbXfBox3f or as a world-space-aligned SbBox3f.
67
68 To calculate the bounding box of a subgraph bounded by two paths, spec‐
69 ify the left edge of the subgraph with setResetPath(), and apply the
70 action to the path that defines the right edge of the subgraph. The
71 accumulated bounding box and transformation will be reset when the tail
72 of the reset path is traversed.
73
74 If the subgraph being traversed does not contain any shapes, the
75 returned bounding box will be empty (that is, box.isEmpty() will return
76 TRUE).
77
79 SoGetBoundingBoxAction(const SbViewportRegion
80 &viewportRegion)
81 Constructor takes viewport region to use for picking. Even though
82 the bounding box computation may not involve a window per se, some
83 nodes need this information to determine their size and placement.
84
85 void setViewportRegion(const SbViewportRegion
86 &newRegion)
87 const SbViewportRegion & getViewportRegion() const
88 Sets/returns current viewport region to use for action.
89
90 SbBox3f getBoundingBox() const
91 Returns computed bounding box in world space.
92
93 SbXfBox3f & getXfBoundingBox()
94 Returns computed bounding box before transformation into world
95 space.
96
97 const SbVec3f & getCenter() const
98 Returns computed center point in world space.
99
100 void setInCameraSpace(SbBool flag)
101 Set this flag to TRUE if you want the returned bounding box to be in
102 the space of whatever camera is in the graph. Camera space is
103 defined to have the viewpoint at the origin, with the direction of
104 view along the negative z axis. This space can be used to determine
105 distances of objects from the camera.
106
107 SbBool isInCameraSpace() const
108 Returns camera space flag.
109
110 void setResetPath(const SoPath *path, SbBool reset‐
111 Before = TRUE, ResetType what = ALL)
112 If a non-NULL path is specified, the action will reset the computed
113 bounding box to be empty and/or the current transformation to iden‐
114 tity. The resetBefore flag indicates whether to perform the reset
115 before or after the tail node of the path is traversed.
116
117 const SoPath * getResetPath() const
118 Returns the current reset path, or NULL.
119
120 SbBool isResetPath() const
121 Returns TRUE if the current reset path is not NULL.
122
123 SbBool isResetBefore() const
124 Returns TRUE if the resetBefore flag was specified for the reset
125 path.
126
127 SoGetBoundingBoxAction::ResetType
128 getWhatReset() const
129 Returns what flags were specified to be reset for the reset path.
130
131
133 SbBox3f, SbXfBox3f, SoGetMatrixAction
134
135
136
137
138 SoGetBoundingBoxAction(3IV)()