2 #ifndef vgl_homg_line_2d_h 3 #define vgl_homg_line_2d_h 18 # include <vcl_msvc_warnings.h> 55 #if 0 // The defaults for these, as provided by the compiler, are all right: 64 set(
l.a(),
l.b(),
l.c());
return *
this;
72 (
a()*
l.c()==
c()*
l.a() &&
b()*
l.c()==
c()*
l.b() &&
b()*
l.a()==
a()*
l.b());
80 inline T
a()
const {
return a_;}
82 inline T
b()
const {
return b_;}
84 inline T
c()
const {
return c_;}
98 inline void set(T va, T vb, T vc) {assert(va||vb||vc);
a_=va;
b_=vb;
c_=vc;}
102 inline bool ideal(T tol = (T)0)
const 104 #define vgl_Abs(x) ((x)<0?-(x):(x)) // avoid #include of vcl_cmath.h AND vcl_cstdlib.h 119 #define l vgl_homg_line_2d<T> 125 inline bool is_ideal(
l const& line, T tol = (T)0) {
return line.ideal(tol); }
132 return l1.a()*(l2.b()*l3.c()-l3.b()*l2.c())
133 +l2.a()*(l3.b()*l1.c()-l1.b()*l3.c())
134 +l3.a()*(l1.b()*l2.c()-l2.b()*l1.c())==0;
140 std::ostream&
operator<<(std::ostream& s,
l const& line);
145 std::istream&
operator>>(std::istream& s,
l& line);
149 #define VGL_HOMG_LINE_2D_INSTANTIATE(T) extern "please include vgl/vgl_homg_line_2d.hxx first" 151 #endif // vgl_homg_line_2d_h vgl_homg_line_2d(const T v[3])
Construct from 3-vector.
vgl_homg_line_2d(T va, T vb, T vc)
Construct from three Types.
T a() const
Parameter a of line a*x + b*y + c*w = 0.
Represents a homogeneous 2D line.
void get_two_points(vgl_homg_point_2d< T > &p1, vgl_homg_point_2d< T > &p2) const
get two points on the line.
Direction vector in Euclidean 2D space, templated by type of element.
T b() const
Parameter b of line a*x + b*y + c*w = 0.
vgl_homg_line_2d()
Default constructor (Line 1.y==0, the X axis).
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.
bool operator!=(vgl_homg_line_2d< T > const &other) const
bool ideal(T tol=(T) 0) const
Return true iff this line is the line at infinity.
T a_
the data associated with this line.
vgl_vector_2d< double > direction() const
unit vector describing line direction, or (0,0) if line at infinity.
bool operator==(vgl_homg_line_2d< T > const &l) const
the comparison operator.
bool is_ideal(l const &line, T tol=(T) 0)
Return true iff line is the line at infinity.
direction vector in Euclidean 2D space
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
void normalize()
divide all coefficients by sqrt(a^2 + b^2).
T c() const
Parameter c of line a*x + b*y + c*w = 0.
vgl_vector_2d< double > normal() const
unit vector orthogonal to line, or (0,0) if line at infinity.
void set(T va, T vb, T vc)
Set a b c.
Represents a homogeneous 2D point.
v normalized(v const &a)
Return a normalised version of a.