Public Member Functions | |
| float[] | array () |
| Get this vector as an array. | |
| float | index (int i) |
| Index a parameter. | |
| void | index (int i, float v) |
| Set a parameter. | |
| void | set (float v) |
| Set all parameters to a single value. | |
| void | set (float x, float y) |
| Set the parameters. | |
| vec2 | swizzle (int a, int b) |
| Swizzle. | |
| bit | isnan () |
| Return whether any parameter is nan. | |
| char[] | toString () |
| Convert to string. | |
| vec2 | abs () |
| Get the absolute vector. | |
| float | absMaxAxis () |
| Get the absolute maximum axis. | |
| vec2 | ceil () |
| Return the nearest integer that is equal to or greater than a. | |
| vec2 | clamp (vec2 minVal, vec2 maxVal) |
| Return min (max (a, minVal), maxVal). | |
| vec2 | clamp (float minVal, float maxVal) |
| Return min (max (a, minVal), maxVal). | |
| bit | cmpge (vec2 b) |
| Return whether this vector is greater than or equal to b in each axis. | |
| bit | cmpg (vec2 b) |
| Return whether this vector is greater than b in each axis. | |
| bit | cmpl (vec2 b) |
| Return whether this vector is less than b in each axis. | |
| bit | cmple (vec2 b) |
| Return whether this vector is less than or equal to b in each axis. | |
| float | distance (vec2 b) |
| Get the distance to the other vector. | |
| vec2 | floor () |
| Return the nearest integer that is equal to or less than a. | |
| vec2 | fract () |
| Return a - a.floor (). | |
| float | magnitude () |
| Get the magnitude. | |
| vec2 | max (vec2 b) |
| Select the maximum of either's axis. | |
| float | maxAxis () |
| Get the maximum axis. | |
| vec2 | min (vec2 b) |
| Select the minimum of either's axis. | |
| float | minAxis () |
| Return the value of the minimum signed axis. | |
| vec2 | mix (vec2 b, float t) |
| Return the linear blend of this and b (this * (1 - t) + b * t). | |
| vec2 | normalize () |
| Return the unit vector. | |
| vec2 | sign () |
| Return 1.0 if a >= 0, else -1.0. | |
| float | squaredDistance (vec2 b) |
| Get the distance to the other vector, squared. | |
| float | squaredMagnitude () |
| Get the squared magnitude. | |
Operator overloading. | |
| vec2 | add (float b) |
| Add scalar. | |
| vec2 | add (vec2 b) |
| Add vector. | |
| vec2 | addass (float b) |
| Add scalar and assign. | |
| vec2 | addass (vec2 b) |
| Add vector and assign. | |
| float | cmp (float b) |
| Compare with a scalar. | |
| float | cmp (vec2 b) |
| Compare with a vector. | |
| vec2 | div (float b) |
| Divide scalar. | |
| vec2 | div (vec2 b) |
| Divide vector. | |
| vec2 | div_r (float b) |
| Divide from scalar. | |
| vec2 | divass (float b) |
| Divide scalar and assign. | |
| vec2 | divass (vec2 b) |
| Divide vector and assign. | |
| bit | eq (vec2 b) |
| Return equality with a vector. | |
| bit | eq (float v) |
| Return equality with a scalar. | |
| vec2 | mod (float b) |
| Get the remainder of dividing by a scalar. | |
| vec2 | mod (vec2 b) |
| Get the remainder of dividing by a vector. | |
| vec2 | mod_r (float b) |
| Get the remainder of dividing a scalar by this. | |
| vec2 | modass (float b) |
| Assign to the remainder of dividing by a scalar. | |
| vec2 | modass (vec2 b) |
| Assign to the remainder of dividing by a vector. | |
| vec2 | mul (float b) |
| Multiply scalar. | |
| vec2 | mul (vec2 b) |
| Multiply vector. | |
| vec2 | mulass (float b) |
| Multiply scalar and assign. | |
| vec2 | mulass (vec2 b) |
| Multiply vector and assign. | |
| vec2 | neg () |
| Negate each axis. | |
| vec2 | sub (float b) |
| Subtract scalar. | |
| vec2 | sub (vec2 b) |
| Subtract vectors. | |
| vec2 | sub_r (float b) |
| Subtract from scalar. | |
| vec2 | subass (float b) |
| Subtract scalar and assign. | |
| vec2 | subass (vec2 b) |
| Subtract vector and assign. | |
Static Public Member Functions | |
| vec2 | create (float x, float y) |
| Create a vector. | |
| vec2 | lerp (vec2 a, vec2 b, float t) |
| Linear interpolation between two vectors. | |
Public Attributes | |
| float | x |
| X coordinate. | |
| float | y |
| Y coordinate. | |
| const vec2 | nan = { float.nan, float.nan } |
| A completely NAN vector. | |
Related Functions | |
| (Note that these are not member functions.) | |
| vec2 | avec2 (float x, float y) |
| Create a two-dimensional vector. | |
| vec2 | avec2 (vec3 vector) |
| Create a two-dimensional vector by stripping off z. | |
| vec2 | avec2 (vec4 vector) |
| Create a two-dimensional vector by stripping off z and w. | |
|
||||||||||||||||
|
Linear interpolation between two vectors.
|
1.3.2