this extension class contains some simple but useful mathematical functions that can be performed on Vector3's.
Static Public Member Functions | |
static Vector3 | Abs (this Vector3 vec) |
Returns the absolute value of each component. | |
static Vector2 | ClipToRect (this Rect rectToClipTo, Vector2 pointToClip) |
Clips a Vector2 point to the boundaries of the provided Rect. If any of the points coordinates lies outside the rect, the will be changed to the closest rect boundary. | |
static void | FromFloatArray (this Vector3 vec, float[] floatarray) |
Convenience function used to write an array of 3 floats into a vector's x,y,z coordinates. | |
static void | InverseScale (this Vector3 vec, Vector3 scale) |
Inverse-Scales this Vector3, by another Vector3 and stores the result in this Vector3. This divides each coordinate of this Vector, by the same coordinate of the provided Vector3 scale. | |
static Vector3 | InverseScaled (this Vector3 vec, Vector3 scale) |
Inverse-Scales this Vector3, by another Vector3 and returns the result. Does not modify the calling Vector3. This divides each coordinate of this Vector, by the same coordinate of the provided Vector3. | |
static int | LargestCoordinate (this Vector3 vec) |
Returns an index to the largest Coordinate in the vector 0 for x, 1 for y, and 2 for z The sign of the values are not considered when determining which is larger, just their absolute value. | |
static float | LargestCoordinateValue (this Vector3 vec) |
Returns the largest Coordinate in the vector. The sign of the values are not considered when determining which is larger, just their absolute value. | |
static Vector3 | Reciprocal (this Vector3 vec) |
Returns 1 divided by the parameter's coordinate values, and returns the result as a new Vector3. Does not modify the calling Vector3. | |
static void | Reciprocalize (this Vector3 vec) |
computes 1 divided by the parameter's coordinate values, and sets itself to that result. | |
static Vector3 | Scaled (this Vector3 vec, float scalex, float scaley, float scalez) |
Scales the Vector parameter by the x,y,z parameters, and returns the result. The calling vector is not modified | |
static Vector3 | Scaled (this Vector3 vec, Vector3 scale) |
Scales this Vector3, by another Vector3 and returns the result, without modifying this vector. This multiplies each coordinate of this Vector, with the same coordinate of the provided Vector3. | |
static Vector3 | Sign (this Vector3 vec) |
Returns the sign of each component of this vector, as a new vector. | |
static int | SmallestCoordinate (this Vector3 vec) |
Returns an index to the smallest Coordinate in the vector. The sign of the values are not considered when determining which is smaller, just their absolute value. | |
static float | SmallestCoordinateValue (this Vector3 vec) |
Returns the largest Coordinate in the vector. The sign of the values are not considered when determining which is larger, just their absolute value. | |
static Vector3 | Square (this Vector3 vec) |
Returns the square of each component. | |
static float[] | ToFloatArray (this Vector3 vec) |
Convenience function used to convert the x,y and z values of a Vector3, into an array of 3 floats. Note: the values themselves are copied into to the array.. not references to the Vector's components. | |
static string | ToStringG (this Vector3 vec) |
Output a string showing a Vector3 with parenthesis and comma separated coordinates | |
static Vector2 | XY (this Vector3 vec) |
Converts the X and UY coordinates of a Vector3 into a new Vector2 | |
static Vector2 | XZ (this Vector3 vec) |
Converts the X and Z coordinates of a Vector3 into a new Vector2's x and y coordinates. | |
static Vector2 | YZ (this Vector3 vec) |
Converts the Y and Z coordinates of a Vector3 into a new Vector2's x and y coordinates. | |