feisty meow concerns codebase
2.140
|
Represents a geometric point. More...
#include <point.h>
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". More... | |
numeric_type | distance (const point &p2) const |
Returns the distance between ‘this’ and the second point ‘p2’. More... | |
point | operator- () const |
return the additive inverse of the vector More... | |
numeric_type | magnitude () const |
return the distance from the origin to this point. More... | |
point | operator+ (const point &arg2) const |
point | operator- (const point &arg2) const |
point & | operator+= (const point &arg2) |
point & | operator-= (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. More... | |
bool | from_text (const basis::astring &text) |
returns true if the "text" is successfully pulled into this point. More... | |
virtual void | pack (basis::byte_array &packed_form) const |
Creates a packed form of the packable object in "packed_form". More... | |
virtual bool | unpack (basis::byte_array &packed_form) |
Restores the packable from the "packed_form". More... | |
int | packed_size () const |
Estimates the space needed for the packed structure. More... | |
Represents a geometric point.
geometric::point< numeric_type >::point | ( | numeric_type | x = 0 , |
numeric_type | y = 0 |
||
) |
geometric::point< numeric_type >::point | ( | numeric_type | r, |
double_angle | theta | ||
) |
geometric::point< numeric_type >::DEFINE_CLASS_NAME | ( | "point< 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 133 of file point.h.
References basis::square(), geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().
Referenced by geometric::circle::inside(), and geometric::ellipse::inside().
bool geometric::point< numeric_type >::from_text | ( | const basis::astring & | text | ) |
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(), and geometric::crop_numeric().
numeric_type geometric::point< numeric_type >::magnitude |
return the distance from the origin to this point.
Definition at line 171 of file point.h.
References basis::square().
point< numeric_type > geometric::point< numeric_type >::operator+ | ( | const point< numeric_type > & | arg2 | ) | const |
Definition at line 178 of file point.h.
References geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().
point< numeric_type > & geometric::point< numeric_type >::operator+= | ( | const point< numeric_type > & | arg2 | ) |
Definition at line 186 of file point.h.
References geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().
|
inline |
point< numeric_type > geometric::point< numeric_type >::operator- | ( | const point< numeric_type > & | arg2 | ) | const |
Definition at line 182 of file point.h.
References geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().
point< numeric_type > & geometric::point< numeric_type >::operator-= | ( | const point< numeric_type > & | arg2 | ) |
Definition at line 190 of file point.h.
References geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().
bool geometric::point< numeric_type >::operator== | ( | const point< numeric_type > & | arg2 | ) | const |
Definition at line 194 of file point.h.
References basis::absolute_value(), geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().
|
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 structures::attach().
|
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 structures::pack().
numeric_type geometric::point< numeric_type >::r |
Definition at line 122 of file point.h.
References basis::square().
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 203 of file point.h.
References geometric::angle< contents >::cosine(), and geometric::angle< contents >::sine().
void geometric::point< numeric_type >::set | ( | numeric_type | r, |
double_angle | theta | ||
) |
Definition at line 129 of file point.h.
References geometric::angle< contents >::cosine(), and geometric::angle< contents >::sine().
void geometric::point< numeric_type >::set | ( | numeric_type | x, |
numeric_type | y | ||
) |
Definition at line 118 of file point.h.
Referenced by geometric::ellipse::location().
basis::astring geometric::point< numeric_type >::text_form |
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(), and basis::astring::SPRINTF.
double_angle geometric::point< numeric_type >::theta |
Definition at line 140 of file point.h.
References geometric::angle< double >::arctangent().
|
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().
|
inline |
Definition at line 47 of file point.h.
Referenced by geometric::circle::dimensions(), geometric::point< numeric_type >::distance(), geometric::polygon::inside(), geometric::triangle::inside(), geometric::rectangle< numeric_type >::inside(), geometric::screen_rectangle::left(), geometric::ellipse::location(), 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==(), and geometric::screen_rectangle::right().
|
inline |
Definition at line 48 of file point.h.
Referenced by geometric::screen_rectangle::bottom(), geometric::circle::dimensions(), geometric::point< numeric_type >::distance(), geometric::polygon::inside(), geometric::ellipse::inside(), geometric::triangle::inside(), geometric::rectangle< numeric_type >::inside(), geometric::ellipse::location(), 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==(), and geometric::screen_rectangle::top().