19 # include <vcl_msvc_warnings.h> 53 #if 0 // The compiler defaults for these are doing what they should do: 60 {
x_ = p.
x();
y_ = p.
y();
return *
this; }
65 {
return this==&p || (
x_==p.
x() &&
y_==p.
y()); }
71 inline Type &
x() {
return x_;}
72 inline Type &
y() {
return y_;}
74 inline Type
x()
const {
return x_;}
75 inline Type
y()
const {
return y_;}
79 inline void set (Type px, Type py){
x_ = px;
y_ = py; }
82 inline void set (Type
const p[2]) {
x_ = p[0];
y_ = p[1]; }
86 inline bool ideal(Type = (Type)0)
const {
return false; }
92 std::istream&
read(std::istream& is);
107 template <
class Type>
114 template <
class Type>
inline 119 template <
class Type>
inline 127 template <
class Type>
inline 134 template <
class Type>
inline 137 { p.
set(p.
x()+
v.x(), p.
y()+
v.y());
return p; }
141 template <
class Type>
inline 148 template <
class Type>
inline 151 {
return p += (-
v); }
179 template <
class Type>
inline 193 template <
class Type>
inline 197 {
return (p3-p1)/(p2-p1); }
205 template <
class Type>
inline 211 (Type)((1-f)*p1.
y() + f*p2.
y()));
218 template <
class Type>
inline 223 (p1.
y() + p2.
y())/2 );
228 template <
class Type>
inline 234 (p1.
y() + p2.
y() + p3.
y())/3 );
239 template <
class Type>
inline 246 (p1.
y() + p2.
y() + p3.
y() + p4.
y())/4 );
252 template <
class Type>
inline 258 for (
int i=0; i<n; ++i) x+=
v[i].x(), y+=
v[i].y();
262 #define VGL_POINT_2D_INSTANTIATE(T) extern "please include vgl/vgl_point_2d.hxx first" 264 #endif // vgl_point_2d_h bool operator!=(vgl_point_2d< Type >const &p) const
vgl_homg_point_1d< T > centre(vgl_homg_point_1d< T > const &p1, vgl_homg_point_1d< T > const &p2)
Return the point at the centre of gravity of two given points.
vgl_homg_point_1d< T > & operator-=(vgl_homg_point_1d< T > &p, T v)
Subtracting a number from a point is the same as adding the inverse number.
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.
vgl_point_2d()=default
Default constructor.
vgl_homg_point_1d< T > & operator+=(vgl_homg_point_1d< T > &p, T v)
Adding a number to a 1-D point translates that point.
bool operator==(vgl_point_2d< Type >const &p) const
Test for equality.
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
bool ideal(Type=(Type) 0) const
Return true iff the point is at infinity (an ideal 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?.
void set(Type px, Type py)
Set x and y.
Represents a Euclidean 2D line.
vgl_homg_point_1d< T > operator+(vgl_homg_point_1d< T > const &p, T v)
Adding a number to a 1-D point translates that point.
double ratio(vgl_homg_point_1d< T > const &p1, vgl_homg_point_1d< T > const &p2, vgl_homg_point_1d< T > const &p3)
Return the relative distance to p1 wrt p1-p2 of p3.
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.
vgl_point_2d(Type const v[2])
Construct from 2-array.
void set(Type const p[2])
Set x and y.
Represents a cartesian 2D point.
vgl_point_2d(Type px, Type py)
Construct from two Types.
std::istream & read(std::istream &is)
Read from stream, possibly with formatting.
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?.
vgl_homg_point_1d< T > midpoint(vgl_homg_point_1d< T > const &p1, vgl_homg_point_1d< T > const &p2, T f=0.5)
Return the point at a given ratio wrt two other points.
T operator-(vgl_homg_point_1d< T > const &p1, vgl_homg_point_1d< T > const &p2)
The difference of two points is the distance between the two.