\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.7 - 2D and 3D Linear Geometry Kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Segment_3< Kernel > Class Template Reference

#include <CGAL/Segment_3.h>

Definition

An object s of the data type Segment_3 is a directed straight line segment in the three-dimensional Euclidean space \( \E^3\), that is a straight line segment \( [p,q]\) connecting two points \( p,q \in \R^3\).

The segment is topologically closed, i.e. the end points belong to it. Point p is called the source and q is called the target of s. The length of s is the Euclidean distance between p and q. Note that there is only a function to compute the square of the length, because otherwise we had to perform a square root operation which is not defined for all number types, which is expensive, and may not be exact.

See also
Kernel::Segment_3

Creation

 Segment_3 (const Point_3< Kernel > &p, const Point_3< Kernel > &q)
 introduces a segment s with source p and target q. More...
 

Operations

bool operator== (const Segment_3< Kernel > &q) const
 Test for equality: Two segments are equal, iff their sources and targets are equal. More...
 
bool operator!= (const Segment_3< Kernel > &q) const
 Test for inequality. More...
 
Point_3< Kernelsource () const
 returns the source of s. More...
 
Point_3< Kerneltarget () const
 returns the target of s. More...
 
Point_3< Kernelmin () const
 returns the point of s with smallest coordinate (lexicographically). More...
 
Point_3< Kernelmax () const
 returns the point of s with largest coordinate (lexicographically). More...
 
Point_3< Kernelvertex (int i) const
 returns source or target of s: vertex(0) returns the source, vertex(1) returns the target. More...
 
Point_3< Kernelpoint (int i) const
 returns vertex(i). More...
 
Point_3< Kerneloperator[] (int i) const
 returns vertex(i). More...
 
Kernel::FT squared_length () const
 returns the squared length of s. More...
 
Vector_3< Kernelto_vector () const
 returns the vector s.target() - s. More...
 
Direction_3< Kerneldirection () const
 returns the direction from source to target. More...
 
Segment_3< Kernelopposite () const
 returns a segment with source and target interchanged. More...
 
Line_3< Kernelsupporting_line () const
 returns the line l passing through s. More...
 
bool is_degenerate () const
 segment s is degenerate, if source and target fall together. More...
 
bool has_on (const Point_3< Kernel > &p) const
 A point is on s, iff it is equal to the source or target of s, or if it is in the interior of s. More...
 
Bbox_3 bbox () const
 returns a bounding box containing s. More...
 
Segment_3< Kerneltransform (const Aff_transformation_3< Kernel > &t) const
 returns the segment obtained by applying t on the source and the target of s. More...
 

Constructor & Destructor Documentation

template<typename Kernel >
CGAL::Segment_3< Kernel >::Segment_3 ( const Point_3< Kernel > &  p,
const Point_3< Kernel > &  q 
)

introduces a segment s with source p and target q.

It is directed from the source towards the target.

Member Function Documentation

template<typename Kernel >
Bbox_3 CGAL::Segment_3< Kernel >::bbox ( ) const

returns a bounding box containing s.

template<typename Kernel >
Direction_3<Kernel> CGAL::Segment_3< Kernel >::direction ( ) const

returns the direction from source to target.

template<typename Kernel >
bool CGAL::Segment_3< Kernel >::has_on ( const Point_3< Kernel > &  p) const

A point is on s, iff it is equal to the source or target of s, or if it is in the interior of s.

template<typename Kernel >
bool CGAL::Segment_3< Kernel >::is_degenerate ( ) const

segment s is degenerate, if source and target fall together.

template<typename Kernel >
Point_3<Kernel> CGAL::Segment_3< Kernel >::max ( ) const

returns the point of s with largest coordinate (lexicographically).

template<typename Kernel >
Point_3<Kernel> CGAL::Segment_3< Kernel >::min ( ) const

returns the point of s with smallest coordinate (lexicographically).

template<typename Kernel >
bool CGAL::Segment_3< Kernel >::operator!= ( const Segment_3< Kernel > &  q) const

Test for inequality.

template<typename Kernel >
bool CGAL::Segment_3< Kernel >::operator== ( const Segment_3< Kernel > &  q) const

Test for equality: Two segments are equal, iff their sources and targets are equal.

template<typename Kernel >
Point_3<Kernel> CGAL::Segment_3< Kernel >::operator[] ( int  i) const

returns vertex(i).

template<typename Kernel >
Segment_3<Kernel> CGAL::Segment_3< Kernel >::opposite ( ) const

returns a segment with source and target interchanged.

template<typename Kernel >
Point_3<Kernel> CGAL::Segment_3< Kernel >::point ( int  i) const

returns vertex(i).

template<typename Kernel >
Point_3<Kernel> CGAL::Segment_3< Kernel >::source ( ) const

returns the source of s.

template<typename Kernel >
Kernel::FT CGAL::Segment_3< Kernel >::squared_length ( ) const

returns the squared length of s.

template<typename Kernel >
Line_3<Kernel> CGAL::Segment_3< Kernel >::supporting_line ( ) const

returns the line l passing through s.

Line l has the same orientation as segment s, that is from the source to the target of s.

template<typename Kernel >
Point_3<Kernel> CGAL::Segment_3< Kernel >::target ( ) const

returns the target of s.

template<typename Kernel >
Vector_3<Kernel> CGAL::Segment_3< Kernel >::to_vector ( ) const

returns the vector s.target() - s.

source().

template<typename Kernel >
Segment_3<Kernel> CGAL::Segment_3< Kernel >::transform ( const Aff_transformation_3< Kernel > &  t) const

returns the segment obtained by applying t on the source and the target of s.

template<typename Kernel >
Point_3<Kernel> CGAL::Segment_3< Kernel >::vertex ( int  i) const

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.