8 #error This class is not to be included by the user directly. Use Origin3d.h or Origin3d.h instead.
20 ORIGIN3(REAL x, REAL y, REAL z);
25 REAL norm_inf()
const {
return std::max(std::max(std::fabs(_data[0]), std::fabs(_data[1])), std::fabs(_data[2])); }
26 REAL norm()
const {
return std::sqrt(norm_sq()); }
27 REAL norm_sq()
const {
return sqr(_data[0]) + sqr(_data[1]) + sqr(_data[2]); }
28 static REAL norm(
const ORIGIN3& v) {
return std::sqrt(norm_sq(v)); }
29 static REAL norm_sq(
const ORIGIN3& v) {
return v.norm_sq(); }
30 void normalize() { assert(norm() > std::numeric_limits<REAL>::epsilon()); operator/=(norm()); }
32 REAL dot(
const ORIGIN3& v)
const {
return _data[0]*v._data[0] + _data[1]*v._data[1] + _data[2]*v._data[2]; }
33 static REAL dot(
const ORIGIN3& v1,
const ORIGIN3& v2) {
return v1.dot(v2); }
34 ORIGIN3& set_zero() { _data[0] = _data[1] = _data[2] = (REAL) 0.0;
return *
this; }
35 ORIGIN3& set_zero(
unsigned m) { assert(m==3);
return set_zero(); }
36 ORIGIN3& set_zero(
unsigned m,
unsigned n) { assert(m==3 && n==1);
return set_zero(); }
37 static ORIGIN3 zero() {
return ORIGIN3((REAL) 0.0, (REAL) 0.0, (REAL) 0.0); }
48 ORIGIN3& operator*=(REAL scalar) { _data[0] *= scalar; _data[1] *= scalar; _data[2] *= scalar;
return *
this; }
49 ORIGIN3& operator/=(REAL scalar) { _data[0] /= scalar; _data[1] /= scalar; _data[2] /= scalar;
return *
this; }
50 ORIGIN3 operator*(REAL scalar)
const {
ORIGIN3 v = *
this; v *= scalar;
return v; }
51 ORIGIN3 operator/(REAL scalar)
const {
ORIGIN3 v = *
this; v /= scalar;
return v; }
52 ORIGIN3 operator-()
const {
return ORIGIN3(-_data[0], -_data[1], -_data[2]); }
53 REAL* data() {
return _data; }
54 const REAL* data()
const {
return _data; }
55 REAL& operator[](
const unsigned i);
56 const REAL& operator[](
const unsigned i)
const;
57 REAL* data(
unsigned i);
58 const REAL* data(
unsigned i)
const;
59 const REAL& x()
const {
return _data[0]; }
60 const REAL& y()
const {
return _data[1]; }
61 const REAL& z()
const {
return _data[2]; }
62 REAL& x() {
return _data[0]; }
63 REAL& y() {
return _data[1]; }
64 REAL& z() {
return _data[2]; }
77 unsigned size()
const {
return 3; }
78 unsigned rows()
const {
return 3; }
79 unsigned columns()
const {
return 1; }
80 unsigned inc()
const {
return 1; }
81 unsigned leading_dim()
const {
return 3; }
83 ORIGIN3&
resize(
unsigned m,
unsigned n,
bool preserve =
false);
88 static REAL sqr(REAL x) {
return x*x; }
91 inline ORIGIN3 operator*(REAL scalar,
const ORIGIN3& v) {
return v * scalar; }
94 inline std::ostream& operator<<(std::ostream& out,
const ORIGIN3& v)
96 out <<
"[" << v[0] <<
" " << v[1] <<
" " << v[2] <<
"] ";
ORIGIN3 & operator=(const ORIGIN3 &o)
Assigns the values from one origin to this origin.
Definition: Origin3.cpp:67
A construct for iterating over a rectangular block of a matrix.
Definition: RowIterator.h:210
ORIGIN3 & operator+=(const ORIGIN3 &v)
Adds two origins.
Definition: Origin3.cpp:116
ORIGIN3 operator+(const ORIGIN3 &o) const
Adds two origins.
Definition: Origin3.cpp:96
ORIGIN3 operator-(const ORIGIN3 &v) const
Subtracts one origin from another.
Definition: Origin3.cpp:135
A generic N-dimensional floating point vector.
Definition: SharedVectorN.h:77
A generic N-dimensional floating point vector.
Definition: SharedVectorN.h:15
A three-dimensional floating point vector used for representing points and vectors in 3D with associa...
Definition: Vector3.h:15
ORIGIN3 & operator-=(const ORIGIN3 &v)
Subtracts an origin from this.
Definition: Origin3.cpp:145
A three-dimensional floating point vector used for representing points and vectors in 3D and without ...
Definition: Origin3.h:16
A construct for iterating over a rectangular block of a matrix.
Definition: ColumnIterator.h:12
A construct for iterating over a rectangular block of a matrix.
Definition: ColumnIterator.h:215
static ORIGIN3 cross(const ORIGIN3 &v1, const ORIGIN3 &v2)
Computes the cross-product of two vectors.
Definition: Origin3.cpp:294
A construct for iterating over a rectangular block of a matrix.
Definition: RowIterator.h:12
ORIGIN3 & resize(unsigned m, bool preserve=false)
Does nothing.
Definition: Origin3.cpp:76