Defines | Functions
core/vgl/vgl_homg_point_2d.txx File Reference
#include "vgl_homg_point_2d.h"
#include <vgl/vgl_homg_line_2d.h>
#include <vcl_iostream.h>

Go to the source code of this file.

Defines

#define vgl_homg_point_2d_txx_
#define VGL_HOMG_POINT_2D_INSTANTIATE(T)

Functions

template<class T >
double cross_ratio (vgl_homg_point_2d< T >const &p1, vgl_homg_point_2d< T >const &p2, vgl_homg_point_2d< T >const &p3, vgl_homg_point_2d< T >const &p4)
 cross ratio of four collinear points.
template<class Type >
vcl_ostream & operator<< (vcl_ostream &s, vgl_homg_point_2d< Type > const &p)
template<class Type >
vcl_istream & operator>> (vcl_istream &s, vgl_homg_point_2d< Type > &p)

Define Documentation

#define VGL_HOMG_POINT_2D_INSTANTIATE (   T)
Value:
template class vgl_homg_point_2d<T >; \
template double cross_ratio(vgl_homg_point_2d<T >const&, vgl_homg_point_2d<T >const&, \
                            vgl_homg_point_2d<T >const&, vgl_homg_point_2d<T >const&); \
template vcl_ostream& operator<<(vcl_ostream&, vgl_homg_point_2d<T >const&); \
template vcl_istream& operator>>(vcl_istream&, vgl_homg_point_2d<T >&)

Definition at line 49 of file vgl_homg_point_2d.txx.

#define vgl_homg_point_2d_txx_

Definition at line 3 of file vgl_homg_point_2d.txx.


Function Documentation

template<class T >
double cross_ratio ( vgl_homg_point_2d< T >const &  p1,
vgl_homg_point_2d< T >const &  p2,
vgl_homg_point_2d< T >const &  p3,
vgl_homg_point_2d< T >const &  p4 
)

cross ratio of four collinear points.

This number is projectively invariant, and it is the coordinate of p4 in the reference frame where p2 is the origin (coordinate 0), p3 is the unity (coordinate 1) and p1 is the point at infinity. This cross ratio is often denoted as ((p1, p2; p3, p4)) (which also equals ((p3, p4; p1, p2)) or ((p2, p1; p4, p3)) or ((p4, p3; p2, p1)) ) and is calculated as

                        p1 - p3   p2 - p3      (p1-p3)(p2-p4)
                        ------- : --------  =  --------------
                        p1 - p4   p2 - p4      (p1-p4)(p2-p3)
   

If three of the given points coincide, the cross ratio is not defined.

In this implementation, a least-squares result is calculated when the points are not exactly collinear.

Definition at line 20 of file vgl_homg_point_2d.txx.

template<class Type >
vcl_ostream& operator<< ( vcl_ostream &  s,
vgl_homg_point_2d< Type > const &  p 
)

Definition at line 33 of file vgl_homg_point_2d.txx.

template<class Type >
vcl_istream& operator>> ( vcl_istream &  s,
vgl_homg_point_2d< Type > &  p 
)

Definition at line 40 of file vgl_homg_point_2d.txx.