Public Member Functions | Private Attributes | Related Functions
vgl_conic_segment_2d< Type > Class Template Reference

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

#include <vgl_conic_segment_2d.h>

List of all members.

Public Member Functions

 vgl_conic_segment_2d ()
 Default constructor - does not initialise!.
 vgl_conic_segment_2d (vgl_conic_segment_2d< Type > const &l)
 Copy constructor.
 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.
 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.
 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).
 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).
 ~vgl_conic_segment_2d ()
 Destructor.
void normalize ()
 Normalise the direction of the segment to counterclockwise.
void swap_endpoints ()
 Interchange the two endpoints but keep the direction.
void swap_direction ()
 Change the direction of the conic section but keep the end points.
vgl_homg_point_2d< Type > point1 () const
 The first end-point of the conic segment.
vgl_homg_point_2d< Type > point2 () const
 The second end-point of the conic segment.
vgl_conic< Type > conic () const
 The conic underlying the segment.
bool is_counterclockwise () const
 The direction of the segment (clockwise or counterclockwise).
bool is_clockwise () const
 The direction of the segment (clockwise or counterclockwise).
bool operator== (vgl_conic_segment_2d< Type > const &l) const
 The equality comparison operator.
bool operator!= (vgl_conic_segment_2d< Type >const &other) const
 The inequality comparison operator.
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".
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".
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".
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".
bool is_finite () const
 Finds out whether this curve has a finite length.
bool contains (vgl_homg_point_2d< Type > const &) const
 Finds out whether the given point lies on the conic segment.

Private Attributes

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

Related Functions

(Note that these are not member functions.)

template<class Type >
vcl_ostream & operator<< (vcl_ostream &s, const vgl_conic_segment_2d< Type > &c_s)
 Write to stream.
template<class Type >
vcl_istream & operator>> (vcl_istream &is, vgl_conic_segment_2d< Type > &c_s)
 Read from stream.

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

template<class Type>
vgl_conic_segment_2d< Type >::vgl_conic_segment_2d ( ) [inline]

Default constructor - does not initialise!.

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

Definition at line 120 of file vgl_conic_segment_2d.h.

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.

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.

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.

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.

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.

template<class Type>
vgl_conic_segment_2d< Type >::~vgl_conic_segment_2d ( ) [inline]

Destructor.

Definition at line 160 of file vgl_conic_segment_2d.h.


Member Function Documentation

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

template<class Type >
vcl_ostream & operator<< ( vcl_ostream &  s,
const vgl_conic_segment_2d< Type > &  c_s 
) [related]

Write to stream.

template<class Type >
vcl_istream & operator>> ( vcl_istream &  is,
vgl_conic_segment_2d< Type > &  c_s 
) [related]

Read from stream.


Member Data Documentation

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.

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.

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.

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: