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)
 IMPLEMENT_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
bool operator!= (const point &arg2) const
istring text_form () const
 Prints out the two values (x and y) held in the point.
bool from_text (const istring &text)
 returns true if the "text" is successfully pulled into this point.
virtual void pack (byte_array &packed_form) const
 Creates a packed form of the packable object in "packed_form".
virtual bool unpack (byte_array &packed_form)
 Restores the packable from the "packed_form".

Detailed Description

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

Represents a geometric point.

Definition at line 29 of file point.h.


Constructor & Destructor Documentation

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

Definition at line 37 of file point.cpp.

References geometric::point< numeric_type >::set().

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

Definition at line 40 of file point.cpp.

References geometric::point< numeric_type >::set(), and geometric::point< numeric_type >::theta().


Member Function Documentation

template<class numeric_type>
geometric::point< numeric_type >::IMPLEMENT_CLASS_NAME ( "point< numeric_type >"   ) 

template<class numeric_type>
void geometric::point< numeric_type >::set ( numeric_type  x,
numeric_type  y 
)

Definition at line 53 of file point.cpp.

Referenced by geometric::point< numeric_type >::from_text(), geometric::ellipse::location(), geometric::point< numeric_type >::point(), and geometric::point< numeric_type >::set().

template<class numeric_type>
void geometric::point< numeric_type >::set ( numeric_type  r,
double_angle  theta 
)

Definition at line 64 of file point.cpp.

References geometric::angle< contents >::cosine(), geometric::point< numeric_type >::set(), geometric::angle< contents >::sine(), and geometric::point< numeric_type >::theta().

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

Definition at line 40 of file point.h.

Referenced by drawing_window::add_dot(), tiny_shell::Create(), geometric::circle::dimensions(), geometric::point< numeric_type >::distance(), EVT_COMMAND(), geometric::point< numeric_type >::from_text(), geometric::triangle::inside(), geometric::rectangle< numeric_type >::inside(), geometric::polygon::inside(), geometric::ellipse::location(), geometric::point< numeric_type >::magnitude(), geometric::point< numeric_type >::operator+(), geometric::point< numeric_type >::operator+=(), geometric::point< numeric_type >::operator-(), geometric::point< numeric_type >::operator-=(), geometric::point< numeric_type >::operator==(), geometric::point< numeric_type >::r(), geometric::point< numeric_type >::text_form(), and geometric::point< numeric_type >::theta().

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

Definition at line 41 of file point.h.

Referenced by drawing_window::add_dot(), tiny_shell::Create(), geometric::circle::dimensions(), geometric::point< numeric_type >::distance(), EVT_COMMAND(), geometric::point< numeric_type >::from_text(), geometric::triangle::inside(), geometric::rectangle< numeric_type >::inside(), geometric::polygon::inside(), geometric::ellipse::inside(), geometric::ellipse::location(), geometric::point< numeric_type >::magnitude(), geometric::point< numeric_type >::operator+(), geometric::point< numeric_type >::operator+=(), geometric::point< numeric_type >::operator-(), geometric::point< numeric_type >::operator-=(), geometric::point< numeric_type >::operator==(), geometric::point< numeric_type >::r(), geometric::point< numeric_type >::text_form(), and geometric::point< numeric_type >::theta().

template<class numeric_type>
numeric_type geometric::point< numeric_type >::r (  )  const

Definition at line 57 of file point.cpp.

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

template<class numeric_type>
double_angle geometric::point< numeric_type >::theta (  )  const

Definition at line 75 of file point.cpp.

References geometric::angle< double >::arctangent(), geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().

Referenced by geometric::point< numeric_type >::point(), and geometric::point< numeric_type >::set().

template<class numeric_type>
point< numeric_type > geometric::point< numeric_type >::rotate ( const double_angle theta  )  const

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 135 of file point.cpp.

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

template<class numeric_type>
numeric_type geometric::point< numeric_type >::distance ( const point< numeric_type > &  p2  )  const

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

Definition at line 68 of file point.cpp.

References 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>
point geometric::point< numeric_type >::operator- ( void   )  const [inline]

return the additive inverse of the vector

Definition at line 56 of file point.h.

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

return the distance from the origin to this point.

Definition at line 97 of file point.cpp.

References 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

Definition at line 104 of file point.cpp.

References 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

Definition at line 108 of file point.cpp.

References 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  ) 

Definition at line 112 of file point.cpp.

References 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  ) 

Definition at line 116 of file point.cpp.

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

template<class numeric_type>
bool geometric::point< numeric_type >::operator== ( const point< numeric_type > &  arg2  )  const

Definition at line 120 of file point.cpp.

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

template<class numeric_type>
bool geometric::point< numeric_type >::operator!= ( const point< numeric_type > &  arg2  )  const

Definition at line 130 of file point.cpp.

template<class numeric_type>
istring geometric::point< numeric_type >::text_form (  )  const [virtual]

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

Reimplemented from object_base.

Definition at line 44 of file point.cpp.

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

Referenced by example_rpc_client::mouse_hit().

template<class numeric_type>
bool geometric::point< numeric_type >::from_text ( const istring text  ) 

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

Definition at line 147 of file point.cpp.

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

template<class contents>
void geometric::point< contents >::pack ( byte_array packed_form  )  const [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 packable.

Definition at line 82 of file point.cpp.

References basis::attach().

template<class contents>
bool geometric::point< contents >::unpack ( byte_array packed_form  )  [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 packable.

Definition at line 89 of file point.cpp.

References basis::detach().


The documentation for this class was generated from the following files:
Generated on Fri Oct 10 04:30:41 2008 for HOOPLE Libraries by  doxygen 1.5.1