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.1 Points in 3D-Space ( d3 point )<br />

1. Definition<br />

An instance of the data type d3 point is a point in the three-dimensional space R 3 . We<br />

use (x, y, z) to denote a point with first (or x-) coordinate x, second (or y-) coordinate y,<br />

and third (or z-) coordinate z.<br />

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

2. Creation<br />

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

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

d3 point<br />

d3 point<br />

p(double x, double y, double z);<br />

p(vector v);<br />

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

(x, y, z).<br />

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

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

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

3. Operations<br />

double p.xcoord( ) returns the first coordinate of p.<br />

double p.ycoord( ) returns the second coordinate of p.<br />

double p.zcoord( ) returns the third coordinate of p.<br />

vector p.to vector( ) returns the vector xyz. ⃗<br />

point p.project xy( ) returns p projected into the xy-plane.<br />

point p.project yz( ) returns p projected into the yz-plane.<br />

point p.project xz( ) returns p projected into the xz-plane.<br />

double p.sqr dist(const d3 point& q)<br />

double p.xdist(const d3 point& q)<br />

returns the square of the Euclidean distance between p<br />

and q.<br />

returns the x-distance between p and q.

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

Saved successfully!

Ooh no, something went wrong!