geometric::line< numeric_type > Class Template Reference

Represents a geometric line segment. More...

#include <line.h>

List of all members.

Public Member Functions

 line (const point< numeric_type > &endpoint1, const point< numeric_type > &endpoint2)
 line (numeric_type end1_x=0, numeric_type end1_y=0, numeric_type end2_x=0, numeric_type end2_y=0)
point< numeric_type > center () const
 Returns the point at the center of the line segment.
line operator+ (const point< numeric_type > &to_add) const
line operator- (const point< numeric_type > &to_subtract) const
 Returns this line with "to_add" added to it.
lineoperator+= (const point< numeric_type > &to_add)
lineoperator-= (const point< numeric_type > &to_subtract)
 Adds or subtracts a point from `this' line.
point< numeric_type > endpoint_1 () const
point< numeric_type > endpoint_2 () const
void endpoint_1 (const point< numeric_type > &to_set)
void endpoint_2 (const point< numeric_type > &to_set)
istring text_form () const
 returns a string form of the points defining the line.

Protected Attributes

point< numeric_type > _endpoint_1
point< numeric_type > _endpoint_2


Detailed Description

template<class numeric_type>
class geometric::line< numeric_type >

Represents a geometric line segment.

Definition at line 25 of file line.h.


Constructor & Destructor Documentation

template<class numeric_type>
geometric::line< numeric_type >::line ( const point< numeric_type > &  endpoint1,
const point< numeric_type > &  endpoint2 
)

Definition at line 24 of file line.cpp.

template<class numeric_type>
geometric::line< numeric_type >::line ( numeric_type  end1_x = 0,
numeric_type  end1_y = 0,
numeric_type  end2_x = 0,
numeric_type  end2_y = 0 
)

Definition at line 29 of file line.cpp.


Member Function Documentation

template<class numeric_type>
point< numeric_type > geometric::line< numeric_type >::center (  )  const

Returns the point at the center of the line segment.

Definition at line 36 of file line.cpp.

References geometric::line< numeric_type >::_endpoint_1, and geometric::line< numeric_type >::_endpoint_2.

template<class numeric_type>
line< numeric_type > geometric::line< numeric_type >::operator+ ( const point< numeric_type > &  to_add  )  const

Definition at line 61 of file line.cpp.

template<class numeric_type>
line< numeric_type > geometric::line< numeric_type >::operator- ( const point< numeric_type > &  to_subtract  )  const

Returns this line with "to_add" added to it.

This returns a line that is the result of adding or subtracting a point to the endpoints of this line.

Definition at line 66 of file line.cpp.

template<class numeric_type>
line< numeric_type > & geometric::line< numeric_type >::operator+= ( const point< numeric_type > &  to_add  ) 

Definition at line 51 of file line.cpp.

template<class numeric_type>
line< numeric_type > & geometric::line< numeric_type >::operator-= ( const point< numeric_type > &  to_subtract  ) 

Adds or subtracts a point from `this' line.

Definition at line 56 of file line.cpp.

template<class numeric_type>
point< numeric_type > geometric::line< numeric_type >::endpoint_1 (  )  const

Definition at line 74 of file line.cpp.

References geometric::line< numeric_type >::_endpoint_1.

template<class numeric_type>
point< numeric_type > geometric::line< numeric_type >::endpoint_2 (  )  const

Definition at line 78 of file line.cpp.

References geometric::line< numeric_type >::_endpoint_2.

template<class numeric_type>
void geometric::line< numeric_type >::endpoint_1 ( const point< numeric_type > &  to_set  ) 

Definition at line 82 of file line.cpp.

References geometric::line< numeric_type >::_endpoint_1.

template<class numeric_type>
void geometric::line< numeric_type >::endpoint_2 ( const point< numeric_type > &  to_set  ) 

Definition at line 86 of file line.cpp.

References geometric::line< numeric_type >::_endpoint_2.

template<class numeric_type>
istring geometric::line< numeric_type >::text_form (  )  const

returns a string form of the points defining the line.

Definition at line 43 of file line.cpp.

References geometric::line< numeric_type >::_endpoint_1, and geometric::line< numeric_type >::_endpoint_2.


Member Data Documentation

template<class numeric_type>
point<numeric_type> geometric::line< numeric_type >::_endpoint_1 [protected]

Definition at line 56 of file line.h.

Referenced by geometric::line< numeric_type >::center(), geometric::line< numeric_type >::endpoint_1(), and geometric::line< numeric_type >::text_form().

template<class numeric_type>
point<numeric_type> geometric::line< numeric_type >::_endpoint_2 [protected]

Definition at line 57 of file line.h.

Referenced by geometric::line< numeric_type >::center(), geometric::line< numeric_type >::endpoint_2(), and geometric::line< numeric_type >::text_form().


The documentation for this class was generated from the following files:
Generated on Fri Nov 28 04:31:06 2008 for HOOPLE Libraries by  doxygen 1.5.1