Ocean
Ocean::LineT3< T > Class Template Reference

This class implements an infinite line in 3D space. More...

Public Types

typedef T Type
 Definition of the used data type. More...
 

Public Member Functions

 LineT3 ()=default
 Creates an invalid line. More...
 
 LineT3 (const VectorT3< T > &point, const VectorT3< T > &direction)
 Creates a line defined by two different intersection points. More...
 
template<typename U >
 LineT3 (const LineT3< U > &line)
 Copies a line with different data type than T. More...
 
const VectorT3< T > & point () const
 Returns a point on the line. More...
 
const VectorT3< T > point (const T distance) const
 Returns a point on the line that is defined by a scalar. More...
 
const VectorT3< T > & direction () const
 Returns the direction of the line. More...
 
void setPoint (const VectorT3< T > &point)
 Sets a point of this line. More...
 
void setDirection (const VectorT3< T > &direction)
 Sets the direction of this line. More...
 
bool isOnLine (const VectorT3< T > &point) const
 Returns whether a given point is part of the line. More...
 
distance (const VectorT3< T > &point) const
 Returns the distance between the line and a given point. More...
 
distance (const LineT3< T > &line) const
 Returns the distance between two lines. More...
 
sqrDistance (const VectorT3< T > &point) const
 Returns the square distance between the line and a given point. More...
 
VectorT3< T > nearestPoint (const VectorT3< T > &point) const
 Returns the point on this line nearest to an arbitrary given point. More...
 
bool nearestPoint (const LineT3< T > &line, VectorT3< T > &middle) const
 Returns the middle of two nearest points for two crossing lines. More...
 
bool nearestPoints (const LineT3< T > &line, VectorT3< T > &first, VectorT3< T > &second) const
 Returns the two nearest points for two crossing lines. More...
 
bool isParallel (const LineT3< T > &right) const
 Returns whether two lines are parallel up to a small epsilon. More...
 
bool isParallel (const VectorT3< T > &right) const
 Returns whether this line and a given vector 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 LineT3< T > &right) const
 Returns whether two line are identical up to a small epsilon. More...
 
bool operator!= (const LineT3< 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 VectorT3< float > &point) const
 

Protected Attributes

VectorT3< T > point_ = VectorT3<T>(0, 0, 0)
 Point on the line. More...
 
VectorT3< T > direction_ = VectorT3<T>(0, 0, 0)
 Direction of the line. More...
 

Friends

template<typename U >
class LineT3
 

Detailed Description

template<typename T>
class Ocean::LineT3< T >

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.

Template Parameters
TData type used to represent lines
See also
Line3, LineF3, LineD3, FiniteLine3, FiniteLine3.

Member Typedef Documentation

◆ Type

template<typename T >
typedef T Ocean::LineT3< T >::Type

Definition of the used data type.

Constructor & Destructor Documentation

◆ LineT3() [1/3]

template<typename T >
Ocean::LineT3< T >::LineT3 ( )
default

Creates an invalid line.

◆ LineT3() [2/3]

template<typename T >
Ocean::LineT3< T >::LineT3 ( const VectorT3< T > &  point,
const VectorT3< T > &  direction 
)

Creates a line defined by two different intersection points.

Parameters
pointIntersection point on the line
directionVector representing the direction of the line, a unit vector might be appropriate

◆ LineT3() [3/3]

template<typename T >
template<typename U >
Ocean::LineT3< T >::LineT3 ( const LineT3< U > &  line)
inlineexplicit

Copies a line with different data type than T.

Parameters
lineThe line to copy
Template Parameters
UThe data type of the second line

Member Function Documentation

◆ direction()

template<typename T >
const VectorT3< T > & Ocean::LineT3< T >::direction
inline

Returns the direction of the line.

Returns
Unit vector

◆ distance() [1/2]

template<typename T >
T Ocean::LineT3< T >::distance ( const LineT3< T > &  line) const

Returns the distance between two lines.

This function needs a unit vector as direction!

Parameters
lineSecond line to calculate the distance for
Returns
Distance

◆ distance() [2/2]

template<typename T >
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!

Parameters
pointThe point to return the distance for
Returns
Positive distance between point and line, with range [0, infinity)

◆ hasUnitDirection()

template<typename T >
bool Ocean::LineT3< T >::hasUnitDirection
inline

Returns whether this line has a unit vector as direction.

Returns
True, if so

◆ isOnLine() [1/2]

bool Ocean::LineT3< float >::isOnLine ( const VectorT3< float > &  point) const
inline

◆ isOnLine() [2/2]

template<typename T >
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!

Parameters
pointThe point to check
Returns
True, if so

◆ isParallel() [1/2]

template<typename T >
bool Ocean::LineT3< T >::isParallel ( const LineT3< T > &  right) const
inline

Returns whether two lines are parallel up to a small epsilon.

This function needs a unit vector as direction!

Parameters
rightSecond line
Returns
True, if so

◆ isParallel() [2/2]

template<typename T >
bool Ocean::LineT3< T >::isParallel ( const VectorT3< T > &  right) const
inline

Returns whether this line and a given vector are parallel up to a small epsilon.

This function needs a unit vector as direction!

Parameters
rightVector to be compared
Returns
True, if so

◆ isValid()

template<typename T >
bool Ocean::LineT3< T >::isValid
inline

Returns whether this line has valid parameters.

Returns
True, if so

◆ nearestPoint() [1/2]

template<typename T >
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.

Parameters
lineSecond line to calculate the point for
middleNearest point between two lines
Returns
True, if succeeded

◆ nearestPoint() [2/2]

template<typename T >
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!

Parameters
pointArbitrary point outside the line
Returns
Nearest point on the line

◆ nearestPoints()

template<typename T >
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!

Parameters
lineSecond line to calculate the points for
firstNearest point on the first line
secondNearest point on the second line
Returns
True, if succeeded

◆ operator bool()

template<typename T >
Ocean::LineT3< T >::operator bool
inlineexplicit

Returns whether this line is valid.

Returns
True, if so

◆ operator!=()

template<typename T >
bool Ocean::LineT3< T >::operator!= ( const LineT3< T > &  right) const
inline

Returns whether two line are identical up to a small epsilon.

This function needs a unit vector as direction!

Parameters
rightThe right line
Returns
True, if so

◆ operator==()

template<typename T >
bool Ocean::LineT3< T >::operator== ( const LineT3< T > &  right) const
inline

Returns whether two line are identical up to a small epsilon.

This function needs a unit vector as direction!

Parameters
rightThe right line
Returns
True, if so

◆ point() [1/2]

template<typename T >
const VectorT3< T > & Ocean::LineT3< T >::point
inline

Returns a point on the line.

Returns
Point on line

◆ point() [2/2]

template<typename T >
const VectorT3< T > Ocean::LineT3< T >::point ( const T  distance) const
inline

Returns a point on the line that is defined by a scalar.

The result is determined by point() + direction() * distance;

Parameters
distanceThe distance to determine the line point for
Returns
Point on line

◆ setDirection()

template<typename T >
void Ocean::LineT3< T >::setDirection ( const VectorT3< T > &  direction)
inline

Sets the direction of this line.

Parameters
directionVector defining the new direction, a unit vector might be appropriate

◆ setPoint()

template<typename T >
void Ocean::LineT3< T >::setPoint ( const VectorT3< T > &  point)
inline

Sets a point of this line.

Parameters
pointThe point of this line

◆ sqrDistance()

template<typename T >
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!

Parameters
pointThe point to return the distance for
Returns
The square distance between point and line, with range [0, infinity)

Friends And Related Function Documentation

◆ LineT3

template<typename T >
template<typename U >
friend class LineT3
friend

Field Documentation

◆ direction_

template<typename T >
VectorT3<T> Ocean::LineT3< T >::direction_ = VectorT3<T>(0, 0, 0)
protected

Direction of the line.

◆ point_

template<typename T >
VectorT3<T> Ocean::LineT3< T >::point_ = VectorT3<T>(0, 0, 0)
protected

Point on the line.


The documentation for this class was generated from the following file: