vgl_point_3d< Type > Class Template Reference

#include <vgl_point_3d.h>

List of all members.


Detailed Description

template<class Type>
class vgl_point_3d< Type >

Represents a cartesian 3D point.

Definition at line 29 of file vgl_point_3d.h.


Public Member Functions

 vgl_point_3d ()
 Default constructor.
 vgl_point_3d (Type px, Type py, Type pz)
 Construct from three Types.
 vgl_point_3d (const Type v[3])
 Construct from 3-array.
 vgl_point_3d (vgl_homg_point_3d< Type > const &p)
 Construct from homogeneous point.
 vgl_point_3d (vgl_plane_3d< Type > const &pl1, vgl_plane_3d< Type > const &pl2, vgl_plane_3d< Type > const &pl3)
 Construct from 3 planes (intersection).
bool operator== (const vgl_point_3d< Type > &p) const
 Test for equality.
bool operator!= (vgl_point_3d< Type >const &p) const
Type x () const
Type y () const
Type z () const
void set (Type px, Type py, Type pz)
 Set x, y and z.
void set (Type const p[3])
 Set x, y and z.
bool ideal (Type=(Type) 0) const
 Return true iff the point is at infinity (an ideal point).

Private Attributes

Type x_
Type y_
Type z_

Related Functions

(Note that these are not member functions.)

vcl_istream & read (vcl_istream &is)
 Read from stream, possibly with formatting.
vgl_point_3d< T > vgl_closest_point_origin (vgl_plane_3d< T > const &pl)
 Return the point on the given plane closest to the origin.
vgl_point_3d< T > vgl_closest_point_origin (vgl_line_3d_2_points< T > const &l)
 Return the point on the given line closest to the origin.
vgl_point_3d< T > vgl_closest_point (vgl_line_3d_2_points< T > const &l, vgl_point_3d< T > const &p)
 Return the point on the given line which is closest to the given point.
double vgl_closest_point_t (vgl_line_3d_2_points< T > const &l, vgl_point_3d< T > const &p)
 Return the point on the given line which is closest to the given point.
double vgl_distance (vgl_point_3d< T >const &p1, vgl_point_3d< T >const &p2)
 return the distance between two points.
bool collinear (l const &l1, vgl_point_3d< Type > const &p)
 Does a line pass through a point, i.e., are the point and the line collinear?.
bool coplanar (l const &l1, vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2)
 Are two points coplanar with a line?.
vcl_ostream & operator<< (vcl_ostream &s, vgl_point_3d< Type > const &p)
 Write "<vgl_point_3d x,y,z> " to stream.
vcl_istream & operator>> (vcl_istream &s, vgl_point_3d< Type > &p)
 Read from stream, possibly with formatting.
vgl_vector_3d< Type > operator- (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2)
 The difference of two points is the vector from second to first point.
vgl_point_3d< Type > operator+ (vgl_point_3d< Type > const &p, vgl_vector_3d< Type > const &v)
 Adding a vector to a point gives a new point at the end of that vector.
vgl_point_3d< Type > & operator+= (vgl_point_3d< Type > &p, vgl_vector_3d< Type > const &v)
 Adding a vector to a point gives the point at the end of that vector.
vgl_point_3d< Type > operator- (vgl_point_3d< Type > const &p, vgl_vector_3d< Type > const &v)
 Subtracting a vector from a point is the same as adding the inverse vector.
vgl_point_3d< Type > & operator-= (vgl_point_3d< Type > &p, vgl_vector_3d< Type > const &v)
 Subtracting a vector from a point is the same as adding the inverse vector.
double cross_ratio (vgl_point_3d< T >const &p1, vgl_point_3d< T >const &p2, vgl_point_3d< T >const &p3, vgl_point_3d< T >const &p4)
 cross ratio of four collinear points.
bool collinear (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2, vgl_point_3d< Type > const &p3)
 Are three points collinear, i.e., do they lie on a common line?.
double ratio (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2, vgl_point_3d< Type > const &p3)
 Return the relative distance to p1 wrt p1-p2 of p3.
vgl_point_3d< Type > midpoint (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2, Type f=(Type) 0.5)
 Return the point at a given ratio wrt two other points.
vgl_point_3d< Type > centre (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2)
 Return the point at the centre of gravity of two given points.
vgl_point_3d< Type > centre (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2, vgl_point_3d< Type > const &p3)
 Return the point at the centre of gravity of three given points.
vgl_point_3d< Type > centre (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2, vgl_point_3d< Type > const &p3, vgl_point_3d< Type > const &p4)
 Return the point at the centre of gravity of four given points.
vgl_point_3d< Type > centre (vcl_vector< vgl_point_3d< Type > > const &v)
 Return the point at the centre of gravity of a set of given points.
bool coplanar (vgl_point_3d< Type > const &p1, vgl_point_3d< Type > const &p2, vgl_point_3d< Type > const &p3, vgl_point_3d< Type > const &p4)
 Return true iff the 4 points are coplanar, i.e., they belong to a common plane.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 41 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type >::vgl_point_3d ( Type  px,
Type  py,
Type  pz 
) [inline]

Construct from three Types.

Definition at line 44 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type >::vgl_point_3d ( const Type  v[3]  )  [inline]

Construct from 3-array.

Definition at line 47 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type >::vgl_point_3d ( vgl_homg_point_3d< Type > const &  p  ) 

Construct from homogeneous point.

Definition at line 17 of file vgl_point_3d.txx.

template<class Type>
vgl_point_3d< Type >::vgl_point_3d ( vgl_plane_3d< Type > const &  pl1,
vgl_plane_3d< Type > const &  pl2,
vgl_plane_3d< Type > const &  pl3 
)

Construct from 3 planes (intersection).

Definition at line 24 of file vgl_point_3d.txx.


Member Function Documentation

template<class Type>
bool vgl_point_3d< Type >::operator== ( const vgl_point_3d< Type > &  p  )  const [inline]

Test for equality.

Definition at line 68 of file vgl_point_3d.h.

template<class Type>
bool vgl_point_3d< Type >::operator!= ( vgl_point_3d< Type >const &  p  )  const [inline]

Definition at line 72 of file vgl_point_3d.h.

template<class Type>
Type vgl_point_3d< Type >::x (  )  const [inline]

Definition at line 77 of file vgl_point_3d.h.

template<class Type>
Type vgl_point_3d< Type >::y (  )  const [inline]

Definition at line 78 of file vgl_point_3d.h.

template<class Type>
Type vgl_point_3d< Type >::z (  )  const [inline]

Definition at line 79 of file vgl_point_3d.h.

template<class Type>
void vgl_point_3d< Type >::set ( Type  px,
Type  py,
Type  pz 
) [inline]

Set x, y and z.

Note that x, y, or z cannot be set individually

Definition at line 83 of file vgl_point_3d.h.

template<class Type>
void vgl_point_3d< Type >::set ( Type const  p[3]  )  [inline]

Set x, y and z.

Note that x, y, or z cannot be set individually

Definition at line 86 of file vgl_point_3d.h.

template<class Type>
bool vgl_point_3d< Type >::ideal ( Type  = (Type)0  )  const [inline]

Return true iff the point is at infinity (an ideal point).

Always returns false.

Definition at line 90 of file vgl_point_3d.h.


Friends And Related Function Documentation

template<class Type>
vcl_istream & vgl_point_3d< Type >::read ( vcl_istream &  is  )  [related]

Read from stream, possibly with formatting.

Either just reads three blank-separated numbers, or reads three comma-separated numbers, or reads three numbers in parenthesized form "(123, 321, 567)"

Definition at line 63 of file vgl_point_3d.txx.

template<class Type>
vgl_point_3d< T > vgl_closest_point_origin ( vgl_plane_3d< T > const &  pl  )  [related]

Return the point on the given plane closest to the origin.

template<class Type>
vgl_point_3d< T > vgl_closest_point_origin ( vgl_line_3d_2_points< T > const &  l  )  [related]

Return the point on the given line closest to the origin.

template<class Type>
vgl_point_3d< T > vgl_closest_point ( vgl_line_3d_2_points< T > const &  l,
vgl_point_3d< T > const &  p 
) [related]

Return the point on the given line which is closest to the given point.

template<class Type>
double vgl_closest_point_t ( vgl_line_3d_2_points< T > const &  l,
vgl_point_3d< T > const &  p 
) [related]

Return the point on the given line which is closest to the given point.

The closest point is expressed in parametric form.

See also:
vgl_line_3d_2_points::point_t()

vgl_closest_point(vgl_line_3d_2_points<T> const&, vgl_point_3d<T> const&)

template<class Type>
double vgl_distance ( vgl_point_3d< T >const &  p1,
vgl_point_3d< T >const &  p2 
) [related]

return the distance between two points.

Definition at line 110 of file vgl_distance.h.

template<class Type>
bool collinear ( l const &  l1,
vgl_point_3d< Type > const &  p 
) [related]

Does a line pass through a point, i.e., are the point and the line collinear?.

Definition at line 92 of file vgl_line_3d_2_points.h.

template<class Type>
bool coplanar ( l const &  l1,
vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2 
) [related]

Are two points coplanar with a line?.

Definition at line 115 of file vgl_line_3d_2_points.h.

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

Write "<vgl_point_3d x,y,z> " to stream.

template<class Type>
vcl_istream & operator>> ( vcl_istream &  is,
vgl_point_3d< Type > &  p 
) [related]

Read from stream, possibly with formatting.

Either just reads three blank-separated numbers, or reads three comma-separated numbers, or reads three numbers in parenthesized form "(123, 321, 567)"

Definition at line 93 of file vgl_point_3d.txx.

template<class Type>
vgl_vector_3d< Type > operator- ( vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2 
) [related]

The difference of two points is the vector from second to first point.

Definition at line 125 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type > operator+ ( vgl_point_3d< Type > const &  p,
vgl_vector_3d< Type > const &  v 
) [related]

Adding a vector to a point gives a new point at the end of that vector.

Note that vector + point is not defined! It's always point + vector.

Definition at line 133 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type > & operator+= ( vgl_point_3d< Type > &  p,
vgl_vector_3d< Type > const &  v 
) [related]

Adding a vector to a point gives the point at the end of that vector.

Definition at line 140 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type > operator- ( vgl_point_3d< Type > const &  p,
vgl_vector_3d< Type > const &  v 
) [related]

Subtracting a vector from a point is the same as adding the inverse vector.

Definition at line 147 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type > & operator-= ( vgl_point_3d< Type > &  p,
vgl_vector_3d< Type > const &  v 
) [related]

Subtracting a vector from a point is the same as adding the inverse vector.

Definition at line 154 of file vgl_point_3d.h.

template<class Type>
double cross_ratio ( vgl_point_3d< T >const &  p1,
vgl_point_3d< T >const &  p2,
vgl_point_3d< T >const &  p3,
vgl_point_3d< T >const &  p4 
) [related]

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.

template<class Type>
bool collinear ( vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2,
vgl_point_3d< Type > const &  p3 
) [related]

Are three points collinear, i.e., do they lie on a common line?.

Definition at line 185 of file vgl_point_3d.h.

template<class Type>
double ratio ( vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2,
vgl_point_3d< Type > const &  p3 
) [related]

Return the relative distance to p1 wrt p1-p2 of p3.

The three points should be collinear and p2 should not equal p1. This is the coordinate of p3 in the affine 1D reference frame (p1,p2). If p3=p1, the ratio is 0; if p1=p3, the ratio is 1. The mid point of p1 and p2 has ratio 0.5. Note that the return type is double, not Type, since the ratio of e.g. two vgl_vector_3d<int> need not be an int.

Definition at line 199 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type > midpoint ( vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2,
Type  f = (Type)0.5 
) [related]

Return the point at a given ratio wrt two other points.

By default, the mid point (ratio=0.5) is returned. Note that the third argument is Type, not double, so the midpoint of e.g. two vgl_point_3d<int> is not a valid concept. But the reflection point of p2 wrt p1 is: in that case f=-1.

Definition at line 211 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type > centre ( vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2 
) [related]

Return the point at the centre of gravity of two given points.

Identical to midpoint(p1,p2).

Definition at line 225 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type > centre ( vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2,
vgl_point_3d< Type > const &  p3 
) [related]

Return the point at the centre of gravity of three given points.

Definition at line 236 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type > centre ( vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2,
vgl_point_3d< Type > const &  p3,
vgl_point_3d< Type > const &  p4 
) [related]

Return the point at the centre of gravity of four given points.

Definition at line 248 of file vgl_point_3d.h.

template<class Type>
vgl_point_3d< Type > centre ( vcl_vector< vgl_point_3d< Type > > const &  v  )  [related]

Return the point at the centre of gravity of a set of given points.

Beware of possible rounding errors when Type is e.g. int.

Definition at line 262 of file vgl_point_3d.h.

template<class Type>
bool coplanar ( vgl_point_3d< Type > const &  p1,
vgl_point_3d< Type > const &  p2,
vgl_point_3d< Type > const &  p3,
vgl_point_3d< Type > const &  p4 
) [related]

Return true iff the 4 points are coplanar, i.e., they belong to a common plane.

Definition at line 274 of file vgl_point_3d.h.


Member Data Documentation

template<class Type>
Type vgl_point_3d< Type >::x_ [private]

Definition at line 32 of file vgl_point_3d.h.

template<class Type>
Type vgl_point_3d< Type >::y_ [private]

Definition at line 33 of file vgl_point_3d.h.

template<class Type>
Type vgl_point_3d< Type >::z_ [private]

Definition at line 34 of file vgl_point_3d.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 8 05:07:57 2010 for core/vgl by  doxygen 1.5.1