An instance s of the data type Segment_d is a directed straight line segment in d-dimensional Euclidean space connecting two points p and q. p is called the source point and q is called the target point of s, both points are called endpoints of s. 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 (p,q).
| |||
| |||
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 i is taken modulo 2, 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 p lies
on s and false otherwise.
| ||
|
|
returns the supporting line
of s.
| ||
|
| |||
returns t(s).
| ||||
|
|
returns
s+v, i.e., s translated by vector v.
| ||
|
| 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 s take time O(s.dimension()). dimension(), coordinate and end point access, and identity test take constant time. The operations for intersection calculation also take time O(s.dimension()). The space requirement is O(s.dimension()).