Public Member Functions | Private Attributes | Related Functions | List of all members
vgl_conic_segment_2d< Type > Class Template Reference

Represents a 2D conic segment using two points. More...

#include <vgl_conic_segment_2d.h>

Public Member Functions

 vgl_conic_segment_2d ()=default
 Default constructor - does not initialise!. More...
 
 vgl_conic_segment_2d (vgl_conic_segment_2d< Type > const &l)
 Copy constructor. More...
 
 vgl_conic_segment_2d (vgl_homg_point_2d< Type > const &p1, vgl_homg_point_2d< Type > const &p2, vgl_conic< Type > const &co, bool counterclockwise=true)
 Construct from two end points (homogeneous) and a conic. More...
 
 vgl_conic_segment_2d (vgl_point_2d< Type > const &p1, vgl_point_2d< Type > const &p2, vgl_conic< Type > const &co, bool counterclockwise=true)
 Construct from two end points (Cartesian) and a conic. More...
 
 vgl_conic_segment_2d (vgl_conic< Type > const &co, vgl_homg_point_2d< Type > const &p1, vgl_homg_point_2d< Type > const &p2, bool counterclockwise=true)
 Construct from a conic and two end points (homogeneous). More...
 
 vgl_conic_segment_2d (vgl_conic< Type > const &co, vgl_point_2d< Type > const &p1, vgl_point_2d< Type > const &p2, bool counterclockwise=true)
 Construct from a conic and two end points (Cartesian). More...
 
 ~vgl_conic_segment_2d ()=default
 Destructor. More...
 
void normalize ()
 Normalise the direction of the segment to counterclockwise. More...
 
void swap_endpoints ()
 Interchange the two endpoints but keep the direction. More...
 
void swap_direction ()
 Change the direction of the conic section but keep the end points. More...
 
vgl_homg_point_2d< Type > point1 () const
 The first end-point of the conic segment. More...
 
vgl_homg_point_2d< Type > point2 () const
 The second end-point of the conic segment. More...
 
vgl_conic< Type > conic () const
 The conic underlying the segment. More...
 
bool is_counterclockwise () const
 The direction of the segment (clockwise or counterclockwise). More...
 
bool is_clockwise () const
 The direction of the segment (clockwise or counterclockwise). More...
 
bool operator== (vgl_conic_segment_2d< Type > const &l) const
 The equality comparison operator. More...
 
bool operator!= (vgl_conic_segment_2d< Type >const &other) const
 The inequality comparison operator. More...
 
void set (vgl_homg_point_2d< Type > const &p1, vgl_homg_point_2d< Type > const &p2, vgl_conic< Type > co, bool counterclockwise=true)
 (Re)initialise the conic segment by passing it its three "constructors". More...
 
void set (vgl_conic< Type > co, vgl_homg_point_2d< Type > const &p1, vgl_homg_point_2d< Type > const &p2, bool counterclockwise=true)
 (Re)initialise the conic segment by passing it its three "constructors". More...
 
void set (vgl_point_2d< Type > const &p1, vgl_point_2d< Type > const &p2, vgl_conic< Type > co, bool counterclockwise=true)
 (Re)initialise the conic segment by passing it its three "constructors". More...
 
void set (vgl_conic< Type > co, vgl_point_2d< Type > const &p1, vgl_point_2d< Type > const &p2, bool counterclockwise=true)
 (Re)initialise the conic segment by passing it its three "constructors". More...
 
bool is_finite () const
 Finds out whether this curve has a finite length. More...
 
bool contains (vgl_homg_point_2d< Type > const &) const
 Finds out whether the given point lies on the conic segment. More...
 

Private Attributes

vgl_homg_point_2d< Type > p1_
 One end of conic segment. More...
 
vgl_homg_point_2d< Type > p2_
 The other end of the conic segment. More...
 
vgl_conic< Type > conic_
 The conic that represents the curve between point1 and point2. More...
 
bool counterclockwise_
 Whether traversal is in counter-clockwise direction (the default) or not. More...
 

Related Functions

(Note that these are not member functions.)

template<class Type >
std::ostream & operator<< (std::ostream &s, const vgl_conic_segment_2d< Type > &c_s)
 Write to stream. More...
 
template<class Type >
std::istream & operator>> (std::istream &is, vgl_conic_segment_2d< Type > &c_s)
 Read from stream. More...
 

Detailed Description

template<class Type>
class vgl_conic_segment_2d< Type >

Represents a 2D conic segment using two points.

Definition at line 103 of file vgl_conic_segment_2d.h.

Constructor & Destructor Documentation

◆ vgl_conic_segment_2d() [1/6]

template<class Type>
vgl_conic_segment_2d< Type >::vgl_conic_segment_2d ( )
inlinedefault

Default constructor - does not initialise!.

Use the set() method to make this conic segment useful.

◆ vgl_conic_segment_2d() [2/6]

template<class Type>
vgl_conic_segment_2d< Type >::vgl_conic_segment_2d ( vgl_conic_segment_2d< Type > const &  l)
inline

Copy constructor.

Definition at line 123 of file vgl_conic_segment_2d.h.

◆ vgl_conic_segment_2d() [3/6]

template<class Type>
vgl_conic_segment_2d< Type >::vgl_conic_segment_2d ( vgl_homg_point_2d< Type > const &  p1,
vgl_homg_point_2d< Type > const &  p2,
vgl_conic< Type > const &  co,
bool  counterclockwise = true 
)
inline

Construct from two end points (homogeneous) and a conic.

Definition at line 128 of file vgl_conic_segment_2d.h.

◆ vgl_conic_segment_2d() [4/6]

template<class Type>
vgl_conic_segment_2d< Type >::vgl_conic_segment_2d ( vgl_point_2d< Type > const &  p1,
vgl_point_2d< Type > const &  p2,
vgl_conic< Type > const &  co,
bool  counterclockwise = true 
)
inline

Construct from two end points (Cartesian) and a conic.

Definition at line 136 of file vgl_conic_segment_2d.h.

◆ vgl_conic_segment_2d() [5/6]

template<class Type>
vgl_conic_segment_2d< Type >::vgl_conic_segment_2d ( vgl_conic< Type > const &  co,
vgl_homg_point_2d< Type > const &  p1,
vgl_homg_point_2d< Type > const &  p2,
bool  counterclockwise = true 
)
inline

Construct from a conic and two end points (homogeneous).

Definition at line 144 of file vgl_conic_segment_2d.h.

◆ vgl_conic_segment_2d() [6/6]

template<class Type>
vgl_conic_segment_2d< Type >::vgl_conic_segment_2d ( vgl_conic< Type > const &  co,
vgl_point_2d< Type > const &  p1,
vgl_point_2d< Type > const &  p2,
bool  counterclockwise = true 
)
inline

Construct from a conic and two end points (Cartesian).

Definition at line 152 of file vgl_conic_segment_2d.h.

◆ ~vgl_conic_segment_2d()

template<class Type>
vgl_conic_segment_2d< Type >::~vgl_conic_segment_2d ( )
inlinedefault

Destructor.

Member Function Documentation

◆ conic()

template<class Type>
vgl_conic<Type> vgl_conic_segment_2d< Type >::conic ( ) const
inline

The conic underlying the segment.

Definition at line 185 of file vgl_conic_segment_2d.h.

◆ contains()

template<class Type>
bool vgl_conic_segment_2d< Type >::contains ( vgl_homg_point_2d< Type > const &  ) const
inline

Finds out whether the given point lies on the conic segment.

More specifically, lying on the segment implies lying on the conic. Moreover, the two endpoints (if effectively on the conic) will always lie on the segment. All other points of the conic lie either on this segment, or on the "swapped" segment, but never on both.

Todo:
not yet implemented

Definition at line 259 of file vgl_conic_segment_2d.h.

◆ is_clockwise()

template<class Type>
bool vgl_conic_segment_2d< Type >::is_clockwise ( ) const
inline

The direction of the segment (clockwise or counterclockwise).

Definition at line 191 of file vgl_conic_segment_2d.h.

◆ is_counterclockwise()

template<class Type>
bool vgl_conic_segment_2d< Type >::is_counterclockwise ( ) const
inline

The direction of the segment (clockwise or counterclockwise).

Definition at line 188 of file vgl_conic_segment_2d.h.

◆ is_finite()

template<class Type>
bool vgl_conic_segment_2d< Type >::is_finite ( ) const
inline

Finds out whether this curve has a finite length.

If the conic segment has an underlying ellipse, the segment is of course always finite. Otherwise, is_finite returns false whenever the segment passes through one of the points at infinity of the hyperbola or parabola. Note that the methods swap_endpoints() and swap_direction() always swaps finiteness of a parabolic segment (unless the endpoints coincide). For hyperbolic segments this is not necessarily the case: both can be infinite.

Todo:
not yet implemented

Definition at line 251 of file vgl_conic_segment_2d.h.

◆ normalize()

template<class Type>
void vgl_conic_segment_2d< Type >::normalize ( )
inline

Normalise the direction of the segment to counterclockwise.

This will also swap the end points if the direction is to be swapped.

Definition at line 164 of file vgl_conic_segment_2d.h.

◆ operator!=()

template<class Type>
bool vgl_conic_segment_2d< Type >::operator!= ( vgl_conic_segment_2d< Type >const &  other) const
inline

The inequality comparison operator.

Definition at line 217 of file vgl_conic_segment_2d.h.

◆ operator==()

template<class Type>
bool vgl_conic_segment_2d< Type >::operator== ( vgl_conic_segment_2d< Type > const &  l) const
inline

The equality comparison operator.

Two conic segments are only identical if the underlying conic is identical and if direction and both endpoints are identical, in the same order! Two conic segments with identical conic and identical end points but in the opposite order are not identical but rather complementary: they share no other points than the two end points. Use the swap_direction or the swap_endpoints() method on one of the two segments to turn complementary segments into identical ones. Note that two conic segments are equal if both the direction and the two end points are swapped. To normalize a conic segment such that its direction becomes counterclockwise, use the normalize() method.

Definition at line 204 of file vgl_conic_segment_2d.h.

◆ point1()

template<class Type>
vgl_homg_point_2d<Type> vgl_conic_segment_2d< Type >::point1 ( ) const
inline

The first end-point of the conic segment.

Definition at line 179 of file vgl_conic_segment_2d.h.

◆ point2()

template<class Type>
vgl_homg_point_2d<Type> vgl_conic_segment_2d< Type >::point2 ( ) const
inline

The second end-point of the conic segment.

Definition at line 182 of file vgl_conic_segment_2d.h.

◆ set() [1/4]

template<class Type>
void vgl_conic_segment_2d< Type >::set ( vgl_homg_point_2d< Type > const &  p1,
vgl_homg_point_2d< Type > const &  p2,
vgl_conic< Type >  co,
bool  counterclockwise = true 
)
inline

(Re)initialise the conic segment by passing it its three "constructors".

Definition at line 220 of file vgl_conic_segment_2d.h.

◆ set() [2/4]

template<class Type>
void vgl_conic_segment_2d< Type >::set ( vgl_conic< Type >  co,
vgl_homg_point_2d< Type > const &  p1,
vgl_homg_point_2d< Type > const &  p2,
bool  counterclockwise = true 
)
inline

(Re)initialise the conic segment by passing it its three "constructors".

Definition at line 225 of file vgl_conic_segment_2d.h.

◆ set() [3/4]

template<class Type>
void vgl_conic_segment_2d< Type >::set ( vgl_point_2d< Type > const &  p1,
vgl_point_2d< Type > const &  p2,
vgl_conic< Type >  co,
bool  counterclockwise = true 
)
inline

(Re)initialise the conic segment by passing it its three "constructors".

Definition at line 231 of file vgl_conic_segment_2d.h.

◆ set() [4/4]

template<class Type>
void vgl_conic_segment_2d< Type >::set ( vgl_conic< Type >  co,
vgl_point_2d< Type > const &  p1,
vgl_point_2d< Type > const &  p2,
bool  counterclockwise = true 
)
inline

(Re)initialise the conic segment by passing it its three "constructors".

Definition at line 237 of file vgl_conic_segment_2d.h.

◆ swap_direction()

template<class Type>
void vgl_conic_segment_2d< Type >::swap_direction ( )
inline

Change the direction of the conic section but keep the end points.

This implies that now the conic segment contains those points of the conic which before did not belong to the conic segment! (Except for the two end points, of course.)

Definition at line 176 of file vgl_conic_segment_2d.h.

◆ swap_endpoints()

template<class Type>
void vgl_conic_segment_2d< Type >::swap_endpoints ( )
inline

Interchange the two endpoints but keep the direction.

This implies that now the conic segment contains those points of the conic which before did not belong to the conic segment! (Except for the two end points, of course.)

Definition at line 170 of file vgl_conic_segment_2d.h.

Friends And Related Function Documentation

◆ operator<<()

template<class Type >
std::ostream & operator<< ( std::ostream &  s,
const vgl_conic_segment_2d< Type > &  c_s 
)
related

Write to stream.

◆ operator>>()

template<class Type >
std::istream & operator>> ( std::istream &  is,
vgl_conic_segment_2d< Type > &  c_s 
)
related

Read from stream.

Member Data Documentation

◆ conic_

template<class Type>
vgl_conic<Type> vgl_conic_segment_2d< Type >::conic_
private

The conic that represents the curve between point1 and point2.

Definition at line 112 of file vgl_conic_segment_2d.h.

◆ counterclockwise_

template<class Type>
bool vgl_conic_segment_2d< Type >::counterclockwise_
private

Whether traversal is in counter-clockwise direction (the default) or not.

Definition at line 115 of file vgl_conic_segment_2d.h.

◆ p1_

template<class Type>
vgl_homg_point_2d<Type> vgl_conic_segment_2d< Type >::p1_
private

One end of conic segment.

Definition at line 106 of file vgl_conic_segment_2d.h.

◆ p2_

template<class Type>
vgl_homg_point_2d<Type> vgl_conic_segment_2d< Type >::p2_
private

The other end of the conic segment.

Definition at line 109 of file vgl_conic_segment_2d.h.


The documentation for this class was generated from the following file: