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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

at vector rat vector :: d3(integer a, integer b, integer c, integer D)<br />

rat vector rat vector :: unit(int i, int d = 2)<br />

returns a rat vector of dimension 3 initialized<br />

to a vector with homogeneous representation<br />

(a, b, c, D) if D is positive and representation<br />

(−a, −b, −c, −D) if D is negative.<br />

Precondition: D is non-zero.<br />

returns a rat vector of dimension d initialized<br />

to the i-th unit vector.<br />

Precondition: 0 ≤ i < d.<br />

rat vector<br />

rat vector :: zero(int d = 2) returns the zero vector in d-dimensional<br />

space.<br />

int v.dim( ) returns the dimension of v.<br />

integer v.hcoord(int i) returns the i-th homogeneous coordinate of<br />

v.<br />

rational v.coord(int i) returns the i-th cartesian coordinate of v.<br />

rational v[int i] returns the i-th cartesian coordinate of v.<br />

rational v.sqr length( ) returns the square of the length of v.<br />

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

Additional Operations for vectors in two and three-dimensional space<br />

rational v.xcoord( ) returns the zero-th cartesian coordinate of v.<br />

rational v.ycoord( ) returns the first cartesian coordinate of v.<br />

rational v.zcoord( ) returns the second cartesian coordinate of v.<br />

integer v.X( ) returns the zero-th homogeneous coordinate<br />

of v.<br />

integer v.Y( ) returns the first homogeneous coordinate of<br />

v.<br />

integer v.Z( ) returns the second homogeneous coordinate<br />

of v.<br />

integer v.W( ) returns the homogenizing coordinate of v.<br />

rat vector v.rotate90(int i = 1) returns v by an angle of i×90 degrees. If i ><br />

0 the rotation is counter-clockwise otherwise<br />

it is clockwise. Precondition: v.dim( ) == 2.

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

Saved successfully!

Ooh no, something went wrong!