|
Nebula
|
#include <line.h>
A line in 3d space.
Public Member Functions | |
| line () | |
| default constructor | |
| line (const point &startPoint, const point &endPoint) | |
| component constructor | |
| line (const line &rhs) | |
| copy constructor | |
| void | set (const point &startPoint, const point &endPoint) |
| set start and end point | |
| void | set_point_dir (const point &startPoint, const vector &direction) |
| set start point and direction | |
| const point & | start () const |
| get start point | |
| point | end () const |
| get end point | |
| const vector & | vec () const |
| get vector | |
| scalar | length () const |
| get length | |
| scalar | lengthsq () const |
| get squared length | |
| scalar | distance (const point &p) const |
| minimal distance of point to line | |
| bool | intersect (const line &l, point &pa, point &pb) const |
| intersect with line | |
| scalar | distance (const line &l, point &pa, point &pb) const |
| calculates shortest distance between lines | |
| scalar | closestpoint (const point &p) const |
| return t of the closest point on the line | |
| point | pointat (scalar t) const |
| return p = b + m*t | |
Public Attributes | |
| point | b |
| vector | m |
|
inline |
default constructor
|
inline |
copy constructor
return t of the closest point on the line
Returns a point on the line which is closest to a another point in space.
This just returns the parameter t on where the point is located. If t is between 0 and 1, the point is on the line, otherwise not. To get the actual 3d point p:
p = m + b*t
| Math::scalar Math::line::distance | ( | const line & | l, |
| point & | pa, | ||
| point & | pb ) const |
calculates shortest distance between lines
|
inline |
get end point
intersect with line
Get line/line intersection.
Returns the shortest line between two lines.
|
inline |
get length
|
inline |
get squared length
return p = b + m*t
Returns p = b + m * t, given t.
Note that the point is not on the line if 0.0 > t > 1.0
set start and end point
set start point and direction
|
inline |
get start point
|
inline |
get vector
| point Math::line::b |
| vector Math::line::m |