An instance of the data type Segment_d is a directed straight line segment in -dimensional Euclidean space connecting two points and . is called the source point and is called the target point of , both points are called endpoints of . A segment whose endpoints are equal is called degenerate.
| |
the linear algebra layer.
|
| |||
introduces a variable s
of type Segment_d<Kernel>.
| |||
| |||
introduces a
variable s of type Segment_d<Kernel> which is initialized to
the segment .
| |||
| |||
introduces a
variable s of type Segment_d<Kernel> which is initialized to
the segment (p,p+v).
|
|
| returns the dimension of the ambient space. | ||
|
| returns the source point of segment s. | ||
|
| returns the target point of segment s. | ||
|
|
returns source or target of
s: vertex(0) returns the source, vertex(1) returns
the target. The parameter is taken modulo , which gives easy
access to the other vertex.
| ||
|
| returns vertex(i). | ||
|
| returns vertex(i). | ||
|
| returns the lexicographically smaller vertex. | ||
|
| returns the lexicographically larger vertex. | ||
|
| returns the segment (target(),source()). | ||
|
|
returns the direction from
source to target.
| ||
|
| returns the vector from source to target. | ||
|
| returns the square of the length of s. | ||
|
|
returns true if lies
on s and false otherwise.
| ||
|
|
returns the supporting line
of s.
| ||
|
| |||
returns .
| ||||
|
|
returns
, i.e., s translated by vector .
| ||
|
| returns true if s is degenerate i.e. s.source()=s.target(). |
|
|
Test for equality as unoriented
segments.
| ||
|
|
return true if one of the segments is degenerate or if the
unoriented supporting lines are parallel.
| ||
|
| |||
if s1 and s2
touch in a common end point, this point is assigned to common
and the result is true, otherwise the result is false. If
s1==s2 then one of the endpoints is returned.
|
Segments are implemented by a pair of points as an item type. All operations like creation, initialization, tests, the calculation of the direction and source - target vector, input and output on a segment take time . dimension(), coordinate and end point access, and identity test take constant time. The operations for intersection calculation also take time . The space requirement is .