| 1 |
NAME SbLine "" "" { directed line in 3D } |
| 2 |
INCLUDE SbLinear.h |
| 3 |
DESC { |
| 4 |
Represents a directed line in 3D. This is a basic Inventor datatype that is |
| 5 |
used for representing a 3D line. It is used as input and output by a variety of |
| 6 |
Inventor classes. |
| 7 |
\- |
| 8 |
Note that it does not have |
| 9 |
\mCreate\. |
| 10 |
or |
| 11 |
\mDelete\. |
| 12 |
functions. This is because is is a lightweight datatype that |
| 13 |
should be declared or malloc'd as a standard C struct: |
| 14 |
\b\k |
| 15 |
/* This is defined in Inventor_c/SbLinear.h: */ |
| 16 |
struct SbLine \{ |
| 17 |
struct SbVec3f pos; |
| 18 |
struct SbVec3f dir; |
| 19 |
\}; |
| 20 |
|
| 21 |
|
| 22 |
/* This is what your code should look like: */ |
| 23 |
SbLine line; |
| 24 |
|
| 25 |
line.pos.vec[0] = 0.0; |
| 26 |
line.pos.vec[1] = 0; |
| 27 |
line.pos.vec[2] = 0.0; |
| 28 |
SbV3fSetX_Y_Z( line.dir, 0, 1, 0 ); |
| 29 |
\.\. |
| 30 |
\. |
| 31 |
} |
| 32 |
BEGIN C++ |
| 33 |
METHOD "" SbLine() {} |
| 34 |
METHOD "" SbLine(const SbVec3f &p0, const SbVec3f &p1) { |
| 35 |
Constructors. To construct a line from a position and direction, |
| 36 |
use: \kSbLine(p0, p0 + dir)\.. The line is directed from \ap0\. to \ap1\.. |
| 37 |
} |
| 38 |
METHOD "" void setValue(const SbVec3f &p0, const SbVec3f &p1) { |
| 39 |
Sets line to pass through points \ap0\. and \ap1\.. |
| 40 |
} |
| 41 |
END |
| 42 |
METHOD getClosestPts SbBool getClosestPoints(const SbLine &line2, |
| 43 |
SbVec3f &ptOnThis, SbVec3f &ptOnLine2 ) const { |
| 44 |
Finds the two closest points between this line and \aline2\., |
| 45 |
and loads them into \aptOnThis\. and \aptOnLine2\.. |
| 46 |
Returns \kFALSE\. if the lines are parallel (results undefined), and returns |
| 47 |
\kTRUE\. otherwise. |
| 48 |
} |
| 49 |
METHOD getClosestPt SbVec3f getClosestPoint(const SbVec3f &point) const { |
| 50 |
Returns the closest point on the line to the given point. |
| 51 |
} |
| 52 |
BEGIN C++ |
| 53 |
METHOD "" const SbVec3f & getPosition() const {} |
| 54 |
METHOD "" const SbVec3f & getDirection() const { |
| 55 |
Returns position of line origin point and direction vector of line. |
| 56 |
} |
| 57 |
ALSO {SbVec3f, SbPlane } |
| 58 |
|