37 #ifndef RVO_VECTOR3_H_ 38 #define RVO_VECTOR3_H_ 77 RVO_API
inline explicit Vector3(
const float val[3])
90 RVO_API
inline Vector3(
float x,
float y,
float z)
101 RVO_API
inline float x()
const {
return val_[0]; }
107 RVO_API
inline float y()
const {
return val_[1]; }
113 RVO_API
inline float z()
const {
return val_[2]; }
120 RVO_API
inline float operator[](size_t i)
const {
return val_[i]; }
127 RVO_API
inline float &
operator[](size_t i) {
return val_[i]; }
145 return val_[0] * vector
[0
] + val_[1] * vector
[1
] + val_[2] * vector
[2
];
155 return Vector3(val_[0] * scalar
, val_[1] * scalar
, val_[2] * scalar
);
165 const float invScalar = 1.0f / scalar;
167 return Vector3(val_[0] * invScalar
, val_[1] * invScalar
, val_[2] * invScalar
);
197 return val_[0] == vector
[0
] && val_[1] == vector
[1
] && val_[2] == vector
[2
];
207 return val_[0] != vector
[0
] || val_[1] != vector
[1
] || val_[2] != vector
[2
];
231 const float invScalar = 1.0f / scalar;
233 val_[0] *= invScalar;
234 val_[1] *= invScalar;
235 val_[2] *= invScalar;
248 val_[0] += vector
[0
];
249 val_[1] += vector
[1
];
250 val_[2] += vector
[2
];
262 val_[0] -= vector
[0
];
263 val_[1] -= vector
[1
];
264 val_[2] -= vector
[2
];
305 inline std::ostream &operator<<(std::ostream &os,
const Vector3 &vector)
307 os <<
"(" << vector
[0
] <<
"," << vector
[1
] <<
"," << vector
[2
] <<
")";
320 return std::sqrt(vector
* vector);
331 return vector
* vector;
342 return vector
/ abs(vector
);
RVO_API float operator*(const Vector3 &vector) const
Computes the dot product of this three-dimensional vector with the specified three-dimensional vector...
Definition: Vector3.h:143
RVO_API bool operator==(const Vector3 &vector) const
Tests this three-dimensional vector for equality with the specified three-dimensional vector...
Definition: Vector3.h:195
Vector3 normalize(const Vector3 &vector)
Computes the normalization of the specified three-dimensional vector.
Definition: Vector3.h:340
RVO_API Vector3 operator-() const
Computes the negation of this three-dimensional vector.
Definition: Vector3.h:133
RVO_API Vector3 operator-(const Vector3 &vector) const
Computes the vector difference of this three-dimensional vector with the specified three-dimensional ...
Definition: Vector3.h:185
RVO_API Vector3 operator/(float scalar) const
Computes the scalar division of this three-dimensional vector with the specified scalar value...
Definition: Vector3.h:163
RVO_API Vector3(const Vector3 &vector)
Constructs and initializes a three-dimensional vector from the specified three-dimensional vector...
Definition: Vector3.h:66
Vector3 operator*(float scalar, const Vector3 &vector)
Computes the scalar multiplication of the specified three-dimensional vector with the specified scala...
Definition: Vector3.h:281
float abs(const Vector3 &vector)
Computes the length of a specified three-dimensional vector.
Definition: Vector3.h:318
RVO_API Vector3 operator+(const Vector3 &vector) const
Computes the vector sum of this three-dimensional vector with the specified three-dimensional vector...
Definition: Vector3.h:175
float absSq(const Vector3 &vector)
Computes the squared length of a specified three-dimensional vector.
Definition: Vector3.h:329
RVO_API Vector3 operator*(float scalar) const
Computes the scalar multiplication of this three-dimensional vector with the specified scalar value...
Definition: Vector3.h:153
RVO_API Vector3()
Constructs and initializes a three-dimensional vector instance to zero.
Definition: Vector3.h:55
RVO_API float z() const
Returns the z-coordinate of this three-dimensional vector.
Definition: Vector3.h:113
RVO_API Vector3 & operator/=(float scalar)
Sets the value of this three-dimensional vector to the scalar division of itself with the specified s...
Definition: Vector3.h:229
RVO_API float y() const
Returns the y-coordinate of this three-dimensional vector.
Definition: Vector3.h:107
RVO_API float operator[](size_t i) const
Returns the specified coordinate of this three-dimensional vector.
Definition: Vector3.h:120
RVO_API float x() const
Returns the x-coordinate of this three-dimensional vector.
Definition: Vector3.h:101
RVO_API Vector3(const float val[3])
Constructs and initializes a three-dimensional vector from the specified three-element array...
Definition: Vector3.h:77
Vector3 cross(const Vector3 &vector1, const Vector3 &vector2)
Computes the cross product of the specified three-dimensional vectors.
Definition: Vector3.h:293
RVO_API bool operator!=(const Vector3 &vector) const
Tests this three-dimensional vector for inequality with the specified three-dimensional vector...
Definition: Vector3.h:205
RVO_API Vector3 & operator*=(float scalar)
Sets the value of this three-dimensional vector to the scalar multiplication of itself with the speci...
Definition: Vector3.h:215
RVO_API Vector3 & operator+=(const Vector3 &vector)
Sets the value of this three-dimensional vector to the vector sum of itself with the specified three-...
Definition: Vector3.h:246
RVO_API float & operator[](size_t i)
Returns a reference to the specified coordinate of this three-dimensional vector. ...
Definition: Vector3.h:127
RVO_API Vector3 & operator-=(const Vector3 &vector)
Sets the value of this three-dimensional vector to the vector difference of itself with the specified...
Definition: Vector3.h:260
Defines a three-dimensional vector.
Definition: Vector3.h:50
RVO_API Vector3(float x, float y, float z)
Constructs and initializes a three-dimensional vector from the specified xyz-coordinates.
Definition: Vector3.h:90