CGAL 4.6 - dD Geometry Kernel
|
#include <CGAL/Kernel_d/Segment_d.h>
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.
Implementation
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())\).
Related Functions | |
(Note that these are not member functions.) | |
bool | weak_equality (const Segment_d< Kernel > &s1, const Segment_d< Kernel > &s2) |
Test for equality as unoriented segments. More... | |
bool | parallel (const Segment_d< Kernel > &s1, const Segment_d< Kernel > &s2) |
return true if one of the segments is degenerate or if the unoriented supporting lines are parallel. More... | |
bool | common_endpoint (const Segment_d< Kernel > &s1, const Segment_d< Kernel > &s2, Point_d< Kernel > &common) |
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 . More... | |
Types | |
typedef unspecified_type | LA |
the linear algebra layer. | |
Creation | |
Segment_d () | |
introduces a variable s of type Segment_d<Kernel> . | |
Segment_d (Point_d< Kernel > p, Point_d< Kernel > q) | |
introduces a variable s of type Segment_d<Kernel> which is initialized to the segment \( (p,q)\). More... | |
Segment_d (Point_d< Kernel > p, Vector_d< Kernel > v) | |
introduces a variable s of type Segment_d<Kernel> which is initialized to the segment (p,p+v) . More... | |
Operations | |
int | dimension () |
returns the dimension of the ambient space. | |
Point_d< Kernel > | source () |
returns the source point of segment s . | |
Point_d< Kernel > | target () |
returns the target point of segment s . | |
Point_d< Kernel > | vertex (int i) |
returns source or target of s : vertex(0) returns the source, vertex(1) returns the target. More... | |
Point_d< Kernel > | point (int i) |
returns vertex(i) . | |
Point_d< Kernel > | operator[] (int i) |
returns vertex(i) . | |
Point_d< Kernel > | min () |
returns the lexicographically smaller vertex. | |
Point_d< Kernel > | max () |
returns the lexicographically larger vertex. | |
Segment_d< Kernel > | opposite () |
returns the segment (target(),source()) . | |
Direction_d< Kernel > | direction () |
returns the direction from source to target. More... | |
Vector_d< Kernel > | vector () |
returns the vector from source to target. | |
FT | squared_length () |
returns the square of the length of s . | |
bool | has_on (const Point_d< Kernel > &p) |
returns true if \( p\) lies on s and false otherwise. More... | |
Line_d< Kernel > | supporting_line () |
returns the supporting line of s . More... | |
Segment_d< Kernel > | transform (const Aff_transformation_d< Kernel > &t) |
returns \( t(s)\). More... | |
Segment_d< Kernel > | operator+ (const Vector_d< Kernel > &v) |
returns \( s+v\), i.e., s translated by vector \( v\). More... | |
bool | is_degenerate () |
returns true if s is degenerate i.e. s.source()=s.target() . | |
Direction_d<Kernel> CGAL::Segment_d< Kernel >::direction | ( | ) |
returns the direction from source to target.
s
is non-degenerate. bool CGAL::Segment_d< Kernel >::has_on | ( | const Point_d< Kernel > & | p) |
returns true if \( p\) lies on s
and false otherwise.
s.dimension()==p.dimension()
. Segment_d<Kernel> CGAL::Segment_d< Kernel >::operator+ | ( | const Vector_d< Kernel > & | v) |
returns \( s+v\), i.e., s
translated by vector \( v\).
s.dimension()==v.dimension()
. Line_d<Kernel> CGAL::Segment_d< Kernel >::supporting_line | ( | ) |
returns the supporting line of s
.
s
is non-degenerate. Segment_d<Kernel> CGAL::Segment_d< Kernel >::transform | ( | const Aff_transformation_d< Kernel > & | t) |
returns \( t(s)\).
s.dimension()==t.dimension()
. Point_d<Kernel> CGAL::Segment_d< Kernel >::vertex | ( | int | i) |
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.
|
related |
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.
s1.dimension()==s2.dimension()
.
|
related |
return true if one of the segments is degenerate or if the unoriented supporting lines are parallel.
s1.dimension()==s2.dimension()
.