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.

14.18 Real Segments ( real segment )<br />

1. Definition<br />

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

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

p 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. If p = q, s is called empty. We use line(s)<br />

to denote a straight line containing s.<br />

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

2. Types<br />

real segment :: coord type<br />

real segment :: point type<br />

the coordinate type (real).<br />

the point type (real point).<br />

3. Creation<br />

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

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

the segment [p, q].<br />

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

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

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

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

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

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

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

real segment s;<br />

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

the empty segment.<br />

real segment s(const segment& s1 , int prec = 0);<br />

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

segment s 1 . (<strong>The</strong> second argument is for compatibility with<br />

rat segment.)<br />

real segment s(const rat segment& s1 );<br />

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

segment s 1 .

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

Saved successfully!

Ooh no, something went wrong!