Files Classes Functions Hierarchy
2D point. More...
#include <point.h>


Public Member Functions | |
| point2 () | |
| Set the default values to zero. | |
| point2 (T x0, T y0) | |
| Construct a 2D point. | |
| operator stringc () const | |
| Write out a point as a string. | |
| void | serializeInverse (stringc &s) |
| Interpret or read in the point. | |
| void | serializeInverseBrackets (stringc &s) |
| Read the point in that is in human friendly format with brackets and a comma from the string. | |
| ostream & | print (ostream &os) const |
| Write out the point. | |
| istream & | serializeInverse (istream &istr) |
| Read in a point from a stream. | |
| point2< T > & | operator+= (point2< T > const &p) |
| Modify this point by adding to itself. | |
| point2< T > const | operator+ (point2< T > const &p) const |
| Create a tempory adding the two points. | |
| point2< T > & | operator-= (point2< T > const &p) |
| Modify this point by subtracting from itself. | |
| point2< T > const | operator- (point2< T > const &p) const |
| Create a tempory subtracting the two points. | |
| point2< T > & | operator*= (point2< T > const &p) |
| Modify this point by multiplying to itself. | |
| point2< T > const | operator* (point2< T > const &p) const |
| Create a tempory multiplying the two points. | |
| point2< T > & | operator/= (point2< T > const &p) |
| Modify this point by dividing to itself. | |
| point2< T > const | operator/ (point2< T > const &p) const |
| Create a tempory dividing the two points. | |
| bool const | operator== (point2< T > const &p) const |
| Compare the two points for equality. | |
| template<typename W > | |
| point2< T > & | operator+= (W const &w) |
| Modify this point by adding component wise to itself. | |
| template<typename W > | |
| point2< T > const | operator+ (W const &w) const |
| Create a tempory adding component wise the two points. | |
| template<typename W > | |
| point2< T > & | operator-= (W const &w) |
| Modify this point by subtracting component wise to itself. | |
| template<typename W > | |
| point2< T > const | operator- (W const &w) const |
| Create a tempory subtracting component wise the two points. | |
| template<typename W > | |
| point2< T > & | operator*= (W const &w) |
| Modify this point by multiplying component wise to itself. | |
| template<typename W > | |
| point2< T > const | operator* (W const &p) const |
| Create a tempory multiplying component wise the two points. | |
| template<typename W > | |
| point2< T > & | operator/= (W const &w) |
| Modify this point by dividing component wise to itself. | |
| template<typename W > | |
| point2< T > const | operator/ (W const &p) const |
| Create a tempory dividing component wise the two points. | |
| template<typename W > | |
| boolc | operator!= (W const &w) const |
| Not test applied to each element. | |
| T const & | operator[] (uintc i) const |
| Access the elements with integers. | |
| T & | operator[] (uintc i) |
| Access a reference to an element. | |
| void | rotate90 () |
| Rotate 90 degrees in a anti clockwise direction. | |
| T const | dot () const |
| A distance measure. | |
| T const | dot (point2< T > const &w) const |
| The dot product of two 2D points. | |
| T const | distance () const |
| The pythagorean distance between two points. | |
| void | normalize () |
| Make this vector a unit vector. | |
| template<typename Z > | |
| Z const | sumInRatio (Z const &A, Z const &B) const |
| Use this point as a ratio to sum two other numbers. | |
| boolc | isinsideunitbox () const |
| Is this point on or inside the unit box. | |
Public Attributes | |
| T | x |
| The x component/dimension. | |
| T | y |
| The y component/dimension. | |
2D point.
The class provides both direct memory management though adding and modifying the point itself by {+,-,*,/}= operators, or the generation of temporaries throught {+,-,*,/} operators.
Reading and writing to strings and streams is also supported.
Definition at line 31 of file point.h.
The pythagorean distance between two points.
Definition at line 160 of file point.h.
Referenced by arc::distance(), d3minboundary::eval(), point2< int >::normalize(), halfspaceD2draw::rotate(), linetest::test01(), and mathlibtest::test015().
A distance measure.
Definition at line 152 of file point.h.
Referenced by arc::constructPhi0TwoPoints(), arc::distance(), arc::distanceSquared(), transrotate2D::eval(), d2circle::eval(), d3circlepartition::intersection(), d3circlepartition::isInside(), d3circlepartition::isOnBoundary(), lineIntersection(), lineSegmentIntersection(), and d3tesstransform::multiply().
Make this vector a unit vector.
Definition at line 164 of file point.h.
Referenced by ruler::addStraightRuler(), d2arrow::d2arrow(), and test01().
Rotate 90 degrees in a anti clockwise direction.
Definition at line 148 of file point.h.
Referenced by arc::distance(), and arc::distanceSquared().
Interpret or read in the point.
Definition at line 55 of file point.h.
Referenced by operator>>(), point2< T >::serializeInverseBrackets(), pointtest::test03(), and mazematrixD2test::unittest01().
Read the point in that is in human friendly format with brackets and a comma from the string.
Definition at line 574 of file point.h.
References point2< T >::serializeInverse().
Referenced by maze003::maze003(), and boxOBBhalfspaceD2test::unittest02().
00575 { 00576 uintc sz(s.size()); 00577 string s2(s); 00578 00579 for (uint i=0; i<sz; ++i) 00580 { 00581 char ch = s[i]; 00582 if (ch=='(') 00583 s2[i] = ' '; 00584 if (ch==')') 00585 s2[i] = ' '; 00586 if (ch==',') 00587 s2[i] = ' '; 00588 } 00589 00590 serializeInverse(s2); 00591 }
The x component/dimension.
Definition at line 36 of file point.h.
Referenced by mazematrixmapD2< T, W >::add(), ruler::addAngleRuler(), protractor::addCirclesText(), plotpolar::addcrosses(), plotpolar::adddatapointsinPolarDegrees(), plotpolar::adddatapointsinPolarRadians(), menusystem::addnewline(), partitionstest::addpoint(), addpoint(), addpointinsidemesh(), addrandompointtomeshptvector(), ruler::addStraightRuler(), halfspaceD2draw::alphacalculate(), mazematrixD2createmaze< T >::buildpropermaze(), buttonpanel01::buttonpanel01(), mazedisp03::celldraw(), mazedisp02::celldraw(), mazedisp01::celldraw(), maze001::celldraw(), mazedisp03::celldraw2(), mazedisp02::celldraw2(), mazedisp03::cellmidpoint(), buttonpanel02::centerpos(), maze001::constructgraphics(), arc::constructPhi0TwoPoints(), arcsconnected::constructR0(), arc::constructRadiusTwoPoints(), protractor::converttocartesian(), mazedisp03::currentposdraw(), d2arrow::d2arrow(), point2< int >::distance(), randomgenerator::domain(), point2< int >::dot(), mazedisp02::draw(), mazedisp01::draw(), d2simplexFill::draw(), d2simplexOutline::draw(), namefont::draw(), regionD2tessdisplaypoints< TS, Indx >::draw(), d3circlepartitiondraw::draw(), buttonpanel02::drawcircle(), maze005::eval(), maze004::eval(), transrotate2D::eval(), polytopeD2tessdisp01< VPTS, VPOLY >::eval(), mazedisp03::f01(), disk::intersects(), point2< int >::isinsideunitbox(), circleD2test::keyboard01(), boxOBBhalfspaceD2test::keyboard01(), lineIntersection(), lineSegmentIntersection(), d2func::make(), simplexD1listlinked< VI, INDX >::makelinks(), d2homogeneous::matrixMultiply(), maze001::maze001(), maze003::maze003(), zprmouse::mouseratio(), zprmouse::mouseratioInv(), point2< int >::operator stringc(), point2< int >::operator!=(), point2< int >::operator*(), point2< int >::operator*=(), point2< int >::operator+(), point2< int >::operator+=(), point2< int >::operator-(), point2< int >::operator-=(), point2< int >::operator/(), point2< int >::operator/=(), point2< int >::operator==(), operator>(), point2< int >::operator[](), point2< int >::print(), buttonpanel02::process(), menusystem::reset(), halfspaceD2draw::rotate(), point2< int >::rotate90(), point2< int >::serializeInverse(), d2homogeneous::setTranslate(), bsptree001::special(), mazedisp03::staticgraphics(), point2< int >::sumInRatio(), mathlibtest::test01(), halfspaceD2test::test01(), test01(), test11(), timmingexperiment04(), d3circlepartitiondraw::translate(), d3tesstransform::translate(), buttonpanel02::update(), pathlinesegdraw::update(), circleD2test::update01(), spiralindex< T >::valid(), and zprmouse::world().
The y component/dimension.
Definition at line 38 of file point.h.
Referenced by mazematrixmapD2< T, W >::add(), ruler::addAngleRuler(), protractor::addCirclesText(), plotpolar::addcrosses(), plotpolar::adddatapointsinPolarDegrees(), plotpolar::adddatapointsinPolarRadians(), menusystem::addnewline(), partitionstest::addpoint(), addpoint(), addpointinsidemesh(), addrandompointtomeshptvector(), ruler::addStraightRuler(), halfspaceD2draw::alphacalculate(), mazematrixD2createmaze< T >::buildpropermaze(), buttonpanel01::buttonpanel01(), mazedisp03::celldraw(), mazedisp02::celldraw(), mazedisp01::celldraw(), maze001::celldraw(), mazedisp03::celldraw2(), mazedisp02::celldraw2(), mazedisp03::cellmidpoint(), buttonpanel02::centerpos(), maze001::constructgraphics(), arc::constructPhi0TwoPoints(), arc::constructRadiusTwoPoints(), protractor::converttocartesian(), mazedisp03::currentposdraw(), d2arrow::d2arrow(), point2< int >::distance(), randomgenerator::domain(), point2< int >::dot(), mazedisp02::draw(), mazedisp01::draw(), d2simplexFill::draw(), d2simplexOutline::draw(), namefont::draw(), regionD2tessdisplaypoints< TS, Indx >::draw(), d3circlepartitiondraw::draw(), buttonpanel02::drawcircle(), maze005::eval(), maze004::eval(), transrotate2D::eval(), polytopeD2tessdisp01< VPTS, VPOLY >::eval(), mazedisp03::f01(), disk::intersects(), point2< int >::isinsideunitbox(), circleD2test::keyboard01(), boxOBBhalfspaceD2test::keyboard01(), lineIntersection(), lineSegmentIntersection(), d2func::make(), simplexD1listlinked< VI, INDX >::makelinks(), d2homogeneous::matrixMultiply(), maze001::maze001(), maze003::maze003(), zprmouse::mouseratio(), zprmouse::mouseratioInv(), point2< int >::operator stringc(), point2< int >::operator!=(), point2< int >::operator*(), point2< int >::operator*=(), point2< int >::operator+(), point2< int >::operator+=(), point2< int >::operator-(), point2< int >::operator-=(), point2< int >::operator/(), point2< int >::operator/=(), point2< int >::operator==(), operator>(), point2< int >::operator[](), point2< int >::print(), buttonpanel02::process(), menusystem::reset(), halfspaceD2draw::rotate(), point2< int >::rotate90(), point2< int >::serializeInverse(), d2homogeneous::setTranslate(), bsptree001::special(), mazedisp03::staticgraphics(), point2< int >::sumInRatio(), mathlibtest::test01(), halfspaceD2test::test01(), test01(), test11(), timmingexperiment04(), d3circlepartitiondraw::translate(), d3tesstransform::translate(), buttonpanel02::update(), pathlinesegdraw::update(), circleD2test::update01(), spiralindex< T >::valid(), and zprmouse::world().
1.6.1