Public Member Functions

gmtl::LineSeg< DATA_TYPE > Class Template Reference

Describes a line segment. More...

#include <LineSeg.h>

Inheritance diagram for gmtl::LineSeg< DATA_TYPE >:
Inheritance graph
[legend]
Collaboration diagram for gmtl::LineSeg< DATA_TYPE >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LineSeg ()
 Constructs a line segment at the origin with a zero vector.
 LineSeg (const Point< DATA_TYPE, 3 > &origin, const Vec< DATA_TYPE, 3 > &dir)
 Constructs a line segment with the given origin and vector.
 LineSeg (const LineSeg &ray)
 Constructs an exact duplicate of the given line segment.
 LineSeg (const Point< DATA_TYPE, 3 > &beg, const Point< DATA_TYPE, 3 > &end)
 Constructs a line segment with the given beginning and ending points.
DATA_TYPE getLength () const
 Gets the length of this line segment.

Detailed Description

template<typename DATA_TYPE>
class gmtl::LineSeg< DATA_TYPE >

Describes a line segment.

This is represented by a point origin O and a vector spanning the length of the line segement originating at O. Thus any point on the line segment can be described as

P(s) = O + Vs

where 0 <= s <= 1

Parameters:
DATA_TYPE the internal type used for the point and vector

Definition at line 28 of file LineSeg.h.


Constructor & Destructor Documentation

template<typename DATA_TYPE>
gmtl::LineSeg< DATA_TYPE >::LineSeg (  )  [inline]

Constructs a line segment at the origin with a zero vector.

Definition at line 34 of file LineSeg.h.

   {}

template<typename DATA_TYPE>
gmtl::LineSeg< DATA_TYPE >::LineSeg ( const Point< DATA_TYPE, 3 > &  origin,
const Vec< DATA_TYPE, 3 > &  dir 
) [inline]

Constructs a line segment with the given origin and vector.

Parameters:
origin the point at which the line segment starts
dir the vector describing the direction and length of the line segment starting at origin

Definition at line 44 of file LineSeg.h.

      : Ray<DATA_TYPE>( origin, dir )
   {}

template<typename DATA_TYPE>
gmtl::LineSeg< DATA_TYPE >::LineSeg ( const LineSeg< DATA_TYPE > &  ray  )  [inline]

Constructs an exact duplicate of the given line segment.

Parameters:
ray the line segment to copy

Definition at line 53 of file LineSeg.h.

                                 : Ray<DATA_TYPE>( ray )
   {
   }

template<typename DATA_TYPE>
gmtl::LineSeg< DATA_TYPE >::LineSeg ( const Point< DATA_TYPE, 3 > &  beg,
const Point< DATA_TYPE, 3 > &  end 
) [inline]

Constructs a line segment with the given beginning and ending points.

Parameters:
beg the point at the beginning of the line segment
end the point at the end of the line segment

Definition at line 63 of file LineSeg.h.

      : Ray<DATA_TYPE>()
   {
      this->mOrigin = beg;
      this->mDir = end - beg;
   }


Member Function Documentation

template<typename DATA_TYPE>
DATA_TYPE gmtl::LineSeg< DATA_TYPE >::getLength (  )  const [inline]

Gets the length of this line segment.

Returns:
the length of the line segment

Definition at line 74 of file LineSeg.h.

   {
      return length(this->mDir);
   }


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