Ocean
|
This class implements an infinite line in 3D space. More...
#include <Line3.h>
Public Types | |
typedef T | Type |
Definition of the used data type. | |
Public Member Functions | |
LineT3 ()=default | |
Creates an invalid line. | |
LineT3 (const VectorT3< T > &point, const VectorT3< T > &direction) | |
Creates a line defined by two different intersection points. | |
template<typename U > | |
LineT3 (const LineT3< U > &line) | |
Copies a line with different data type than T. | |
const VectorT3< T > & | point () const |
Returns a point on the line. | |
const VectorT3< T > | point (const T distance) const |
Returns a point on the line that is defined by a scalar. | |
const VectorT3< T > & | direction () const |
Returns the direction of the line. | |
void | setPoint (const VectorT3< T > &point) |
Sets a point of this line. | |
void | setDirection (const VectorT3< T > &direction) |
Sets the direction of this line. | |
bool | isOnLine (const VectorT3< T > &point) const |
Returns whether a given point is part of the line. | |
T | distance (const VectorT3< T > &point) const |
Returns the distance between the line and a given point. | |
T | distance (const LineT3< T > &line) const |
Returns the distance between two lines. | |
T | sqrDistance (const VectorT3< T > &point) const |
Returns the square distance between the line and a given point. | |
VectorT3< T > | nearestPoint (const VectorT3< T > &point) const |
Returns the point on this line nearest to an arbitrary given point. | |
bool | nearestPoint (const LineT3< T > &line, VectorT3< T > &middle) const |
Returns the middle of two nearest points for two crossing lines. | |
bool | nearestPoints (const LineT3< T > &line, VectorT3< T > &first, VectorT3< T > &second) const |
Returns the two nearest points for two crossing lines. | |
bool | isParallel (const LineT3< T > &right) const |
Returns whether two lines are parallel up to a small epsilon. | |
bool | isParallel (const VectorT3< T > &right) const |
Returns whether this line and a given vector are parallel up to a small epsilon. | |
bool | isValid () const |
Returns whether this line has valid parameters. | |
bool | hasUnitDirection () const |
Returns whether this line has a unit vector as direction. | |
bool | operator== (const LineT3< T > &right) const |
Returns whether two line are identical up to a small epsilon. | |
bool | operator!= (const LineT3< T > &right) const |
Returns whether two line are identical up to a small epsilon. | |
operator bool () const | |
Returns whether this line is valid. | |
bool | isOnLine (const VectorT3< float > &point) const |
Protected Attributes | |
VectorT3< T > | point_ = VectorT3<T>(0, 0, 0) |
Point on the line. | |
VectorT3< T > | direction_ = VectorT3<T>(0, 0, 0) |
Direction of the line. | |
Friends | |
template<typename U > | |
class | LineT3 |
This class implements an infinite line in 3D space.
The line is defined by a point lying on the line and a direction vector.
The direction vector must not be a zero vector.
The length of the vector may be arbitrary, however a unit vector is necessary for most functions.
T | Data type used to represent lines |
typedef T Ocean::LineT3< T >::Type |
Definition of the used data type.
|
default |
Creates an invalid line.
Ocean::LineT3< T >::LineT3 | ( | const VectorT3< T > & | point, |
const VectorT3< T > & | direction | ||
) |
Creates a line defined by two different intersection points.
point | Intersection point on the line |
direction | Vector representing the direction of the line, a unit vector might be appropriate |
|
inlineexplicit |
Copies a line with different data type than T.
line | The line to copy |
U | The data type of the second line |
|
inline |
Returns the direction of the line.
T Ocean::LineT3< T >::distance | ( | const LineT3< T > & | line | ) | const |
Returns the distance between two lines.
This function needs a unit vector as direction!
line | Second line to calculate the distance for |
T Ocean::LineT3< T >::distance | ( | const VectorT3< T > & | point | ) | const |
Returns the distance between the line and a given point.
This function needs a unit vector as direction!
point | The point to return the distance for |
|
inline |
Returns whether this line has a unit vector as direction.
|
inline |
bool Ocean::LineT3< T >::isOnLine | ( | const VectorT3< T > & | point | ) | const |
Returns whether a given point is part of the line.
This function needs a unit vector as direction!
point | The point to check |
|
inline |
Returns whether two lines are parallel up to a small epsilon.
This function needs a unit vector as direction!
right | Second line |
|
inline |
Returns whether this line and a given vector are parallel up to a small epsilon.
This function needs a unit vector as direction!
right | Vector to be compared |
|
inline |
Returns whether this line has valid parameters.
bool Ocean::LineT3< T >::nearestPoint | ( | const LineT3< T > & | line, |
VectorT3< T > & | middle | ||
) | const |
Returns the middle of two nearest points for two crossing lines.
This function needs a unit vector as direction!
Both lines must not be parallel.
line | Second line to calculate the point for |
middle | Nearest point between two lines |
VectorT3< T > Ocean::LineT3< T >::nearestPoint | ( | const VectorT3< T > & | point | ) | const |
Returns the point on this line nearest to an arbitrary given point.
This function needs a unit vector as direction!
point | Arbitrary point outside the line |
bool Ocean::LineT3< T >::nearestPoints | ( | const LineT3< T > & | line, |
VectorT3< T > & | first, | ||
VectorT3< T > & | second | ||
) | const |
Returns the two nearest points for two crossing lines.
Both lines must not be parallel.
This function needs a unit vector as direction!
line | Second line to calculate the points for |
first | Nearest point on the first line |
second | Nearest point on the second line |
|
inlineexplicit |
Returns whether this line is valid.
|
inline |
Returns whether two line are identical up to a small epsilon.
This function needs a unit vector as direction!
right | The right line |
|
inline |
Returns whether two line are identical up to a small epsilon.
This function needs a unit vector as direction!
right | The right line |
|
inline |
Returns a point on the line.
|
inline |
Returns a point on the line that is defined by a scalar.
The result is determined by point() + direction() * distance;
distance | The distance to determine the line point for |
|
inline |
Sets the direction of this line.
direction | Vector defining the new direction, a unit vector might be appropriate |
|
inline |
Sets a point of this line.
point | The point of this line |
T Ocean::LineT3< T >::sqrDistance | ( | const VectorT3< T > & | point | ) | const |
Returns the square distance between the line and a given point.
This function needs a unit vector as direction!
point | The point to return the distance for |
|
protected |
Direction of the line.
|
protected |
Point on the line.