28 #include <openbabel/babelconfig.h> 31 #define RAD_TO_DEG (180.0/M_PI) 35 #define DEG_TO_RAD (M_PI/180.0) 47 double _vx, _vy, _vz ;
51 vector3 (
const double inX=0.0,
const double inY=0.0,
const double inZ=0.0):
52 _vx(inX), _vy(inY), _vz(inZ)
55 _vx(inV[0]), _vy(inV[1]), _vz(inV[2])
59 _vx(v._vx), _vy(v._vy), _vz(v._vz)
75 iterator
begin() {
return &_vx; }
78 iterator
end() {
return &_vx + 3; }
81 const_iterator
begin()
const {
return &_vx; }
84 const_iterator
end()
const {
return &_vx + 3; }
87 void Set(
const double inX,
const double inY,
const double inZ)
94 void Set(
const double *c)
139 double operator[] (
unsigned int i)
const;
206 double inv = 1.0 / c;
207 return( (*
this) *= inv );
215 void randomUnitVector();
224 bool CanBeNormalized ()
const;
229 return _vx*_vx + _vy*_vy + _vz*_vz;
234 return sqrt( length_2() );
237 const double &
x ()
const 242 const double &
y ()
const 247 const double &
z ()
const 279 return ! ( (*this) == other );
290 bool IsApprox(
const vector3 & other,
const double & precision )
const;
298 double dx = x() - vv.
x();
299 double dy = y() - vv.
y();
300 double dz = z() - vv.
z();
301 return( dx*dx + dy*dy + dz*dz );
306 bool createOrthoVector(
vector3 &v)
const;
357 return v1.
x()*v2.
x() + v1.
y()*v2.
y() + v1.
z()*v2.
z() ;
391 #endif // OB_VECTOR_H const vector3 VZero
The zero vector: <0.0, 0.0, 0.0>
vector3 operator/(const vector3 &v, const double &c)
Division by a scalar.
Definition: vector3.h:340
double length() const
Definition: vector3.h:232
const_iterator end() const
/return const_iterator to end
Definition: vector3.h:84
iterator begin()
Definition: vector3.h:75
vector3 operator+(const vector3 &v1, const vector3 &v2)
Vector addition.
Definition: vector3.h:315
void Set(const double inX, const double inY, const double inZ)
Set x,y and z-component of a vector.
Definition: vector3.h:87
void SetZ(const double inZ)
Access function to set the z-coordinate of the vector.
Definition: vector3.h:111
~vector3()
Destructor.
Definition: vector3.h:63
const vector3 VX
The x unit vector: <1.0, 0.0, 0.0>
double vectorAngle(const vector3 &v1, const vector3 &v2)
Calculate the angle between vectors (in degrees)
Definition: vector3.cpp:194
void SetY(const double inY)
Access function to set the y-coordinate of the vector.
Definition: vector3.h:106
const double & x() const
Access function to get the x-coordinate of the vector.
Definition: vector3.h:237
double length_2() const
Definition: vector3.h:227
vector3 cross(const vector3 &, const vector3 &)
Cross product of two vectors.
Definition: vector3.cpp:163
bool IsApprox(const double &a, const double &b, const double precision=1e-11)
Definition: obutil.h:226
void Set(const double *c)
Set x,y and z-component of a vector from c[0]..c[2].
Definition: vector3.h:94
double distSq(const vector3 &vv) const
}@
Definition: vector3.h:296
std::ptrdiff_t difference_type
A signed integral type for differences between two iterators.
Definition: vector3.h:72
double dot(const vector3 &v1, const vector3 &v2)
Dot product of two vectors.
Definition: vector3.h:355
iterator end()
Definition: vector3.h:78
vector3(const vector3 &v)
Copy Constructor.
Definition: vector3.h:58
double GetZ() const
Access function to get the z-coordinate of the vector.
Definition: vector3.h:126
const double * const_iterator
A random access iterator over const x, y, z.
Definition: vector3.h:69
vector3 operator-(const vector3 &v1, const vector3 &v2)
Vector subtraction.
Definition: vector3.h:320
const double * AsArray() const
Definition: vector3.h:151
double & x()
Access function to set the x-coordinate of the vector.
Definition: vector3.h:252
double GetX() const
Access function to get the x-coordinate of the vector.
Definition: vector3.h:116
const double & y() const
Access function to get the y-coordinate of the vector.
Definition: vector3.h:242
double Point2Plane(vector3 a, vector3 b, vector3 c, vector3 d)
Calculate the distance of point a to the plane determined by b,c,d.
Definition: vector3.cpp:316
double CalcTorsionAngle(const vector3 &a, const vector3 &b, const vector3 &c, const vector3 &d)
Calculate the torsion angle between vectors (in degrees)
Definition: vector3.cpp:222
Represents a vector in 3-dimensional real space.
Definition: vector3.h:44
const vector3 VY
The y unit vector: <0.0, 1.0, 0.0>
vector3(const double inX=0.0, const double inY=0.0, const double inZ=0.0)
Constructor.
Definition: vector3.h:51
double & y()
Access function to set the y-coordinate of the vector.
Definition: vector3.h:257
Represents a real 3x3 matrix.
Definition: matrix3x3.h:42
const vector3 VZ
The z unit vector: <0.0, 0.0, 1.0>
std::ostream & operator<<(std::ostream &, const vector3 &)
Prints a representation of the vector as a row vector of the form "<0.1,1,2>".
Definition: vector3.cpp:109
double Point2PlaneAngle(const vector3 a, const vector3 b, const vector3 c, const vector3 d)
Calculate the angle between point a and the plane determined by b,c,d.
Definition: vector3.cpp:322
double GetY() const
Access function to get the y-coordinate of the vector.
Definition: vector3.h:121
double Point2PlaneSigned(vector3 a, vector3 b, vector3 c, vector3 d)
Calculate the signed distance of point a to the plane determined by b,c,d.
Definition: vector3.cpp:308
double & z()
Access function to set the z-coordinate of the vector.
Definition: vector3.h:262
const_iterator begin() const
/return const_iterator to beginning
Definition: vector3.h:81
double * iterator
A random access iterator over x, y, z.
Definition: vector3.h:66
vector3 operator*(const double &c, const vector3 &v)
Multiplication with a scalar.
Definition: vector3.h:330
const double & z() const
Access function to get the z-coordinate of the vector.
Definition: vector3.h:247
void Get(double *c)
Set c[0]..c[2] to the components of the vector.
Definition: vector3.h:132
double Point2Line(const vector3 &a, const vector3 &b, const vector3 &c)
Calculate the distance of a point a to a line determined by b and c.
Definition: vector3.cpp:337
vector3(double inV[3])
Definition: vector3.h:54
bool operator==(const OBBitVec &bv1, const OBBitVec &bv2)
Definition: bitvec.cpp:525
void SetX(const double inX)
Access function to set the x-coordinate of the vector.
Definition: vector3.h:101
Global namespace for all Open Babel code.
Definition: alias.h:22