2 #ifndef vgl_homg_point_3d_hxx_ 3 #define vgl_homg_point_3d_hxx_ 9 # include <vcl_msvc_warnings.h> 18 set(-l1.
ny()*l2.
nz()*l3.
d()-l2.
ny()*l3.
nz()*l1.
d()-l3.
ny()*l1.
nz()*l2.
d()
31 return (
this==&other) ||
32 (x()*other.
y() == y()*other.
x() &&
33 x()*other.
z() == z()*other.
x() &&
34 x()*other.
w() == w()*other.
x() &&
35 y()*other.
z() == z()*other.
y() &&
36 y()*other.
w() == w()*other.
y() &&
37 z()*other.
w() == w()*other.
z());
60 return (p1.
x()*p2.
y()-p1.
y()*p2.
x())*p3.
z()
61 +(p3.
x()*p1.
y()-p3.
y()*p1.
x())*p2.
z()
62 +(p2.
x()*p3.
y()-p2.
y()*p3.
x())*p1.
z()==0;
70 double Num_x = (p1.
x()*p3.
w()-p3.
x()*p1.
w())*(p2.
x()*p4.
w()-p4.
x()*p2.
w());
71 double Num_y = (p1.
y()*p3.
w()-p3.
y()*p1.
w())*(p2.
y()*p4.
w()-p4.
y()*p2.
w());
72 double Num_z = (p1.
z()*p3.
w()-p3.
z()*p1.
w())*(p2.
z()*p4.
w()-p4.
z()*p2.
w());
73 double Den_x = (p1.
x()*p4.
w()-p4.
x()*p1.
w())*(p2.
x()*p3.
w()-p3.
x()*p2.
w());
74 double Den_y = (p1.
y()*p4.
w()-p4.
y()*p1.
w())*(p2.
y()*p3.
w()-p3.
y()*p2.
w());
75 double Den_z = (p1.
z()*p4.
w()-p4.
z()*p1.
w())*(p2.
z()*p3.
w()-p3.
z()*p2.
w());
76 if (Den_x == Den_y && Den_y == Den_z)
return (Num_x+Num_y+Num_z)/3/Den_x;
77 else return (Den_x*Num_x+Den_y*Num_y+Den_z*Num_z)/(Den_x*Den_x+Den_y*Den_y+Den_z*Den_z);
83 return s <<
" <vgl_homg_point_3d (" 84 << p.
x() <<
',' << p.
y() <<
',' 85 << p.
z() <<
',' << p.
w() <<
") >";
92 s >> x >> y >> z >> w;
97 #undef VGL_HOMG_POINT_3D_INSTANTIATE 98 #define VGL_HOMG_POINT_3D_INSTANTIATE(T) \ 99 template class vgl_homg_point_3d<T >; \ 100 template bool collinear(vgl_homg_point_3d<T >const&,vgl_homg_point_3d<T >const&,vgl_homg_point_3d<T >const&); \ 101 template double cross_ratio(vgl_homg_point_3d<T >const&, vgl_homg_point_3d<T >const&, \ 102 vgl_homg_point_3d<T >const&, vgl_homg_point_3d<T >const&); \ 103 template std::ostream& operator<<(std::ostream&, vgl_homg_point_3d<T >const&); \ 104 template std::istream& operator>>(std::istream&, vgl_homg_point_3d<T >&) 106 #endif // vgl_homg_point_3d_hxx_ homogeneous plane in 3D projective space
point in projective 3D space
Represents a homogeneous 3D plane.
double cross_ratio(vgl_homg_point_1d< T >const &p1, vgl_homg_point_1d< T >const &p2, vgl_homg_point_1d< T >const &p3, vgl_homg_point_1d< T >const &p4)
cross ratio of four points.
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
Type d() const
Return homogeneous scaling coefficient.
Represents a homogeneous 3D point.
bool collinear(l const &l1, vgl_homg_point_3d< Type > const &p)
Does a line pass through a point, i.e., are the point and the line collinear?.
bool operator==(vgl_homg_point_3d< Type > const &other) const
the comparison operator.
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
void set(Type px, Type py, Type pz, Type pw=(Type) 1)
Set x,y,z,w.
vgl_homg_point_3d()
Default constructor with (0,0,0,1).
bool ideal(Type tol=(Type) 0) const
Return true iff the point is at infinity (an ideal point).
bool parallel(v const &a, v const &b, double eps=0.0)
are two vectors parallel, i.e., is one a scalar multiple of the other?.