geometric::point< numeric_type > Class Template Reference

Represents a geometric point. More...

#include <point.h>

Inheritance diagram for geometric::point< numeric_type >:
Inheritance graph
[legend]
Collaboration diagram for geometric::point< numeric_type >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 point (numeric_type x=0, numeric_type y=0)
 point (numeric_type r, double_angle theta)
 DEFINE_CLASS_NAME ("point")
void set (numeric_type x, numeric_type y)
void set (numeric_type r, double_angle theta)
numeric_type x () const
numeric_type y () const
numeric_type r () const
double_angle theta () const
point rotate (const double_angle &theta) const
 Rotates the point by the angle "theta".
numeric_type distance (const point &p2) const
 Returns the distance between `this' and the second point `p2'.
point operator- () const
 return the additive inverse of the vector
numeric_type magnitude () const
 return the distance from the origin to this point.
point operator+ (const point &arg2) const
point operator- (const point &arg2) const
pointoperator+= (const point &arg2)
pointoperator-= (const point &arg2)
bool operator== (const point &arg2) const
basis::astring text_form () const
 Prints out the two values (x and y) held in the point.
bool from_text (const basis::astring &text)
 returns true if the "text" is successfully pulled into this point.
virtual void pack (basis::byte_array &packed_form) const
 Creates a packed form of the packable object in "packed_form".
virtual bool unpack (basis::byte_array &packed_form)
 Restores the packable from the "packed_form".
int packed_size () const
 Estimates the space needed for the packed structure.

Detailed Description

template<class numeric_type>
class geometric::point< numeric_type >

Represents a geometric point.

Definition at line 36 of file point.h.


Constructor & Destructor Documentation

template<class numeric_type>
geometric::point< numeric_type >::point ( numeric_type  x = 0,
numeric_type  y = 0 
) [inline]

Definition at line 102 of file point.h.

template<class numeric_type>
geometric::point< numeric_type >::point ( numeric_type  r,
double_angle  theta 
) [inline]

Definition at line 105 of file point.h.


Member Function Documentation

template<class numeric_type>
geometric::point< numeric_type >::DEFINE_CLASS_NAME ( "point< numeric_type >"   ) 
template<class numeric_type >
numeric_type geometric::point< numeric_type >::distance ( const point< numeric_type > &  p2  )  const [inline]

Returns the distance between `this' and the second point `p2'.

Definition at line 133 of file point.h.

References basis::square(), geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().

Referenced by geometric::ellipse::inside(), and geometric::circle::inside().

template<class numeric_type >
bool geometric::point< numeric_type >::from_text ( const basis::astring text  )  [inline]

returns true if the "text" is successfully pulled into this point.

Definition at line 216 of file point.h.

References basis::astring::convert(), geometric::crop_non_numeric(), geometric::crop_numeric(), geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().

template<class numeric_type >
numeric_type geometric::point< numeric_type >::magnitude (  )  const [inline]

return the distance from the origin to this point.

Definition at line 171 of file point.h.

References basis::square(), geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().

template<class numeric_type >
point< numeric_type > geometric::point< numeric_type >::operator+ ( const point< numeric_type > &  arg2  )  const [inline]
template<class numeric_type >
point< numeric_type > & geometric::point< numeric_type >::operator+= ( const point< numeric_type > &  arg2  )  [inline]
template<class numeric_type >
point< numeric_type > geometric::point< numeric_type >::operator- ( const point< numeric_type > &  arg2  )  const [inline]
template<class numeric_type>
point geometric::point< numeric_type >::operator- ( void   )  const [inline]

return the additive inverse of the vector

Definition at line 63 of file point.h.

template<class numeric_type >
point< numeric_type > & geometric::point< numeric_type >::operator-= ( const point< numeric_type > &  arg2  )  [inline]
template<class numeric_type >
bool geometric::point< numeric_type >::operator== ( const point< numeric_type > &  arg2  )  const [inline]
template<class contents >
void geometric::point< contents >::pack ( basis::byte_array packed_form  )  const [inline, virtual]

Creates a packed form of the packable object in "packed_form".

This must append to the data in "packed_form" rather than clearing prior contents.

Implements basis::packable.

Definition at line 156 of file point.h.

References basis::attach().

Referenced by geometric::point< numeric_type >::packed_size().

template<class contents >
int geometric::point< contents >::packed_size (  )  const [inline, virtual]

Estimates the space needed for the packed structure.

Implements basis::packable.

Definition at line 147 of file point.h.

References basis::array< contents >::length(), and geometric::point< numeric_type >::pack().

template<class numeric_type >
numeric_type geometric::point< numeric_type >::r (  )  const [inline]
template<class numeric_type >
point< numeric_type > geometric::point< numeric_type >::rotate ( const double_angle theta  )  const [inline]

Rotates the point by the angle "theta".

This rotates the position of the point around the origin in the trigonometric standard manner; zero degrees is at the right, increasing degree angles are counterclockwise from the x axis to the y to the -x to the -y ....

Definition at line 204 of file point.h.

References geometric::angle< contents >::cosine(), and geometric::angle< contents >::sine().

template<class numeric_type>
void geometric::point< numeric_type >::set ( numeric_type  r,
double_angle  theta 
) [inline]
template<class numeric_type>
void geometric::point< numeric_type >::set ( numeric_type  x,
numeric_type  y 
) [inline]

Definition at line 118 of file point.h.

Referenced by geometric::ellipse::location().

template<class numeric_type >
basis::astring geometric::point< numeric_type >::text_form (  )  const [inline]

Prints out the two values (x and y) held in the point.

Definition at line 109 of file point.h.

References geometric::numeric_specifier(), basis::astring::s(), basis::astring::SPRINTF, geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().

template<class numeric_type >
double_angle geometric::point< numeric_type >::theta (  )  const [inline]
template<class contents >
bool geometric::point< contents >::unpack ( basis::byte_array packed_form  )  [inline, virtual]

Restores the packable from the "packed_form".

This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.

Implements basis::packable.

Definition at line 163 of file point.h.

References structures::detach().

template<class numeric_type>
numeric_type geometric::point< numeric_type >::x (  )  const [inline]
template<class numeric_type>
numeric_type geometric::point< numeric_type >::y (  )  const [inline]

The documentation for this class was generated from the following file:
Generated on Sat Jan 28 04:25:35 2012 for hoople2 project by  doxygen 1.6.3