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.3 Segments in 3D-Space ( d3 segment )<br />

1. Definition<br />

An instance s of the data type d3 segment is a directed straight line segment in threedimensional<br />

space, i.e., a straight line segment [p, q] connecting two points p, q ∈ R 3 . p<br />

is called the source or start point and q is called the target or end point of s. <strong>The</strong> length<br />

of s is the Euclidean distance between p and q. A segment is called trivial if its source is<br />

equal to its target. If s is not trivial, we use line(s) to denote the straight line containing<br />

s.<br />

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

2. Creation<br />

d3 segment s(const d3 point& p1 , const d3 point& p2 );<br />

introduces a variable s of type d3 segment. s is initialized to the<br />

segment from p1 to p2 .<br />

d3 segment s;<br />

introduces a variable s of type d3 segment. s is initialized to the<br />

segment from (0, 0, 0) to (1, 0, 0).<br />

3. Operations<br />

bool s.contains(const d3 point& p)<br />

decides whether s contains p.<br />

d3 point s.source( ) returns the source point of segment s.<br />

d3 point s.target( ) returns the target point of segment s.<br />

double s.xcoord1( ) returns the x-coordinate of s.source().<br />

double s.xcoord2( ) returns the x-coordinate of s.target().<br />

double s.ycoord1( ) returns the y-coordinate of s.source().<br />

double s.ycoord2( ) returns the y-coordinate of s.target().<br />

double s.zcoord1( ) returns the z-coordinate of s.source().<br />

double s.zcoord2( ) returns the z-coordinate of s.target().<br />

double s.dx( ) returns xcoord2( ) − xcoord1( ).<br />

double s.dy( ) returns ycoord2 ( ) − ycoord1 ( ).<br />

double s.dz( ) returns zcoord2( ) − zcoord1( ).

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

Saved successfully!

Ooh no, something went wrong!