| 1 |
NAME SbCylinder SbCyl "" { class for representing a cylinder } |
| 2 |
INCLUDE SbLinear.h |
| 3 |
DESC { |
| 4 |
This class defines a simple cylinder datatype. It is used by |
| 5 |
the Inventor toolkit for arguments or return values. |
| 6 |
\- Note that there are no \mCreate\. and \mDelete\. functions for |
| 7 |
\cSbCylinder\.. |
| 8 |
C programmers should treat cylinders as standard C structs (declare them |
| 9 |
locally or use malloc): |
| 10 |
\b\k |
| 11 |
/* This is defined in Inventor_c/SbLinear.h: */ |
| 12 |
struct \{ |
| 13 |
struct SbLine axis; |
| 14 |
float radius; |
| 15 |
\} |
| 16 |
typedef SbCylinder SbCyl; |
| 17 |
|
| 18 |
|
| 19 |
/* Your code should look something like this: */ |
| 20 |
#include <Inventor_c/SbLinear.h> |
| 21 |
|
| 22 |
SbCylinder c; |
| 23 |
|
| 24 |
c.radius = 2.0; |
| 25 |
SbV3fSetX_Y_Z( c.axis.pos, 0.0, 0.0, 0.0 ); |
| 26 |
SbV3fSetX_Y_Z( c.axis.dir, 0.0, 1.0, 0.0 ); |
| 27 |
\.\. |
| 28 |
\. |
| 29 |
} |
| 30 |
BEGIN C++ |
| 31 |
METHOD "" SbCylinder() {} |
| 32 |
METHOD "" SbCylinder(const SbLine &a, float r) { |
| 33 |
Constructors. One takes an axis and radius. |
| 34 |
} |
| 35 |
METHOD "" void setValue(const SbLine &a, float r) { |
| 36 |
Change the axis and radius. |
| 37 |
} |
| 38 |
METHOD "" void setAxis(const SbLine &a) {} |
| 39 |
METHOD "" void setRadius(float r) { |
| 40 |
Set just the axis or radius. |
| 41 |
} |
| 42 |
METHOD "" const SbLine & getAxis() const {} |
| 43 |
METHOD "" float getRadius() const { |
| 44 |
Return the axis and radius. |
| 45 |
} |
| 46 |
END |
| 47 |
METHOD "" SbBool intersect(const SbLine &l, SbVec3f &intersection) const {} |
| 48 |
METHOD intersect2 SbBool intersect(const SbLine &l, |
| 49 |
SbVec3f &enter, SbVec3f &exit) const { |
| 50 |
Intersect line and cylinder, returning \kTRUE\. if there is an intersection. |
| 51 |
} |
| 52 |
ALSO { SbVec3f, SbLine, SbPlane, SbSphere, SoCylinder } |
| 53 |
|