|
| Vec3 ()=default |
| Default constructor leaves garbage in contents.
|
|
template<typename S > |
| Vec3 (const Vec3< S > &b) |
| Copy constructor supports type conversion.
|
|
template<typename S > |
| Vec3 (const Vec3< S > &v, float n) |
| Constructor that normalizes vector after copy if 'n' is > 0.
|
|
| Vec3 (T a) |
| Constructor that sets all components to a single value.
|
|
| Vec3 (T a, T b) |
| Constructors that set separate components, with default z=0.
|
|
| Vec3 (T a, T b, T c) |
|
template<typename S > |
| Vec3 (S *v) |
| Constructor from an array of 3 numbers.
|
|
template<typename S > |
| Vec3 (const S *v) |
|
| Vec3 (const Vec2< T > &v, T vz=(T) 0) |
|
| operator Vec3< fdk::half > () const |
| Returns value as a specific type:
|
|
| operator Vec3< float > () const |
|
| operator Vec3< double > () const |
|
| operator Vec3< int > () const |
|
Vec3< fdk::half > | asVec3h () const |
|
Vec3< float > | asVec3f () const |
|
Vec3< double > | asVec3d () const |
|
Vec3< int > | asVec3i () const |
|
T & | operator[] (int n) |
|
const T & | operator[] (int n) const |
|
T * | array () |
| Returns a pointer to the first element.
|
|
const T * | array () const |
|
Vec2< T > | xy () const |
|
void | set (T d) |
| Set all components to a single value.
|
|
void | set (T a, T b, T c) |
| Set all components.
|
|
void | setToZero () |
| Set components to 0.
|
|
void | setToOne () |
| Set components to 1.
|
|
void | clear () |
| Type-specific clear. Set all components to 0.
|
|
void | append (fdk::Hash &hash) const |
| Add this to a fdk::Hash object.
|
|
template<typename S > |
Vec3 | operator* (const Mat4< S > &m) const |
|
template<typename S > |
Vec3 & | operator*= (const Mat4< S > &m) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec3 | operator* (S d) const |
|
Vec3 | operator* (const Vec3 &v) const |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec3 & | operator*= (S d) |
|
Vec3 & | operator*= (const Vec3 &v) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec3 | operator/ (S d) const |
|
Vec3 | operator/ (const Vec3 &v) const |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec3 & | operator/= (S d) |
|
Vec3 & | operator/= (const Vec3 &v) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec3 | operator+ (S d) const |
|
Vec3 | operator+ (const Vec3 &v) const |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec3 & | operator+= (S d) |
|
Vec3 & | operator+= (const Vec3 &v) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec3 | operator- (S d) const |
|
Vec3 | operator- (const Vec3 &v) const |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec3 & | operator-= (S d) |
|
Vec3 & | operator-= (const Vec3 &v) |
|
Vec3 | operator- () const |
|
void | negate () |
|
bool | operator== (const Vec3 &v) const |
|
bool | operator!= (const Vec3 &v) const |
|
template<typename S > |
bool | operator== (S d) const |
|
template<typename S > |
bool | operator!= (S d) const |
|
bool | operator< (const Vec3 &v) const |
| Fairly arbitrary operator so you can store these in ordered arrays.
|
|
T | length () const |
| Also known as the absolute value or magnitude of the vector.
|
|
T | lengthSquared () const |
| Same as this dot this, length() squared.
|
|
T | distanceBetween (const Vec3 &v) const |
| Same as (this-v).length()
|
|
T | distanceSquared (const Vec3 &v) const |
| Same as (this-v).lengthSquared()
|
|
T | distanceFromPlane (T A, T B, T C, T D) const |
| Return the scalar distance to the plane defined by ABCD.
|
|
T | dot (const Vec3 &v) const |
| Dot product. Twice the area of the triangle between the vectors.
|
|
Vec3 | cross (const Vec3 &v) const |
| Cross product. Returns a vector at right angles to the vectors.
|
|
T | normalize () |
| Change the vector to be unit length. Returns the original length.
|
|
Vec3 | normalized () const |
|
Vec3 | reflect (const Vec3 &N) const |
| Return a vector of this one reflected around a normal vector.
|
|
void | faceForward (const Vec3 &N) |
| Negate (flip) vector if it points in the opposite direction of N.
|
|
T | minimumComponent () const |
| Returns the minimum element.
|
|
Vec3 | minimum (const Vec3 &v) const |
|
T | maximumComponent () const |
| Returns the maximum element.
|
|
Vec3 | maximum (const Vec3 &v) const |
|
T | largestAxis () const |
| Returns the absolute value of the largest element.
|
|
template<typename S > |
Vec3< T > | interpolateTo (const Vec3< T > &b, S t) const |
| Linear-interpolate between this Vec3 and another at t, where t=0..1.
|
|
template<typename S > |
Vec3< T > | lerpClampedTo (const Vec3< T > &b, S t) const |
|
template<typename S > |
Vec3< T > | lerpUnclapmedTo (const Vec3< T > &b, S t) const |
|
Vec3 | inverted () const |
|
template<typename S > |
Vec3 | clamped (S min, S max) const |
|
Vec3 | clamped () const |
|
void | toRadians () |
| Convert to/from radians/degrees.
|
|
Vec3 | asRadians () const |
|
void | toDegrees () |
|
Vec3 | asDegrees () const |
|
bool | isZero () const |
|
bool | notZero () const |
|
bool | greaterThanZero () const |
|
void | roundIfNearlyZero (T threshold=std::numeric_limits< T >::epsilon()) |
| Round off each element if nearly one or zero within the type's epsilon default or user-provided threshold.
|
|
void | roundIfNearlyOne (T threshold=std::numeric_limits< T >::epsilon()) |
|
void | orientAroundNormal (Vec3 N, bool auto_flip=true) |
|
void | rotateAroundAxis (T angle, const Vec3 &axis) |
| Rotate a vector by an angle around a center axis vector.
|
|
template<typename S > |
Vec3< T > | operator* (const Mat4< S > &m) const |
|
template<typename S > |
Vec3< T > & | operator*= (const Mat4< S > &m) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > > |
Vec3< T > & | operator*= (S d) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > > |
Vec3< T > & | operator/= (S d) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > > |
Vec3< T > & | operator+= (S d) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > > |
Vec3< T > & | operator-= (S d) |
|