Visual Computing Library  devel
Loading...
Searching...
No Matches
vcl::Line< PointT > Class Template Reference

A class representing a line in n-dimensional space. The class is parameterized by a PointConcept, which must provide the DIM constant and the [] operator for accessing the point coordinates. More...

#include <vclib/space/core/line.h>

Public Types

using PointType = PointT
 The type of point used to represent the origin and direction of the line.
 
using ScalarType = PointT::ScalarType
 The scalar type of the line.
 

Public Member Functions

PointT & direction ()
 Returns the direction of the line.
 
const PointT & direction () const
 Returns the direction of the line.
 
 Line ()
 Default constructor. Creates an invalid Line at the origin (direction is zero).
 
 Line (const PointT &origin, const PointT &direction)
 Creates a line with the given origin and direction.
 
PointT normalizedDirection () const
 Returns the normalized direction of the line.
 
bool operator!= (const Line< PointT > &s) const =default
 
bool operator== (const Line< PointT > &s) const =default
 
PointT & origin ()
 Returns the origin of the line.
 
const PointT & origin () const
 Returns the origin of the line.
 
PointT pointAtParameter (ScalarType t) const
 Returns the point at parameter t along the line.
 

Static Public Attributes

static const uint DIM = PointT::DIM
 The dimensionality of the line.
 

Private Attributes

PointT mDirection
 
PointT mOrigin
 

Detailed Description

template<PointConcept PointT>
class vcl::Line< PointT >

A class representing a line in n-dimensional space. The class is parameterized by a PointConcept, which must provide the DIM constant and the [] operator for accessing the point coordinates.

Template Parameters
PointTThe type of the two endpoint points of the line.

Constructor & Destructor Documentation

◆ Line()

template<PointConcept PointT>
vcl::Line< PointT >::Line ( const PointT &  origin,
const PointT &  direction 
)
inline

Creates a line with the given origin and direction.

Parameters
[in]originThe origin of the line.
[in]directionThe direction of the line.

Member Function Documentation

◆ direction() [1/2]

template<PointConcept PointT>
PointT & vcl::Line< PointT >::direction ( )
inline

Returns the direction of the line.

Returns
A reference to the direction of the line.

◆ direction() [2/2]

template<PointConcept PointT>
const PointT & vcl::Line< PointT >::direction ( ) const
inline

Returns the direction of the line.

Returns
A reference to the direction of the line.

◆ normalizedDirection()

template<PointConcept PointT>
PointT vcl::Line< PointT >::normalizedDirection ( ) const
inline

Returns the normalized direction of the line.

Returns
The normalized direction of the line.

◆ origin() [1/2]

template<PointConcept PointT>
PointT & vcl::Line< PointT >::origin ( )
inline

Returns the origin of the line.

Returns
A reference to the origin of the line.

◆ origin() [2/2]

template<PointConcept PointT>
const PointT & vcl::Line< PointT >::origin ( ) const
inline

Returns the origin of the line.

Returns
A const reference to the origin of the line.

◆ pointAtParameter()

template<PointConcept PointT>
PointT vcl::Line< PointT >::pointAtParameter ( ScalarType  t) const
inline

Returns the point at parameter t along the line.

Parameters
[in]tThe parameter value.
Returns
The point at parameter t along the line.

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