2 #ifndef vgl_homg_plane_3d_hxx_ 3 #define vgl_homg_plane_3d_hxx_ 12 # include <vcl_msvc_warnings.h> 21 : a_(pl.a()), b_(pl.b()), c_(pl.c()), d_(pl.d()) {}
28 : a_(p1.w()*(p2.y()*p3.z()-p2.z()*p3.y())
29 +p2.w()*(p3.y()*p1.z()-p3.z()*p1.y())
30 +p3.w()*(p1.y()*p2.z()-p1.z()*p2.y()))
31 , b_(p1.w()*(p2.z()*p3.x()-p2.x()*p3.z())
32 +p2.w()*(p3.z()*p1.x()-p3.x()*p1.z())
33 +p3.w()*(p1.z()*p2.x()-p1.x()*p2.z()))
34 , c_(p1.w()*(p2.x()*p3.y()-p2.y()*p3.x())
35 +p2.w()*(p3.x()*p1.y()-p3.y()*p1.x())
36 +p3.w()*(p1.x()*p2.y()-p1.y()*p2.x()))
37 , d_(p1.x()*(p2.z()*p3.y()-p2.y()*p3.z())
38 +p2.x()*(p1.y()*p3.z()-p1.z()*p3.y())
39 +p3.x()*(p1.z()*p2.y()-p1.y()*p2.z()))
62 : a_(n.x()*p.w()), b_(n.y()*p.w()), c_(n.z()*p.w()),
63 d_(-(n.x()*p.x()+n.y()*p.y()+n.z()*p.z())) {}
69 double sum = a_*a_ + b_*b_ + c_*c_;
72 double den = std::sqrt(sum);
73 double an= (double)a()/den; a_ = (Type)an;
74 double bn= (double)b()/den; b_ = (Type)bn;
75 double cn= (double)c()/den; c_ = (Type)cn;
76 double dn= (double)d()/den; d_ = (Type)dn;
78 if ((std::fabs(an)>=std::fabs(bn) && std::fabs(an)>=std::fabs(cn) && an < 0) ||
79 (std::fabs(bn)>std::fabs(an) && std::fabs(bn)>=std::fabs(cn) && bn < 0) ||
80 (std::fabs(cn)>std::fabs(an) && std::fabs(cn)>std::fabs(bn) && cn < 0))
81 a_ = -a_, b_ = -b_, c_ = -c_, d_ = -d_;
89 ( (a()*p.
b()==p.
a()*b())
90 && (a()*p.
c()==p.
a()*c())
91 && (a()*p.
d()==p.
a()*d())
92 && (b()*p.
c()==p.
b()*c())
93 && (b()*p.
d()==p.
b()*d())
94 && (c()*p.
d()==p.
c()*d()) );
100 return s <<
" <vgl_homg_plane_3d " 104 << p.
d() <<
" w = 0 >";
107 template <
class Type>
111 s >> a >> b >> c >> d;
116 #undef VGL_HOMG_PLANE_3D_INSTANTIATE 117 #define VGL_HOMG_PLANE_3D_INSTANTIATE(T) \ 118 template class vgl_homg_plane_3d<T >; \ 119 template std::ostream& operator<<(std::ostream&, vgl_homg_plane_3d<T >const&); \ 120 template std::istream& operator>>(std::istream&, vgl_homg_plane_3d<T >&) 122 #endif // vgl_homg_plane_3d_hxx_ homogeneous plane in 3D projective space
point in projective 3D space
void normalize()
divide all coefficients by sqrt(a^2 + b^2 + c^2).
Represents a homogeneous 3D plane.
Type b() const
Return y coefficient.
Type c() const
Return z coefficient.
bool concurrent(l const &l1, l const &l2, l const &l3)
Are three lines concurrent, i.e., do they pass through a common point?.
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?.
vgl_homg_plane_3d()=default
Represents a Euclidean 3D plane.
Type a() const
Return x coefficient.
bool operator==(vgl_homg_plane_3d< Type > const &pl) const
the comparison operator.
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
void set(Type ta, Type tb, Type tc, Type td)
Set equation a*x+b*y+c*z+d*w=0.
a plane in 3D nonhomogeneous space
vgl_homg_point_3d< Type > point_finite() const
Finite point (Could be an ideal point, if the whole line is at infinity.).
vgl_homg_point_3d< Type > point_infinite() const
Infinite point: the intersection of the line with the plane at infinity.
Represents a homogeneous 3D line using two points.