Scribus
Open source desktop publishing at your fingertips
Geom::Point Class Reference

Cartesian point. More...

#include <point.h>

Public Member Functions

 Point (Coord x, Coord y)
 
 Point (Point const &p)
 
Pointoperator= (Point const &p)
 
Coord operator[] (unsigned i) const
 
Coordoperator[] (unsigned i)
 
Coord operator[] (Dim2 d) const throw ()
 
Coordoperator[] (Dim2 d) throw ()
 
Coord length () const
 
Point ccw () const
 
Point cw () const
 
void round (int places=0)
 A function to lower the precision of the point. More...
 
void normalize ()
 
Point operator+ (Point const &o) const
 
Point operator- (Point const &o) const
 
Pointoperator+= (Point const &o)
 
Pointoperator-= (Point const &o)
 
Point operator- () const
 
Point operator* (double const s) const
 
Point operator/ (double const s) const
 
Pointoperator*= (double const s)
 
Pointoperator/= (double const s)
 
Pointoperator*= (Matrix const &m)
 
int operator== (const Point &in_pnt)
 

Static Public Member Functions

static Point polar (Coord angle, Coord radius)
 

Friends

std::ostream & operator<< (std::ostream &out_file, const Geom::Point &in_pnt)
 

Detailed Description

Cartesian point.

Member Function Documentation

Point Geom::Point::ccw ( ) const
inline

Return a point like this point but rotated -90 degrees. (If the y axis grows downwards and the x axis grows to the right, then this is 90 degrees counter-clockwise.)

Point Geom::Point::cw ( ) const
inline

Return a point like this point but rotated +90 degrees. (If the y axis grows downwards and the x axis grows to the right, then this is 90 degrees clockwise.)

void Geom::Point::normalize ( )

Scales this vector to make it a unit vector (within rounding error).

The current version tries to handle infinite coordinates gracefully, but it's not clear that any callers need that.

Precondition
$this \neq (0, 0)$
Neither component is NaN.
Postcondition
$-\epsilon<\left|this\right|-1<\epsilon$
void Geom::Point::round ( int  places = 0)
inline

A function to lower the precision of the point.

Parameters
placesThe number of decimal places that should be in the final number.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out_file,
const Geom::Point in_pnt 
)
friend

A function to print out the Point. It just prints out the coords on the given output stream


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