52#ifndef MATH_VECTOR3_HPP
53#define MATH_VECTOR3_HPP
66 template<
typename Real>
69 using ElemType = Real;
70 using ElemPoinerType = Real*;
86 inline Vector3<Real>& operator=(
const Vector<Real, 3>& v) {
87 if (
this == &v) {
return *
this; }
96 inline Real&
x() {
return this->data_[0]; }
102 inline Real
x()
const {
return this->data_[0]; }
108 inline Real&
y() {
return this->data_[1]; }
114 inline Real
y()
const {
return this->data_[1]; }
120 inline Real&
z() {
return this->data_[2]; }
126 inline Real
z()
const {
return this->data_[2]; }
135 template<
typename Real>
139 result.
x() = v1.
y() * v2.
z() - v1.
z() * v2.
y();
140 result.
y() = v1.
z() * v2.
x() - v1.
x() * v2.
z();
141 result.
z() = v1.
x() * v2.
y() - v1.
y() * v2.
x();
153 template<
typename Real>
155 return (p.
z() * s.
y() + p.
y()) * s.
x() + p.
x();
158 using Vector3i = Vector3<int>;
160 using Vector3d = Vector3<RealType>;
162 const Vector3d V3Zero(0.0, 0.0, 0.0);
163 const Vector3d V3X(1.0, 0.0, 0.0);
164 const Vector3d V3Y(0.0, 1.0, 0.0);
165 const Vector3d V3Z(0.0, 0.0, 1.0);
Real & z()
Returns reference of the third element of Vector3.
Real z() const
Returns the third element of Vector3.
Real & x()
Returns reference of the first element of Vector3.
Vector3(Real x, Real y, Real z)
Constructs and initializes a Vector3 from x, y, z coordinates.
Real y() const
Returns the second element of Vector3.
Real x() const
Returns the first element of Vector3.
Vector3(Real *array)
Constructs and initializes from an array.
Real & y()
Returns reference of the second element of Vector3.
Vector< Real, Dim > & operator=(const Vector< Real, Dim > &v)
copy assignment operator
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Vector3< Real > cross(const Vector3< Real > &v1, const Vector3< Real > &v2)
Returns the cross product of two Vectors.
std::size_t Vlinear(const Vector2< std::size_t > &p, const Vector2< std::size_t > &s)
Returns the linear indexing for size_t vectors.