g4tools  5.4.0
Public Member Functions | Protected Types | Protected Attributes | List of all members
tools::line< VEC3 > Class Template Reference

Public Member Functions

 line ()
 
 line (const VEC3 &a_p0, const VEC3 &a_p1)
 
 line (const T &a_0_x, const T &a_0_y, const T &a_0_z, const T &a_1_x, const T &a_1_y, const T &a_1_z)
 
virtual ~line ()
 
 line (const line &a_from)
 
lineoperator= (const line &a_from)
 
void set_value (const VEC3 &a_p0, const VEC3 &a_p1)
 
void set_value (const T &a_0_x, const T &a_0_y, const T &a_0_z, const T &a_1_x, const T &a_1_y, const T &a_1_z)
 
const VEC3 & position () const
 
const VEC3 & direction () const
 

Protected Types

typedef VEC3::elem_t T
 

Protected Attributes

VEC3 m_pos
 
VEC3 m_dir
 

Detailed Description

template<class VEC3>
class tools::line< VEC3 >

Definition at line 13 of file line.

Member Typedef Documentation

◆ T

template<class VEC3 >
typedef VEC3::elem_t tools::line< VEC3 >::T
protected

Definition at line 15 of file line.

Constructor & Destructor Documentation

◆ line() [1/4]

template<class VEC3 >
tools::line< VEC3 >::line ( )
inline

Definition at line 17 of file line.

17 {}

◆ line() [2/4]

template<class VEC3 >
tools::line< VEC3 >::line ( const VEC3 &  a_p0,
const VEC3 &  a_p1 
)
inline

Definition at line 18 of file line.

18  {
19  // Construct a line from two points lying on the line. If you
20  // want to construct a line from a position and a direction, use
21  // line(p, p + d).
22  // line is directed from p0 to p1.
23  m_pos = a_p0;
24  //m_dir = a_p1-a_p0;
25  m_dir = a_p0;
26  m_dir.multiply(-1);
27  m_dir.add(a_p1);
28  m_dir.normalize();
29  }

◆ line() [3/4]

template<class VEC3 >
tools::line< VEC3 >::line ( const T a_0_x,
const T a_0_y,
const T a_0_z,
const T a_1_x,
const T a_1_y,
const T a_1_z 
)
inline

Definition at line 30 of file line.

31  {
32  m_pos.set_value(a_0_x,a_0_y,a_0_z);
33  m_dir.set_value(a_1_x-a_0_x,a_1_y-a_0_y,a_1_z-a_0_z);
34  m_dir.normalize();
35  }

◆ ~line()

template<class VEC3 >
virtual tools::line< VEC3 >::~line ( )
inlinevirtual

Definition at line 36 of file line.

36 {}

◆ line() [4/4]

template<class VEC3 >
tools::line< VEC3 >::line ( const line< VEC3 > &  a_from)
inline

Definition at line 38 of file line.

39  :m_pos(a_from.m_pos)
40  ,m_dir(a_from.m_dir)
41  {}

Member Function Documentation

◆ direction()

template<class VEC3 >
const VEC3& tools::line< VEC3 >::direction ( ) const
inline

Definition at line 63 of file line.

63 {return m_dir;}

◆ operator=()

template<class VEC3 >
line& tools::line< VEC3 >::operator= ( const line< VEC3 > &  a_from)
inline

Definition at line 42 of file line.

42  {
43  m_pos = a_from.m_pos;
44  m_dir = a_from.m_dir;
45  return *this;
46  }

◆ position()

template<class VEC3 >
const VEC3& tools::line< VEC3 >::position ( ) const
inline

Definition at line 62 of file line.

62 {return m_pos;}

◆ set_value() [1/2]

template<class VEC3 >
void tools::line< VEC3 >::set_value ( const T a_0_x,
const T a_0_y,
const T a_0_z,
const T a_1_x,
const T a_1_y,
const T a_1_z 
)
inline

Definition at line 55 of file line.

56  {
57  m_pos.set_value(a_0_x,a_0_y,a_0_z);
58  m_dir.set_value(a_1_x-a_0_x,a_1_y-a_0_y,a_1_z-a_0_z);
59  m_dir.normalize();
60  }

◆ set_value() [2/2]

template<class VEC3 >
void tools::line< VEC3 >::set_value ( const VEC3 &  a_p0,
const VEC3 &  a_p1 
)
inline

Definition at line 48 of file line.

48  {
49  m_pos = a_p0;
50  m_dir = a_p0;
51  m_dir.multiply(-1);
52  m_dir.add(a_p1);
53  m_dir.normalize();
54  }

Member Data Documentation

◆ m_dir

template<class VEC3 >
VEC3 tools::line< VEC3 >::m_dir
protected

Definition at line 127 of file line.

◆ m_pos

template<class VEC3 >
VEC3 tools::line< VEC3 >::m_pos
protected

Definition at line 126 of file line.


The documentation for this class was generated from the following file:
tools::line::m_dir
VEC3 m_dir
Definition: line:127
tools::line::m_pos
VEC3 m_pos
Definition: line:126