feisty meow concerns codebase  2.140
geometric::point< numeric_type > Class Template Reference

Represents a geometric point. More...

#include <point.h>

Inheritance diagram for geometric::point< numeric_type >:
Collaboration diagram for geometric::point< numeric_type >:

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
 
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. 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...
 

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

◆ point() [1/2]

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

Definition at line 102 of file point.h.

◆ point() [2/2]

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

Definition at line 105 of file point.h.

Member Function Documentation

◆ DEFINE_CLASS_NAME()

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

◆ distance()

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 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().

◆ from_text()

template<class numeric_type >
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().

◆ magnitude()

template<class numeric_type >
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().

◆ operator+()

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

◆ operator+=()

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

◆ operator-() [1/2]

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.

◆ operator-() [2/2]

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

◆ operator-=()

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

◆ operator==()

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

◆ pack()

template<class contents >
void geometric::point< contents >::pack ( basis::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 basis::packable.

Definition at line 156 of file point.h.

References structures::attach().

◆ packed_size()

template<class contents >
int geometric::point< contents >::packed_size ( ) const
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().

◆ r()

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

Definition at line 122 of file point.h.

References basis::square().

◆ rotate()

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 203 of file point.h.

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

◆ set() [1/2]

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

◆ set() [2/2]

template<class numeric_type >
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().

◆ text_form()

template<class numeric_type >
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.

◆ theta()

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

Definition at line 140 of file point.h.

References geometric::angle< double >::arctangent().

◆ unpack()

template<class contents >
bool geometric::point< contents >::unpack ( basis::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 basis::packable.

Definition at line 163 of file point.h.

References structures::detach().

◆ x()

◆ y()


The documentation for this class was generated from the following file: