|
| LineT2 () |
| Creates an invalid line. More...
|
|
| LineT2 (const VectorT2< T > &point, const VectorT2< T > &direction) |
| Creates a line defined by a point on the line and a line direction. More...
|
|
| LineT2 (const VectorT3< T > ¶meters) |
| Creates a new line object by given (implicit) three-parameter representation of the line. More...
|
|
| LineT2 (const T angle, const T distance) |
| Creates a new line object by a given angle of the line's normal and the distance of the line to the origin. More...
|
|
template<typename U > |
| LineT2 (const LineT2< U > &line) |
| Copies a line with different data type than T. More...
|
|
const VectorT2< T > & | point () const |
| Returns a point on the line. More...
|
|
VectorT2< T > | point (const T distance) const |
| Returns a point on the line that is defined by a scalar. More...
|
|
const VectorT2< T > & | direction () const |
| Returns the direction of the line. More...
|
|
VectorT2< T > | normal () const |
| Returns a normal to the direction of this line. More...
|
|
void | decomposeAngleDistance (T &angle, T &distance) const |
| Calculates the angle of the line's normal and the corresponding distance of this line to the origin. More...
|
|
VectorT3< T > | decomposeNormalDistance (const bool forcePositiveDistance=false) const |
| Calculates the (implicit) three-parameters representation of this line composed of the line's normal and a distance parameter (nx, ny, d). More...
|
|
bool | isOnLine (const VectorT2< T > &point) const |
| Returns whether a given point is part of the line. More...
|
|
bool | isLeftOfLine (const VectorT2< T > &point) const |
| Check if a point is in the left half-plane of the direction vector of a line A point p is located on the left side of a line, if the cross product of the direction of the line, d , and the vector pointing from starting point of the line, s , to the point p is positive: (d x (p - s)) > 0. More...
|
|
T | distance (const VectorT2< T > &point) const |
| Returns the distance between the line and a given point. More...
|
|
T | sqrDistance (const VectorT2< T > &point) const |
| Returns the square distance between the line and a given point. More...
|
|
VectorT2< T > | nearestPoint (const VectorT2< T > &point) const |
| Returns the point on this line nearest to an arbitrary given point. More...
|
|
bool | intersection (const LineT2< T > &right, VectorT2< T > &point) const |
| Returns the unique intersection point of two lines. More...
|
|
bool | isParallel (const LineT2< T > &right) const |
| Returns whether two lines are parallel up to a small epsilon. More...
|
|
bool | isValid () const |
| Returns whether this line has valid parameters. More...
|
|
bool | hasUnitDirection () const |
| Returns whether this line has a unit vector as direction. More...
|
|
bool | operator== (const LineT2< T > &right) const |
| Returns whether two line are identical up to a small epsilon. More...
|
|
bool | operator!= (const LineT2< T > &right) const |
| Returns whether two line are identical up to a small epsilon. More...
|
|
| operator bool () const |
| Returns whether this line is valid. More...
|
|
bool | isOnLine (const VectorT2< float > &point) const |
|
template<typename T>
class Ocean::LineT2< T >
This class implements an infinite line in 2D space.
The implementation is realized by an (explicit) parametric equation using a point on the line and the direction of the line.
However, the line support conversion function to receive also an implicit equation.
- Template Parameters
-
T | Data type used to represent lines |
- See also
- Line2, LineF2, LineD2, FiniteLine2, FiniteLine.
Creates a new line object by given (implicit) three-parameter representation of the line.
The representation is given by the normal and the distance parameter of the line so that for a point (x, y) lying on the plane the following holds: [nx, ny, d] * [x, y, 1] == 0.
The normal must be defined as unit vector.
- Parameters
-
parameters | The three parameters given as 3D vector |
template<typename T >
VectorT3< T > Ocean::LineT2< T >::decomposeNormalDistance |
( |
const bool |
forcePositiveDistance = false | ) |
const |
|
inline |
Calculates the (implicit) three-parameters representation of this line composed of the line's normal and a distance parameter (nx, ny, d).
For a point (x, y) lying on the plane the following holds: [nx, ny, d] * [x, y, 1] == 0.
- Parameters
-
forcePositiveDistance | True, to force a positive distance values; False, to accept positive and negative distance values |
- Returns
- The resulting three parameter representation
Check if a point is in the left half-plane of the direction vector of a line A point p
is located on the left side of a line, if the cross product of the direction of the line, d
, and the vector pointing from starting point of the line, s
, to the point p
is positive: (d x (p - s)) > 0.
It's on the line the cross product is zero and in the right half-plane it is negative.
- Note
- Keep in mind that if the point is not in the left half-plane, it doesn't necessarily mean that it's in the right half-plane because it could just as well be located on the line.
- Parameters
-
- Returns
- True, if the point is in the left half-plane