Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

gmtl::LineSeg Class Template Reference

Describes a line segment. More...

#include <LineSeg.h>

Inheritance diagram for gmtl::LineSeg:

Inheritance graph
[legend]
Collaboration diagram for gmtl::LineSeg:

Collaboration graph
[legend]
List of all members.

Public Methods

 LineSeg ()
 Constructs a line segment at the origin with a zero vector. More...

 LineSeg (const Point< DATA_TYPE, 3 > &origin, const Vec< DATA_TYPE, 3 > &dir)
 Constructs a line segment with the given origin and vector. More...

 LineSeg (const LineSeg &ray)
 Constructs an exact duplicate of the given line segment. More...

 LineSeg (const Point< DATA_TYPE, 3 > &beg, const Point< DATA_TYPE, 3 > &end)
 Constructs a line segment with the given beginning and ending points. More...

DATA_TYPE getLength () const
 Gets the length of this line segment. More...


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 57 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 63 of file LineSeg.h.

Referenced by LineSeg.

00064    {}

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 73 of file LineSeg.h.

References gmtl::Ray::Ray.

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

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 82 of file LineSeg.h.

References LineSeg, and gmtl::Ray::Ray.

00082                                  : Ray<DATA_TYPE>( ray )
00083    {
00084    }

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 92 of file LineSeg.h.

References gmtl::Ray::mDir, gmtl::Ray::mOrigin, and gmtl::Ray::Ray.

00093       : Ray<DATA_TYPE>()
00094    {
00095       this->mOrigin = beg;
00096       this->mDir = end - beg;
00097    }


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 103 of file LineSeg.h.

References gmtl::length.

00104    {
00105       return length(this->mDir);
00106    }


The documentation for this class was generated from the following file:
Generated on Mon Apr 7 15:29:28 2003 for GenericMathTemplateLibrary by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002