Ocean
Ocean::FiniteLineT3< T > Class Template Reference

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

Public Types

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

Public Member Functions

 FiniteLineT3 ()
 Creates a finite line with default parameters. More...
 
 FiniteLineT3 (const VectorT3< T > &point0, const VectorT3< T > &point1)
 Creates a finite line defined by two end points of the line. More...
 
template<typename U >
 FiniteLineT3 (const FiniteLineT3< U > &line)
 Copies a line with different data type than T. More...
 
const VectorT3< T > & point0 () const
 Returns the first end point of the line. More...
 
const VectorT3< T > & point1 () const
 Returns the second end point of the line. More...
 
const VectorT3< T > & point (const unsigned int index) const
 Returns the first or second end point of the line. More...
 
VectorT3< T > midpoint () const
 Returns the midpoint of the line. More...
 
const VectorT3< T > & direction () const
 Returns the direction of the line: normalize(point1() - point0()) More...
 
bool isOnLine (const VectorT3< T > &point) const
 Returns whether a given point is part of the finite line. More...
 
distance (const VectorT3< T > &point) const
 Returns the distance between the line and a given point. 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 intersection (const FiniteLineT3< T > &right, VectorT3< T > &point) const
 Returns the intersection pointer of two finite lines. More...
 
bool isParallel (const FiniteLineT3< 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 operator== (const FiniteLineT3< T > &right) const
 Returns whether two line are identical up to a small epsilon. More...
 
bool operator!= (const FiniteLineT3< 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...
 

Protected Attributes

VectorT3< T > linePoint0
 First end point of the line. More...
 
VectorT3< T > linePoint1
 Second end point of the line. More...
 
VectorT3< T > lineDirection
 Direction of the line with unit length, if the object holds valid parameters. More...
 

Detailed Description

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

This class implements an finite line in 3D space.

The finite line object is invalid if both end points of the line object are identical.

Template Parameters
TData type used to represent lines
See also
FiniteLine3, FiniteLineF3, FiniteLineD3, Line3, Line3

Member Typedef Documentation

◆ Type

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

Definition of the used data type.

Constructor & Destructor Documentation

◆ FiniteLineT3() [1/3]

template<typename T >
Ocean::FiniteLineT3< T >::FiniteLineT3

Creates a finite line with default parameters.

◆ FiniteLineT3() [2/3]

template<typename T >
Ocean::FiniteLineT3< T >::FiniteLineT3 ( const VectorT3< T > &  point0,
const VectorT3< T > &  point1 
)

Creates a finite line defined by two end points of the line.

Parameters
point0First end point of the line
point1Second end point of the line, must be different from point0 to create a valid line, otherwise the line is invalid

◆ FiniteLineT3() [3/3]

template<typename T >
template<typename U >
Ocean::FiniteLineT3< T >::FiniteLineT3 ( const FiniteLineT3< 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::FiniteLineT3< T >::direction
inline

Returns the direction of the line: normalize(point1() - point0())

Returns
Direction vector with unit length, a zero vector if the line is invalid
See also
isValid().

◆ distance()

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

Returns the distance between the line and a given point.

This function needs a unit vector as direction!

Parameters
pointPoint to return the distance for
Returns
Distance between point and line

◆ intersection()

template<typename T >
bool Ocean::FiniteLineT3< T >::intersection ( const FiniteLineT3< T > &  right,
VectorT3< T > &  point 
) const
inline

Returns the intersection pointer of two finite lines.

Parameters
rightRight line for intersection calculation
pointResulting intersection pointer
Returns
True, if both lines have a common intersection point

◆ isOnLine()

template<typename T >
bool Ocean::FiniteLineT3< T >::isOnLine ( const VectorT3< T > &  point) const
inline

Returns whether a given point is part of the finite line.

Parameters
pointPoint to check
Returns
True, if so

◆ isParallel()

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

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

Parameters
rightSecond line
Returns
True, if so

◆ isValid()

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

Returns whether this line has valid parameters.

Returns
True, if so

◆ midpoint()

template<typename T >
VectorT3< T > Ocean::FiniteLineT3< T >::midpoint
inline

Returns the midpoint of the line.

Returns
Midpoint point of the line

◆ nearestPoint()

template<typename T >
VectorT3< T > Ocean::FiniteLineT3< 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

◆ operator bool()

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

Returns whether this line is valid.

Returns
True, if so

◆ operator!=()

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

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

Parameters
rightRight line
Returns
True, if so

◆ operator==()

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

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

Two finite lines are identical if both lines have the same endpoint (independent of the order of the end points).

Parameters
rightRight line
Returns
True, if so

◆ point()

template<typename T >
const VectorT3< T > & Ocean::FiniteLineT3< T >::point ( const unsigned int  index) const
inline

Returns the first or second end point of the line.

Parameters
indexThe index of the point to be returned, with range [0, 1]
Returns
First or second end point of the line

◆ point0()

template<typename T >
const VectorT3< T > & Ocean::FiniteLineT3< T >::point0
inline

Returns the first end point of the line.

Returns
First end point of the line

◆ point1()

template<typename T >
const VectorT3< T > & Ocean::FiniteLineT3< T >::point1
inline

Returns the second end point of the line.

Returns
Second end point of the line

◆ sqrDistance()

template<typename T >
T Ocean::FiniteLineT3< T >::sqrDistance ( const VectorT3< T > &  point) const
inline

Returns the square distance between the line and a given point.

Parameters
pointPoint to return the distance for
Returns
Square distance between point and line

Field Documentation

◆ lineDirection

template<typename T >
VectorT3<T> Ocean::FiniteLineT3< T >::lineDirection
protected

Direction of the line with unit length, if the object holds valid parameters.

◆ linePoint0

template<typename T >
VectorT3<T> Ocean::FiniteLineT3< T >::linePoint0
protected

First end point of the line.

◆ linePoint1

template<typename T >
VectorT3<T> Ocean::FiniteLineT3< T >::linePoint1
protected

Second end point of the line.


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