Isle
|
[AI] 3D vector class, providing vector and cross-product operations in 3D space. More...
#include <vector.h>
Public Member Functions | |
Vector3 (float *p_data) | |
[AI] Construct a 3D vector pointing at external data storage. More... | |
Vector3 (const float *p_data) | |
[AI] Construct a 3D vector from const float* (pointer is cast to non-const in base). More... | |
void | Clear () override |
[AI] Sets every coordinate (x, y, z) to zero. More... | |
float | LenSquared () const override |
[AI] Computes the squared magnitude (x^2 + y^2 + z^2) of this vector. More... | |
virtual void | EqualsCross (const Vector3 &p_a, const Vector3 &p_b) |
[AI] Sets this vector to be the cross product of p_a and p_b. More... | |
virtual void | EqualsCross (const Vector3 &p_a, const float *p_b) |
[AI] Sets this vector to be the cross product of p_a and p_b, with b as a pointer. More... | |
virtual void | EqualsCross (const float *p_a, const Vector3 &p_b) |
[AI] Sets this vector to be the cross product of p_a and p_b, with a as a pointer. More... | |
virtual void | Fill (const float &p_value) |
[AI] Fills all coordinates with p_value. More... | |
![]() | |
Vector2 (float *p_data) | |
[AI] Construct a 2D vector using an external float buffer. More... | |
Vector2 (const float *p_data) | |
[AI] Construct a 2D vector from a (likely constant) array of floats without copying (just pointer assignment). More... | |
virtual float * | GetData () |
[AI] Retrieves the mutable in-memory data pointer for this vector. More... | |
virtual const float * | GetData () const |
[AI] Retrieves the immutable data pointer for this vector. More... | |
virtual void | Clear () |
[AI] Zeros all elements (sets all coordinates to 0.0). More... | |
virtual float | Dot (const float *p_a, const float *p_b) const |
[AI] Compute the dot product of the two float arrays interpreted as vectors of 2 elements. More... | |
virtual float | Dot (const Vector2 &p_a, const Vector2 &p_b) const |
[AI] Compute the dot product of two Vector2 objects. More... | |
virtual float | Dot (const float *p_a, const Vector2 &p_b) const |
[AI] Compute the dot product given a pointer and a Vector2 (second param). More... | |
virtual float | Dot (const Vector2 &p_a, const float *p_b) const |
[AI] Compute the dot product given a Vector2 (first param) and a pointer (second param). More... | |
virtual float | LenSquared () const |
[AI] Compute the squared length (magnitude^2) of the vector. More... | |
virtual int | Unitize () |
[AI] Scales the vector so its norm is 1 (unit vector). More... | |
virtual void | operator+= (float p_value) |
[AI] In-place add a scalar to all coordinates. More... | |
virtual void | operator+= (const float *p_other) |
[AI] In-place add vector elements via float pointer. More... | |
virtual void | operator+= (const Vector2 &p_other) |
[AI] In-place add another Vector2. More... | |
virtual void | operator-= (const float *p_other) |
[AI] In-place subtraction of vector pointed to by p_other. More... | |
virtual void | operator-= (const Vector2 &p_other) |
[AI] In-place subtraction of another Vector2. More... | |
virtual void | operator*= (const float *p_other) |
[AI] In-place per-element multiplication of this vector by another array. More... | |
virtual void | operator*= (const Vector2 &p_other) |
[AI] In-place per-element multiplication by another Vector2. More... | |
virtual void | operator*= (const float &p_value) |
[AI] In-place multiplication by a scalar. More... | |
virtual void | operator/= (const float &p_value) |
[AI] In-place scalar division. More... | |
virtual void | operator= (const float *p_other) |
[AI] Assigns this vector's elements from a pointer to two floats. More... | |
virtual void | operator= (const Vector2 &p_other) |
[AI] Assigns this vector's elements from another Vector2. More... | |
float & | operator[] (int idx) |
[AI] Accesses the idx-th float in the vector (0 or 1). More... | |
const float & | operator[] (int idx) const |
[AI] Const version of the index operator. More... | |
Protected Member Functions | |
void | AddImpl (const float *p_value) override |
[AI] Adds the values pointed to by p_value to this vector. More... | |
void | AddImpl (float p_value) override |
[AI] Adds a scalar value to every element of this vector. More... | |
void | SubImpl (const float *p_value) override |
[AI] Subtracts the vector specified by p_value from this vector. More... | |
void | MulImpl (const float *p_value) override |
[AI] Multiplies this vector by another vector (per element). More... | |
void | MulImpl (const float &p_value) override |
[AI] Multiplies this vector by a scalar value. More... | |
void | DivImpl (const float &p_value) override |
[AI] Divides this vector by a scalar value. More... | |
float | DotImpl (const float *p_a, const float *p_b) const override |
void | EqualsImpl (const float *p_data) override |
[AI] Assigns values from provided array to this vector. More... | |
virtual void | EqualsCrossImpl (const float *p_a, const float *p_b) |
[AI] Assigns this vector to the cross product of p_a and p_b. More... | |
![]() | |
virtual void | AddImpl (const float *p_value) |
[AI] Adds the values pointed to by p_value to this vector. More... | |
virtual void | AddImpl (float p_value) |
[AI] Adds a scalar value to every element of this vector. More... | |
virtual void | SubImpl (const float *p_value) |
[AI] Subtracts the vector specified by p_value from this vector. More... | |
virtual void | MulImpl (const float *p_value) |
[AI] Multiplies this vector by another vector (per element). More... | |
virtual void | MulImpl (const float &p_value) |
[AI] Multiplies this vector by a scalar value. More... | |
virtual void | DivImpl (const float &p_value) |
[AI] Divides this vector by a scalar value. More... | |
virtual float | DotImpl (const float *p_a, const float *p_b) const |
[AI] Computes the dot product of two arrays interpreted as vectors. More... | |
virtual void | SetData (float *p_data) |
[AI] Set the internal data pointer to external storage. More... | |
virtual void | EqualsImpl (const float *p_data) |
[AI] Assigns values from provided array to this vector. More... | |
Friends | |
class | Mx3DPointFloat |
Additional Inherited Members | |
![]() | |
float * | m_data |
[AI] Pointer to externally provided float storage (owned elsewhere). More... | |
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
Inherits from Vector2 to add the third coordinate and cross product facilities.
[AI] Only adds methods specific to 3D (e.g., cross-product), all storage uses the (externally managed) m_data float pointer from Vector2.
|
inline |
|
inline |
|
inlineoverrideprotectedvirtual |
[AI] Adds the values pointed to by p_value to this vector.
Adds a float array (size 3) component-wise to this vector.
[AI] Adds a 2D float array to the vector data in-place.
p_value | Pointer to an array containing values to add. [AI] |
This is used for vector addition with an array.
p_value | Pointer to a float array containing the values to add. |
[AI] Each component of the input array is added to the corresponding component of the vector. The length must be 2.
[AI]
p_value | Pointer to float array to add (float[3]). [AI] |
Reimplemented from Vector2.
Reimplemented in Vector4.
|
inlineoverrideprotectedvirtual |
[AI] Adds a scalar value to every element of this vector.
Adds a scalar value to each component of this vector.
[AI] Adds a scalar value to both components of the vector.
p_value | The value to add to each coordinate. [AI] |
p_value | The scalar value to add. |
[AI] The scalar is added to both x and y components.
[AI]
p_value | Scalar value to add. [AI] |
Reimplemented from Vector2.
Reimplemented in Vector4.
|
inlineoverridevirtual |
|
inlineoverrideprotectedvirtual |
[AI] Divides this vector by a scalar value.
Divides each component of this vector by a scalar value.
[AI] Divides both components of the vector by a scalar.
p_value | Scalar divisor. [AI] |
p_value | The scalar value to divide by. |
[AI] Both components are divided by the scalar. No zero check.
[AI]
p_value | Scalar value to divide. [AI] |
Reimplemented from Vector2.
Reimplemented in Vector4.
|
inlineoverrideprotectedvirtual |
|
inlinevirtual |
[AI] Sets this vector to be the cross product of p_a and p_b, with a as a pointer.
Sets this vector to the cross product of a float array and a Vector3.
p_a | Pointer operand. [AI] |
p_b | Vector3 operand. [AI] |
[AI]
p_a | Pointer to the first input vector (float[3]). [AI] |
p_b | Input Vector3. [AI] |
|
inlinevirtual |
[AI] Sets this vector to be the cross product of p_a and p_b, with b as a pointer.
Sets this vector to the cross product of a Vector3 and a float array.
p_a | Vector3 operand. [AI] |
p_b | Pointer operand. [AI] |
[AI]
p_a | Input Vector3. [AI] |
p_b | Pointer to the second input vector (float[3]). [AI] |
[AI] Sets this vector to be the cross product of p_a and p_b.
Sets this vector to the cross product of two Vector3 objects.
p_a | First operand. [AI] |
p_b | Second operand. [AI] |
[AI]
p_a | First input vector. [AI] |
p_b | Second input vector. [AI] |
|
inlineprotectedvirtual |
[AI] Assigns this vector to the cross product of p_a and p_b.
Computes the cross product of two 3D vectors represented as float arrays, stores the result in this vector.
p_a | Pointer to first 3-element vector. [AI] |
p_b | Pointer to second 3-element vector. [AI] |
[AI]
p_a | Pointer to the first input vector (float[3]). [AI] |
p_b | Pointer to the second input vector (float[3]). [AI] |
|
inlineoverrideprotectedvirtual |
[AI] Assigns values from provided array to this vector.
Sets the internal data of this vector to the contents of the provided float array.
[AI] Copies the values from a float array into the vector's data.
p_data | Pointer to array to copy from. [AI] |
p_data | Pointer to float array containing the values to copy. |
[AI] Uses memcpy for fast assignment of both vector components.
[AI]
p_data | Pointer to float array (float[3]) to copy. [AI] |
Reimplemented from Vector2.
Reimplemented in Vector4.
|
inlinevirtual |
[AI] Fills all coordinates with p_value.
Sets each component of this vector to the given scalar value.
p_value | Fill value. [AI] |
[AI]
p_value | Value to set for all components. [AI] |
Reimplemented in Vector4.
|
inlineoverridevirtual |
|
inlineoverrideprotectedvirtual |
[AI] Multiplies this vector by a scalar value.
Multiplies each component of this vector by a scalar value.
[AI] Multiplies both components of the vector by a scalar.
p_value | Scalar multiplier. [AI] |
p_value | The scalar value to multiply by. |
[AI] Both components are multiplied by the scalar.
[AI]
p_value | Scalar value to multiply. [AI] |
Reimplemented from Vector2.
Reimplemented in Vector4.
|
inlineoverrideprotectedvirtual |
[AI] Multiplies this vector by another vector (per element).
Multiplies this vector component-wise by a float array (size 3).
[AI] Multiplies the vector by another 2D float array component-wise.
p_value | Pointer to the vector to multiply with. [AI] |
p_value | Pointer to a float array containing the values to multiply by. |
[AI] Each component of the vector is multiplied by the corresponding component in the input array.
[AI]
p_value | Pointer to float array to multiply (float[3]). [AI] |
Reimplemented from Vector2.
Reimplemented in Vector4.
|
inlineoverrideprotectedvirtual |
[AI] Subtracts the vector specified by p_value from this vector.
Subtracts a float array (size 3) component-wise from this vector.
[AI] Subtracts a 2D float array from the vector data in-place.
p_value | Pointer to array to subtract. [AI] |
p_value | Pointer to a float array containing the values to subtract. |
[AI] Each component of the input array is subtracted from the corresponding component of the vector. The length must be 2.
[AI]
p_value | Pointer to float array to subtract (float[3]). [AI] |
Reimplemented from Vector2.
Reimplemented in Vector4.
|
friend |