19 # include <vcl_msvc_warnings.h> 55 #if 0 // The compiler defaults for these are doing what they should do: 62 {
set(p.
x(),p.
y(),p.
z());
return *
this; }
71 inline Type &
x() {
return x_;}
72 inline Type &
y() {
return y_;}
73 inline Type &
z() {
return z_;}
75 inline Type
x()
const {
return x_;}
76 inline Type
y()
const {
return y_;}
77 inline Type
z()
const {
return z_;}
81 inline void set(Type px, Type py, Type pz) {
x_ = px;
y_ = py;
z_ = pz; }
85 inline void set(Type
const p[3]) {
x_ = p[0];
y_ = p[1];
z_ = p[2]; }
89 inline bool ideal(Type = (Type)0)
const {
return false; }
96 std::istream&
read(std::istream& is);
103 template <
class Type>
111 template <
class Type>
118 template <
class Type>
inline 123 template <
class Type>
inline 131 template <
class Type>
inline 138 template <
class Type>
inline 141 { p.
set(p.
x()+
v.x(), p.
y()+
v.y(), p.
z()+
v.z());
return p; }
145 template <
class Type>
inline 152 template <
class Type>
inline 155 {
return p += (-
v); }
183 template <
class Type>
inline 197 template <
class Type>
inline 201 {
return (p3-p1)/(p2-p1); }
209 template <
class Type>
inline 215 (Type)((1-f)*p1.
y() + f*p2.
y()),
216 (Type)((1-f)*p1.
z() + f*p2.
z()));
223 template <
class Type>
inline 228 (p1.
y() + p2.
y())/2 ,
229 (p1.
z() + p2.
z())/2 );
234 template <
class Type>
inline 240 (p1.
y() + p2.
y() + p3.
y())/3 ,
241 (p1.
z() + p2.
z() + p3.
z())/3 );
246 template <
class Type>
inline 253 (p1.
y() + p2.
y() + p3.
y() + p4.
y())/4 ,
254 (p1.
z() + p2.
z() + p3.
z() + p4.
z())/4 );
260 template <
class Type>
inline 263 int n = (int)(
v.size());
265 Type x = 0, y = 0, z = 0;
266 for (
int i=0; i<n; ++i) x+=
v[i].x(), y+=
v[i].y(), z+=
v[i].z();
274 template <
class Type>
279 template <
class Type>
285 #define VGL_POINT_3D_INSTANTIATE(T) extern "please include vgl/vgl_point_3d.hxx first" 287 #endif // vgl_point_3d_h bool operator==(const vgl_point_3d< Type > &p) const
Test for equality.
double stddev(std::vector< vgl_point_3d< Type > > const &v)
Return the "average deviation" of a set of given points from its centre of gravity.
vgl_point_3d()=default
Default constructor.
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.
std::istream & read(std::istream &is)
Read from stream, possibly with formatting.
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.
direction vector in Euclidean 3D space
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.
Represents a cartesian 3D point.
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.
vgl_point_3d(Type px, Type py, Type pz)
Construct from three Types.
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
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_point_3d< Type >const &p) const
vgl_point_3d(const Type v[3])
Construct from 3-array.
Represents a Euclidean 3D plane.
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.
bool coplanar(l const &l1, l const &l2)
Are two lines coplanar, i.e., do they intersect?.
bool ideal(Type=(Type) 0) const
Return true iff the point is at infinity (an ideal point).
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
void set(Type const p[3])
Set x, y and z.
void set(Type px, Type py, Type pz)
Set x, y and z.
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.