![]() |
CUGL 4.0
Cornell University Game Library
|
#include <CUIVec4.h>
Public Member Functions | |
| IVec4 () | |
| IVec4 (int x, int y, int z, int w) | |
| IVec4 (const int *array) | |
| IVec4 (const IVec4 &p1, const IVec4 &p2) | |
| IVec4 & | operator= (const int *array) |
| IVec4 & | set (int x, int y, int z, int w) |
| IVec4 & | set (const int *array) |
| IVec4 & | set (const IVec4 &v) |
| IVec4 & | set (const IVec4 &p1, const IVec4 &p2) |
| IVec4 & | setZero () |
| IVec4 & | clamp (const IVec4 &min, const IVec4 &max) |
| IVec4 | getClamp (const IVec4 &min, const IVec4 &max) const |
| IVec4 & | add (const IVec4 &v) |
| IVec4 & | add (int x, int y, int z, int w) |
| IVec4 & | subtract (const IVec4 &v) |
| IVec4 & | subtract (int x, int y, int z, int w) |
| IVec4 & | scale (int s) |
| IVec4 & | scale (int sx, int sy, int sz, int sw) |
| IVec4 & | scale (const IVec4 &v) |
| IVec4 & | negate () |
| IVec4 | getNegation () const |
| IVec4 & | map (std::function< int(int)> func) |
| IVec4 | getMap (std::function< int(int)> func) const |
| IVec4 & | operator+= (const IVec4 &v) |
| IVec4 & | operator-= (const IVec4 &v) |
| IVec4 & | operator*= (int s) |
| IVec4 & | operator*= (const IVec4 &v) |
| const IVec4 | operator+ (const IVec4 &v) const |
| const IVec4 | operator- (const IVec4 &v) const |
| const IVec4 | operator- () const |
| const IVec4 | operator* (int s) const |
| const IVec4 | operator* (const IVec4 &v) const |
| bool | operator< (const IVec4 &v) const |
| bool | operator<= (const IVec4 &v) const |
| bool | operator> (const IVec4 &v) const |
| bool | operator>= (const IVec4 &v) const |
| bool | operator== (const IVec4 &v) const |
| bool | operator!= (const IVec4 &v) const |
| bool | under (const IVec4 &v) const |
| bool | over (const IVec4 &v) const |
| bool | equals (const IVec4 &v) const |
| bool | isZero () const |
| std::string | toString (bool verbose=false) const |
| operator std::string () const | |
| operator Vec4 () const | |
| IVec4 (const Vec4 &v) | |
| IVec4 & | operator= (const Vec4 &v) |
| IVec4 & | operator+= (const Vec4 &v) |
| IVec4 & | operator-= (const Vec4 &v) |
| IVec4 & | operator*= (const Vec4 &v) |
| const IVec4 | operator+ (const Vec4 &v) |
| const IVec4 | operator- (const Vec4 &v) |
| const IVec4 | operator* (const Vec4 &v) |
| operator IVec2 () const | |
| IVec4 (const IVec2 &v) | |
| IVec4 (const IVec2 &v, int z, int w) | |
| IVec4 & | operator= (const IVec2 &size) |
| operator IVec3 () const | |
| IVec4 (const IVec3 &v) | |
| IVec4 (const IVec3 &v, int w) | |
| IVec4 & | operator= (const IVec3 &v) |
| IVec4 & | set (const IVec3 &v, int w) |
Static Public Member Functions | |
| static IVec4 * | clamp (const IVec4 &v, const IVec4 &min, const IVec4 &max, IVec4 *dst) |
| static IVec4 * | add (const IVec4 &v1, const IVec4 &v2, IVec4 *dst) |
| static IVec4 * | subtract (const IVec4 &v1, const IVec4 &v2, IVec4 *dst) |
| static IVec4 * | scale (const IVec4 &v, int s, IVec4 *dst) |
| static IVec4 * | scale (const IVec4 &v1, const IVec4 &v2, IVec4 *dst) |
| static IVec4 * | negate (const IVec4 &v, IVec4 *dst) |
Public Attributes | |
| int | x |
| int | y |
| int | z |
| int | w |
Static Public Attributes | |
| static const IVec4 | ZERO |
| static const IVec4 | ONE |
This class defines a 4-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. |
| w | The w coordinate. |
|
inline |
Constructs a new vector from the values in the specified array.
The elements of the arra are in the order x, y, z, and w.
| array | An array containing the elements of the vector. |
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 4d vector from the given 2d one.
The z and w coordinates are set to 0.
| v | The vector to convert |
| cugl::IVec4::IVec4 | ( | const IVec2 & | v, |
| int | z, | ||
| int | w | ||
| ) |
Creates a 4d vector from the given 2d one
The z and w coordinates are set to the given values.
| v | The vector to convert |
| z | The z-coordinate |
| w | The w-coordinate |
|
explicit |
Creates a homogenous vector from the given 3d one.
The w-coordinate is set to 0
| v | The vector to convert |
| cugl::IVec4::IVec4 | ( | const IVec3 & | v, |
| int | w | ||
| ) |
Creates a 4d vector from the given 3d one
The w-coordinate is set to the given value.
| v | The vector to convert |
| w | The w-coordinate |
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. |
| w | The w 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. |
| bool cugl::IVec4::equals | ( | const IVec4 & | v | ) | const |
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
| bool cugl::IVec4::isZero | ( | ) | const |
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 in place.
Negates the specified vector and stores the result in dst.
| v | The vector to negate. |
| dst | The destination vector. |
| cugl::IVec4::operator IVec2 | ( | ) | const |
|
inline |
Cast from IVec4 to a string.
| bool cugl::IVec4::operator!= | ( | const IVec4 & | v | ) | const |
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 |
| bool cugl::IVec4::operator< | ( | const IVec4 & | v | ) | const |
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. |
| bool cugl::IVec4::operator<= | ( | const IVec4 & | v | ) | const |
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.
The elements of the array are in the order x, y, z, and w.
| array | An array containing the elements of the vector. |
Sets the coordinates of this vector to those of the given 2d vector.
The z and w coordinates are set to 0.
| size | The vector to convert |
Sets the coordinates of this vector to those of the given 3d vector.
The w-coordinate is set to 0
| 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 |
| bool cugl::IVec4::operator== | ( | const IVec4 & | v | ) | const |
Returns true if this vector is equal to the given vector.
| v | The vector to compare against. |
| bool cugl::IVec4::operator> | ( | const IVec4 & | v | ) | const |
Determines 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. |
| bool cugl::IVec4::operator>= | ( | const IVec4 & | v | ) | const |
Determines 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. |
| bool cugl::IVec4::over | ( | const IVec4 & | v | ) | const |
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 |
| sw | The scalar to divide the w-axis |
|
inline |
Sets the elements of this vector from the values in the specified array.
The elements of the arra are in the order x, y, z, and w.
| array | An array containing the elements of the vector. |
Sets the coordinates of this vector to those of the given 3d vector.
The w-coordinate is set to the given value.
| v | The vector to convert |
| w | The w-coordinate |
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. |
| w | The new w 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. |
| w | The w coordinate to subtract. |
| std::string cugl::IVec4::toString | ( | bool | verbose = false | ) | const |
Returns a string representation of this vector for debugging 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 |
| bool cugl::IVec4::under | ( | const IVec4 & | v | ) | const |
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 Vec4(1,1,1,1)
| int cugl::IVec4::w |
The w-coordinate.
| int cugl::IVec4::x |
The x-coordinate.
| int cugl::IVec4::y |
The y-coordinate.
| int cugl::IVec4::z |
The z-coordinate.
|
static |
The zero vector Vec4(0,0,0,0)