![]() |
CUGL 4.0
Cornell University Game Library
|
#include <CUIVec3.h>
Public Member Functions | |
| IVec3 () | |
| IVec3 (int x, int y, int z) | |
| IVec3 (const int *array) | |
| IVec3 (const IVec3 &p1, const IVec3 &p2) | |
| IVec3 & | operator= (const int *array) |
| IVec3 & | set (int x, int y, int z) |
| IVec3 & | set (const int *array) |
| IVec3 & | set (const IVec3 &v) |
| IVec3 & | set (const IVec3 &p1, const IVec3 &p2) |
| IVec3 & | setZero () |
| IVec3 & | clamp (const IVec3 &min, const IVec3 &max) |
| IVec3 | getClamp (const IVec3 &min, const IVec3 &max) const |
| IVec3 & | add (const IVec3 &v) |
| IVec3 & | add (int x, int y, int z) |
| IVec3 & | subtract (const IVec3 &v) |
| IVec3 & | subtract (int x, int y, int z) |
| IVec3 & | scale (int s) |
| IVec3 & | scale (int sx, int sy, int sz) |
| IVec3 & | scale (const IVec3 &v) |
| IVec3 & | negate () |
| IVec3 | getNegation () const |
| IVec3 & | map (std::function< int(int)> func) |
| IVec3 | getMap (std::function< int(int)> func) const |
| IVec3 & | operator+= (const IVec3 &v) |
| IVec3 & | operator-= (const IVec3 &v) |
| IVec3 & | operator*= (int s) |
| IVec3 & | operator*= (const IVec3 &v) |
| const IVec3 | operator+ (const IVec3 &v) const |
| const IVec3 | operator- (const IVec3 &v) const |
| const IVec3 | operator- () const |
| const IVec3 | operator* (int s) const |
| const IVec3 | operator* (const IVec3 &v) const |
| bool | operator< (const IVec3 &v) const |
| bool | operator<= (const IVec3 &v) const |
| bool | operator> (const IVec3 &v) const |
| bool | operator>= (const IVec3 &v) const |
| bool | operator== (const IVec3 &v) const |
| bool | operator!= (const IVec3 &v) const |
| bool | under (const IVec3 &v) const |
| bool | over (const IVec3 &v) const |
| bool | equals (const IVec3 &v) const |
| bool | isZero () const |
| std::string | toString (bool verbose=false) const |
| operator std::string () const | |
| operator Vec3 () const | |
| IVec3 (const Vec3 &v) | |
| IVec3 & | operator= (const Vec3 &v) |
| IVec3 & | operator+= (const Vec3 &v) |
| IVec3 & | operator-= (const Vec3 &v) |
| IVec3 & | operator*= (const Vec3 &v) |
| const IVec3 | operator+ (const Vec3 &v) |
| const IVec3 | operator- (const Vec3 &v) |
| const IVec3 | operator* (const Vec3 &v) |
| operator IVec2 () const | |
| IVec3 (const IVec2 &v) | |
| IVec3 (const IVec2 &v, int z) | |
| IVec3 & | operator= (const IVec2 &v) |
| operator IVec4 () const | |
| IVec3 (const IVec4 &v) | |
| IVec3 & | operator= (const IVec4 &v) |
Static Public Member Functions | |
| static IVec3 * | clamp (const IVec3 &v, const IVec3 &min, const IVec3 &max, IVec3 *dst) |
| static IVec3 * | add (const IVec3 &v1, const IVec3 &v2, IVec3 *dst) |
| static IVec3 * | subtract (const IVec3 &v1, const IVec3 &v2, IVec3 *dst) |
| static IVec3 * | scale (const IVec3 &v, int s, IVec3 *dst) |
| static IVec3 * | scale (const IVec3 &v1, const IVec3 &v2, IVec3 *dst) |
| static IVec3 * | negate (const IVec3 &v, IVec3 *dst) |
Public Attributes | |
| int | x |
| int | y |
| int | z |
Static Public Attributes | |
| static const IVec3 | ZERO |
| static const IVec3 | ONE |
This class defines a 3-element integer vector.
This class is in standard layout with fields of uniform type. This means that it is safe to reinterpret_cast objects to int arrays.
|
inline |
Constructs a new vector initialized to all zeros.
|
inline |
Constructs a new vector initialized to the specified values.
| x | The x coordinate. |
| y | The y coordinate. |
| z | The z coordinate. |
|
inline |
Constructs a new vector from the values in the specified array.
| array | An array containing the elements of the vector in the order x, y, z. |
Constructs a vector that describes the direction between the specified points.
| p1 | The first point. |
| p2 | The second point. |
|
explicit |
Creates a vector from the given floating point vector.
The float values are truncated.
| v | The vector to convert |
|
explicit |
Creates a 3d vector from the given 2d one.
The z-value is set to 0.
| v | The vector to convert |
| cugl::IVec3::IVec3 | ( | const IVec2 & | v, |
| int | z | ||
| ) |
Creates a 3d vector from the given 2d one.
The z-coordinate is given the appropriate value
| v | The vector to convert |
| z | The z-coordinate |
|
explicit |
Creates a 3d vector from the given homogenous one.
The w-coordinate is dropped.
| v | The vector to convert |
Adds the given vector to this one in place.
| v | The vector to add |
Adds the specified vectors and stores the result in dst.
| v1 | The first vector. |
| v2 | The second vector. |
| dst | A vector to store the result in |
|
inline |
Adds the given values to this vector.
| x | The x coordinate to add. |
| y | The y coordinate to add. |
| z | The z coordinate to add. |
Clamps this vector within the given range.
| min | The minimum value. |
| max | The maximum value. |
|
static |
Clamps the specified vector within the given range and returns it in dst.
| v | The vector to clamp. |
| min | The minimum value. |
| max | The maximum value. |
| dst | A vector to store the result in. |
|
inline |
Returns true if this vector is equal to the given vector.
| v | The vector to compare against. |
Returns a copy of this vector clamped within the given range.
Note: this does not modify this vector.
| min | The minimum value. |
| max | The maximum value. |
|
inline |
Returns a copy of this vector with func applied to each component.
This method supports any function that has the signature float func(float); This includes many of the functions in math.h.
| func | The function to map on the coordinates. |
|
inline |
Returns a negated copy of this vector.
Note: This method does not modify the vector
|
inline |
Returns true this vector contains all zeros.
|
inline |
Maps the given function to the vector coordinates in place.
This method supports any function that has the signature float func(float); This includes many of the functions in math.h.
| func | The function to map on the coordinates. |
|
inline |
Negates this vector.
Negates the specified vector and stores the result in dst.
| v | The vector to negate. |
| dst | The destination vector. |
|
inline |
Cast from IVec3 to a string.
|
inline |
Returns true if this vector is not equal to the given vector.
| v | The vector to compare against. |
Returns the scalar product of this vector with the given vector.
This method is provided to support non-uniform scaling. Note: this does not modify this vector.
| v | The vector to scale by. |
Returns the scalar product of this vector with the given vector.
The float values of v are truncated.
Note: this does not modify this vector.
| v | The vector to scale by. |
|
inline |
Returns the scalar product of this vector with the given value.
Note: this does not modify this vector.
| s | The value to scale by. |
Scales this vector nonuniformly by the given vector.
| v | The vector to scale by |
Scales this vector nonuniformly by the given vector.
The float values of v are truncated.
| v | The vector to scale by |
|
inline |
Scales this vector in place by the given factor.
| s | The value to scale by |
Returns the sum of this vector with the given vector.
Note: this does not modify this vector.
| v | The vector to add. |
Returns the sum of this vector with the given vector.
The float values of v are truncated.
Note: this does not modify this vector.
| v | The vector to add. |
Adds the given vector to this one in place.
| v | The vector to add |
Adds the given vector to this one in place.
The float values of v are truncated.
| v | The vector to add |
|
inline |
Returns the negation of this vector.
Note: this does not modify this vector.
Returns the difference of this vector with the given vector.
Note: this does not modify this vector.
| v | The vector to subtract. |
Returns the difference of this vector with the given vector.
The float values of v are truncated.
Note: this does not modify this vector.
| v | The vector to subtract. |
Subtracts the given vector from this one in place.
| v | The vector to subtract |
Subtracts the given vector from this one in place.
The float values of v are truncated.
| v | The vector to subtract |
|
inline |
Returns true if this vector is less than the given vector.
This comparison uses the lexicographical order. To test if all components in this vector are less than those of v, use the method under().
| v | The vector to compare against. |
|
inline |
Returns true if this vector is less than or equal the given vector.
This comparison uses the lexicographical order. To test if all components in this vector are less than those of v, use the method under().
| v | The vector to compare against. |
|
inline |
Sets the elements of this vector from the values in the specified array.
| array | An array containing the elements of the vector in the order x, y, z. |
Sets the coordinates of this vector to those of the given 2d vector.
The z-value is set to 0.
| v | The vector to convert |
Sets the coordinates of this vector to those of the given homogenous vector.
The w-coordinate is dropped.
| v | The vector to convert |
Sets this vector to be the given floating point vector.
The float values are truncated.
| v | The vector to convert |
|
inline |
Returns true if this vector is equal to the given vector.
| v | The vector to compare against. |
|
inline |
Returns true if this vector is greater than the given vector.
This comparison uses the lexicographical order. To test if all components in this vector are greater than those of v, use the method over().
| v | The vector to compare against. |
|
inline |
Returns true if this vector is greater than or equal the given vector.
This comparison uses the lexicographical order. To test if all components in this vector are greater than those of v, use the method over().
| v | The vector to compare against. |
|
inline |
Returns true if this vector dominates the given vector.
Domination means that all components of this vector are greater than or equal to the components of the given vector.
| v | The vector to compare against. |
Scales this vector nonuniformly by the given vector.
| v | The vector to scale by |
Scales the specified vector and stores the result in dst.
The scale is uniform by the constant s.
| v | The vector to scale. |
| s | The uniform scaling factor. |
| dst | The destination vector. |
Scales the specified vector and stores the result in dst.
The scale is nonuniform by the attributes in v2.
| v1 | The vector to scale. |
| v2 | The nonuniform scaling factor. |
| dst | The destination vector. |
|
inline |
Scales this vector in place by the given factor.
| s | The scalar to multiply by |
|
inline |
Scales this vector nonuniformly by the given factors.
| sx | The scalar to multiply the x-axis |
| sy | The scalar to multiply the y-axis |
| sz | The scalar to multiply the z-axis |
|
inline |
Sets the elements of this vector from the values in the specified array.
| array | An array containing the elements of the vector in the order x, y, z. |
Sets this vector to the directional vector between the specified points.
| p1 | The initial point of the vector. |
| p2 | The terminal point of the vector. |
Sets the elements of this vector to those in the specified vector.
| v | The vector to copy. |
|
inline |
Sets the elements of this vector to the specified values.
| x | The new x coordinate. |
| y | The new y coordinate. |
| z | The new z coordinate. |
|
inline |
Sets the elements of this vector to zero.
Subtracts the given vector from this one in place.
| v | The vector to subtract |
Subtracts the specified vectors and stores the result in dst.
The resulting vector is computed as (v1 - v2).
| v1 | The first vector. |
| v2 | The second vector. |
| dst | The destination vector. |
|
inline |
Subtracts the given values from this vector.
| x | The x coordinate to subtract. |
| y | The y coordinate to subtract. |
| z | The z coordinate to subtract. |
| std::string cugl::IVec3::toString | ( | bool | verbose = false | ) | const |
Returns a string representation of this vector for debuggging purposes.
If verbose is true, the string will include class information. This allows us to unambiguously identify the class.
| verbose | Whether to include class information |
|
inline |
Returns true if this vector is dominated by the given vector.
Domination means that all components of the given vector are greater than or equal to the components of this one.
| v | The vector to compare against. |
|
static |
The ones vector IVec3(1,1,1)
| int cugl::IVec3::x |
The x-coordinate.
| int cugl::IVec3::y |
The y-coordinate.
| int cugl::IVec3::z |
The z-coordinate.
|
static |
The zero vector IVec3(0,0,0)