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.

16.8 Rational Points in 3D-Space ( d3 rat point )<br />

1. Definition<br />

An instance of data type d3 rat point is a point with rational coordinates in the threedimensional<br />

space. A point with cartesian coordinates (a, b, c) is represented by homogeneous<br />

coordinates (x, y, z, w) of arbitrary length integers (see 5.1) such that a = x/w,<br />

b = y/w, c = z/w and w > 0.<br />

#include < <strong>LEDA</strong>/geo/d3 rat point.h ><br />

2. Creation<br />

d3 rat point p;<br />

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

(0, 0, 0).<br />

d3 rat point p(const rational& a, const rational& b, const rational& c);<br />

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

(a, b, c).<br />

d3 rat point p(integer a, integer b, integer c);<br />

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

(a, b, c).<br />

d3 rat point p(integer x, integer y, integer z, integer w);<br />

d3 rat point p(const rat vector& v);<br />

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

with homogeneous coordinates (x, y, z, w) if w > 0 and to point<br />

(−x, −y, −z, −w) if w < 0.<br />

Precondition: w ≠ 0.<br />

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

(v[0], v[1], v[2]).<br />

Precondition: : v.dim( ) = 3.<br />

3. Operations<br />

d3 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 />

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

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

integer p.Z( ) returns the third homogeneous coordinate of p.

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

Saved successfully!

Ooh no, something went wrong!