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.

14.2 Segments ( segment )<br />

1. Definition<br />

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

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

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

s is the Euclidean distance between p and q. If p = q s is called empty. We use line(s)<br />

to denote a straight line containing s. <strong>The</strong> angle between a right oriented horizontal ray<br />

and s is called the direction of s.<br />

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

2. Types<br />

segment :: coord type<br />

segment :: point type<br />

the coordinate type (double).<br />

the point type (point).<br />

3. Creation<br />

segment s(const point& p, const point& q);<br />

segment s(const point& p, const vector& v);<br />

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

segment [p, q].<br />

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

segment [p, p + v].<br />

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

segment s(double x1 , double y1 , double x2 , double y2 );<br />

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

segment [(x 1 , y 1 ), (x 2 , y 2 )].<br />

segment s(const point& p, double alpha, double length);<br />

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

the segment with start point p, direction alpha, and length<br />

length.<br />

segment s;<br />

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

empty segment.<br />

segment s(const segment& s1 , int);<br />

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

copy of s 1 .

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

Saved successfully!

Ooh no, something went wrong!