| 1 |
NAME SbSphere SbSph "" { class for representing a sphere } |
| 2 |
INCLUDE SbLinear.h |
| 3 |
DESC { |
| 4 |
Represents a sphere in 3D. This is a lightweight datatype that |
| 5 |
is used for arguments or return values in the Inventor toolkit. See |
| 6 |
\cSoSphere\. for a database sphere (used for rendering, picking, etc.). |
| 7 |
\- |
| 8 |
Note that there are no |
| 9 |
\mCreate\. |
| 10 |
and |
| 11 |
\mDelete\. |
| 12 |
functions for |
| 13 |
\cSbSphere\. . |
| 14 |
C programmers should treat spheres as standard C structs (declare them |
| 15 |
locally or use |
| 16 |
\kmalloc()\. ): |
| 17 |
\b\k |
| 18 |
|
| 19 |
/* This is defined in Inventor_c/SbLinear.h: */ |
| 20 |
|
| 21 |
struct \{ |
| 22 |
struct SbVec3f center; |
| 23 |
float radius; |
| 24 |
\} |
| 25 |
|
| 26 |
|
| 27 |
/* Your code should look something like this: */ |
| 28 |
#include <Inventor_c/SbLinear.h> |
| 29 |
|
| 30 |
SbSphere s; |
| 31 |
|
| 32 |
s.radius = 5.0; |
| 33 |
SbV3fSetX_Y_Z( s.center, 0.0, 2.0, 0.0 ); |
| 34 |
|
| 35 |
\.\. |
| 36 |
\. |
| 37 |
} |
| 38 |
BEGIN C++ |
| 39 |
METHOD "" SbSphere() {} |
| 40 |
METHOD "" SbSphere(const SbVec3f ¢er, float radius) { |
| 41 |
Constructors. |
| 42 |
} |
| 43 |
METHOD "" void setValue(const SbVec3f ¢er, float radius) { |
| 44 |
Change the center and radius. |
| 45 |
} |
| 46 |
METHOD "" void setCenter(const SbVec3f ¢er) {} |
| 47 |
METHOD "" void setRadius(float radius) { |
| 48 |
Set just the center or radius. |
| 49 |
} |
| 50 |
METHOD "" const SbVec3f & getCenter() const {} |
| 51 |
METHOD "" float getRadius() const { |
| 52 |
Return the center and radius. |
| 53 |
} |
| 54 |
END |
| 55 |
METHOD "" void circumscribe(const SbBox3f &box) { |
| 56 |
Return a sphere containing a given box. |
| 57 |
} |
| 58 |
METHOD "" SbBool intersect(const SbLine &l, SbVec3f &intersection) const {} |
| 59 |
METHOD intersect2 SbBool intersect(const SbLine &l, SbVec3f &enter, |
| 60 |
SbVec3f &exit) const { |
| 61 |
Intersect line and sphere, returning TRUE if there is an intersection. The |
| 62 |
line is treated as a ray. |
| 63 |
} |
| 64 |
ALSO { SbVec3f, SbLine, SoSphere } |
| 65 |
|