Back to index

nux  3.0.0
Public Member Functions | Private Attributes
nux::Line2D< T > Class Template Reference

#include <Line2D.h>

Collaboration diagram for nux::Line2D< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Line2D ()
 ~Line2D ()
 Line2D (const Line2D &line)
 Line2D (T lx_start, T ly_start, T lz_start, T lx_end, T ly_end, T lz_end)
 Line2D (const Vec2< T > &pt, Vec2< T > v)
const Line2D< T > & operator= (const Line2D< T > &)
bool operator== (const Line2D< T > &line) const
float Length () const
const Vec2< T > GetDirectionVector () const
const Vec2< T > GetStartPoint () const
const Vec2< T > GetEndPoint () const

Private Attributes

x_start
y_start
x_end
y_end

Detailed Description

template<typename T>
class nux::Line2D< T >

Definition at line 32 of file Line2D.h.


Constructor & Destructor Documentation

template<typename T >
nux::Line2D< T >::Line2D ( )

Definition at line 57 of file Line2D.h.

  {
    x_start = y_start = x_end = y_end = 0;
  }
template<typename T >
nux::Line2D< T >::~Line2D ( )

Definition at line 63 of file Line2D.h.

  {

  }
template<typename T >
nux::Line2D< T >::Line2D ( const Line2D< T > &  line)

Definition at line 69 of file Line2D.h.

  {
    x_start = line.x_start;
    x_end   = line.x_end;
    y_start = line.y_start;
    y_end   = line.y_end;
  }
template<typename T >
nux::Line2D< T >::Line2D ( lx_start,
ly_start,
lz_start,
lx_end,
ly_end,
lz_end 
)

Definition at line 78 of file Line2D.h.

  {
    x_start = lx_start;
    x_end   = lx_end;
    y_start = ly_start;
    y_end   = ly_end;
  }
template<typename T >
nux::Line2D< T >::Line2D ( const Vec2< T > &  pt,
Vec2< T >  v 
)

Definition at line 88 of file Line2D.h.

  {
    x_start = pt.x;
    y_start = pt.y;

    x_end   = x_start + v.x;
    y_end   = y_start + v.y;
  }

Member Function Documentation

template<typename T >
const Vec2< T > nux::Line2D< T >::GetDirectionVector ( ) const

Definition at line 132 of file Line2D.h.

  {
    return Vec2<T> (x_start - x_end, y_start - y_end);
  }
template<typename T >
const Vec2< T > nux::Line2D< T >::GetEndPoint ( ) const

Definition at line 145 of file Line2D.h.

  {
    Vec2<T> p (x_end, y_end);
    return p;
  }
template<typename T >
const Vec2< T > nux::Line2D< T >::GetStartPoint ( ) const

Definition at line 138 of file Line2D.h.

  {
    Vec2<T> p (x_start, y_start);
    return p;
  }
template<typename T >
float nux::Line2D< T >::Length ( ) const

Definition at line 123 of file Line2D.h.

  {
    float l;
    l = (float) std::sqrt ( (x_end - x_start) * (x_end - x_start) + (y_end - y_start) * (y_end - y_start) );

    return l;
  }
template<typename T >
const Line2D< T > & nux::Line2D< T >::operator= ( const Line2D< T > &  Line)

Definition at line 98 of file Line2D.h.

  {
    x_start = Line.x_start;
    x_end = Line.x_end;
    y_start = Line.y_start;
    y_end = Line.y_end;
  }
template<typename T >
bool nux::Line2D< T >::operator== ( const Line2D< T > &  line) const

Definition at line 107 of file Line2D.h.

  {
    if ( (x_start  == line.x_start) &&
         (y_start == line.y_start) &&
         (x_end   == line.x_end)   &&
         (y_end   == line.y_end) )
    {
      return true;
    }
    else
    {
      return false;
    }
  }

Member Data Documentation

template<typename T>
T nux::Line2D< T >::x_end [private]

Definition at line 52 of file Line2D.h.

template<typename T>
T nux::Line2D< T >::x_start [private]

Definition at line 51 of file Line2D.h.

template<typename T>
T nux::Line2D< T >::y_end [private]

Definition at line 52 of file Line2D.h.

template<typename T>
T nux::Line2D< T >::y_start [private]

Definition at line 51 of file Line2D.h.


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