31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

at point p(const point& p1 , int prec = rat point :: default precision);<br />

introduces a variable p of type rat point initialized to the point<br />

with homogeneous coordinates (⌊P ∗x⌋, ⌊P ∗y⌋, P ), where p 1 =<br />

(x, y) and P = 2 prec . If prec is non-positive, the conversion<br />

is without loss of precision, i.e., P is chosen as a sufficiently<br />

large power of two such that P ∗ x and P ∗ y are integers.<br />

rat point p(double x, double y, int prec = rat point :: default precision);<br />

see constructor above with p = (x, y).<br />

4. Operations<br />

point p.to float( ) returns a floating point approximation of p.<br />

rat vector p.to vector( ) returns the vector extending from the origin to p.<br />

void p.normalize( ) simplifies the homogenous representation by dividing all<br />

coordinates by gcd(X, Y, W ).<br />

integer p.X( ) returns the first homogeneous coordinate of p.<br />

integer p.Y( ) returns the second homogeneous coordinate of p.<br />

integer p.W( ) returns the third homogeneous coordinate of p.<br />

double p.XD( ) returns a floating point approximation of p.X( ).<br />

double p.YD( ) returns a floating point approximation of p.Y ( ).<br />

double p.WD( ) returns a floating point approximation of p.W ( ).<br />

rational p.xcoord( ) returns the x-coordinate of p.<br />

rational p.ycoord( ) returns the y-coordinate of p.<br />

double p.xcoordD( ) returns a floating point approximation of p.xcoord( ).<br />

double p.ycoordD( ) returns a floating point approximation of p.ycoord( ).<br />

rat point p.rotate90(const rat point& q, int i = 1)<br />

rat point p.rotate90(int i = 1)<br />

returns p rotated by i × 90 degrees about q. If i > 0 the<br />

rotation is counter-clockwise otherwise it is clockwise.<br />

returns p rotated by i×90 degrees about the origin. If i > 0<br />

the rotation is counter-clockwise otherwise it is clockwise.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!