Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
castor::Line3D< T > Class Template Reference

3D line equation More...

#include <Line3D.hpp>

Collaboration diagram for castor::Line3D< T >:
Collaboration graph
[legend]

Public Member Functions

bool intersects (Line3D const &line, Point< T, 3 > &point)
 Computes intersection between this line and another one.
 
bool isIn (Point< T, 3 > const &point)
 Tests if a point belongs to the line.
 

Static Public Member Functions

static Line3D< T > fromPointAndSlope (Point< T, 3 > const &point, Point< T, 3 > const &slope)
 Constructor from 2 points.
 
static Line3D< T > fromPoints (Point< T, 3 > const &a, Point< T, 3 > const &b)
 Constructor from 2 points.
 

Public Attributes

Point< T, 3 > m_slope
 
Point< T, 3 > m_origin
 

Detailed Description

template<typename T>
class castor::Line3D< T >

3D line equation

Remarks
A slope and an origin
x = m_slope[0] * t + m_origin[0]
y = m_slope[1] * t + m_origin[1]
z = m_slope[2] * t + m_origin[2]

Member Function Documentation

◆ fromPointAndSlope()

template<typename T >
static Line3D< T > castor::Line3D< T >::fromPointAndSlope ( Point< T, 3 > const & point,
Point< T, 3 > const & slope )
inlinestatic

Constructor from 2 points.

Parameters
[in]pointA point on the line
[in]slopeThe line slope

◆ fromPoints()

template<typename T >
static Line3D< T > castor::Line3D< T >::fromPoints ( Point< T, 3 > const & a,
Point< T, 3 > const & b )
inlinestatic

Constructor from 2 points.

Parameters
[in]a,bTwo points on the line

◆ intersects()

template<typename T >
bool castor::Line3D< T >::intersects ( Line3D< T > const & line,
Point< T, 3 > & point )
inline

Computes intersection between this line and another one.

Parameters
[in]lineThe other line
[out]pointReceives the intersection point
Returns
true if an intersection exists

References castor::Line3D< T >::m_origin, and castor::Line3D< T >::m_slope.

◆ isIn()

template<typename T >
bool castor::Line3D< T >::isIn ( Point< T, 3 > const & point)
inline

Tests if a point belongs to the line.

Parameters
[in]pointThe point to test
Returns
true if the point belongs to the line

References castor::Line3D< T >::m_origin, and castor::Line3D< T >::m_slope.

Member Data Documentation

◆ m_origin

template<typename T >
Point< T, 3 > castor::Line3D< T >::m_origin

The origin point.

Referenced by castor::Line3D< T >::intersects(), and castor::Line3D< T >::isIn().

◆ m_slope

template<typename T >
Point< T, 3 > castor::Line3D< T >::m_slope

The slope point.

Referenced by castor::Line3D< T >::intersects(), and castor::Line3D< T >::isIn().


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