Classes | Defines | Functions
core/vgl/vgl_conic_segment_2d.h File Reference

A curve segment with the geometry of a conic. More...

#include <vgl/vgl_homg_point_2d.h>
#include <vgl/vgl_conic.h>
#include <vgl/vgl_point_2d.h>
#include <vcl_iosfwd.h>
#include <vcl_cassert.h>

Go to the source code of this file.

Classes

class  vgl_conic_segment_2d< Type >
 Represents a 2D conic segment using two points. More...

Defines

#define VGL_CONIC_SEGMENT_2D_INSTANTIATE(T)   extern "please include vgl/vgl_conic_segment_2d.txx first"

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

A curve segment with the geometry of a conic.

Author:
J.L. Mundy June 18, 2005 A conic segment contains those points of a given conic which lie between the given start point (inclusive) and the given end point, in a certain direction (counter-clockwise by default). No automatic validation checking is done for those two points effectively lying on the conic; this is left to the user of the class. Operations on vgl_conic_segment_2d<T> like intersection should actually take the "points closest to the given end points" as the effective end points.

The concept of counter-clockwise-ness is not projectively invariant, but is invariant under most projective transformations that are useful in vision, and most certainly is under affine and Euclidean transformations. Actually, as long as the centre of the conic does not traverse the line at infinity, orientation and thus counter-clockwise-ness of the conic is kept. There is only one affine situation which is still ambiguous, viz. when the conic is a hyperbola. In that case, the definition of "counter-clockwise" is based --by definition-- on the view of the start point. Only when both end points are at infinity, i.e. when, the segment is one of the two branches of the hyperbola, this is still ambiguous and there is no way to distinguish which of the two branches is meant by just giving the two end points.

The only projectively "correct" way to define a segment would be to specify a third point on the conic, or a direction vector from the start point. This would be an overkill for most applications, though. Those applications that require a fully projectively invariant segment should consider storing an additional third point together with the conic segment, and swap the two endpoints (by using the swap_endpoints() method) whenever a transformation is applied that would invert the orientation of the conic.

One more ambiguous situation left is a conic segment specified by two identical end points. By definition, in this case, the segment only contains of this single point. This is compatible with the use of conic segments in conic fitting algorithms, where the shortest rather than the longest segment should be selected.

When the conic is an ellipse, the semantics of the conic segment are clear: seen from the inside of the ellipse, and starting from the first end point, one goes to the left to traverse the conic segment in a counter-clockwise way.

If the conic is a parabola, the first endpoint should typically lie to the right of the second one (as seen from the focal point of the parabola): in that case, the conic segment has finite length when traversed in counter- clockwise direction. Otherwise, we still have a valid conic segment but it consists of two separate, infinite branches.

If the conic is a hyperbola, there are even three cases to be considered: if both end points lie on the same branch of the hyperbola, and the first one lies to the right of the second one as seen from the "inside" of that branch, the conic segment is a finite curve. This is the only finite case. By swapping the end points, the segment will have three branches, not just two: it will contain the two infinite fragments "outside" the end points on the hyperbola branch of the end points, and also the complete other branch of the hyperbola. Finally, if the end points lie on different hyperbola branches, the segment consists of all points to the left of the start point (as seen from the "inside" of the start point's branch) and of all points to the left of the end point (as seen from the "inside" of the end point's branch). In this case, swapping the end points does not change the segment! As a consequence, it will never be possible to specify the complement of this segment as a single vgl_conic_segment_2d, only as the union of two.

End points can of course happily be points at infinity (if the conic is either a parabola or a hyperbola). A parabolic segment with the start point at infinity contains all points to the left of the end point, as seen from the focal point of the parabola. If the end point lies at infinity, it's the points to the left of the start point which form the segment. A hyperbolic segment for which the two endpoints are the two different points at infinity of the hyperbola, contains all points of one of the two hyperbola branches and none of the other branch. This is the only ambiguous situation so it should be avoided unless a third point is used to define the segment. If only one end point of a hyperbolic segment lies at infinity, the segment either consists of just the points to the left on the branch of the other end point, or of those points plus all points on the other branch.

    Modifications
     2009-06-06 Peter Vanroose - Added member "counterclockwise_"
     2009-06-06 Peter Vanroose - Added swap_endpoints(), swap_direction(), normalize()
     2009-06-06 Peter Vanroose - Added the is_finite() method (not yet implem.)
     2009-06-06 Peter Vanroose - Re-implemented to be fully homogeneous
     2009-06-06 Peter Vanroose - Added explicit "semantics" documentation
     2009-06-06 Peter Vanroose - Added the contains() method (not yet implem.)
   

Definition in file vgl_conic_segment_2d.h.


Define Documentation

#define VGL_CONIC_SEGMENT_2D_INSTANTIATE (   T)    extern "please include vgl/vgl_conic_segment_2d.txx first"

Definition at line 272 of file vgl_conic_segment_2d.h.


Function Documentation

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

Write to stream.

Definition at line 10 of file vgl_conic_segment_2d.txx.

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

Read from stream.

Definition at line 17 of file vgl_conic_segment_2d.txx.