Vector2 struct. More...
Public Member Functions | |
| ksVector2 (float x, float y) | |
| Constructor. More... | |
| float | Magnitude () |
| Gets the magnitude. More... | |
| float | MagnitudeSquared () |
| Gets the magnitude squared. More... | |
| ksVector2 | Normalized () |
| Gets a normalized copy of this vector. More... | |
| bool | Normalize () |
| Normalizes this vector. More... | |
| ksVector2 | Clamped (float maxMagnitude) |
| Returns a copy of this vector with its magnitude clamped to maxLength. More... | |
| void | Clamp (float maxMagnitude) |
| Clamps the magnitude of this vector. More... | |
| float | ToDegrees () |
| Converts the direction of the vector to an angle. More... | |
| float | ToRadians () |
| Converts the direction of the vector to an angle. More... | |
| ksVector2 | Abs () |
| Absolute value vector. More... | |
| float | MaxValue (bool absolute=false) |
| Gets the maximum component in the vector. More... | |
| float | MinValue (bool absolute=false) |
| Gets the minimum component in the vector. More... | |
| bool | ReplaceNaNs (float value=0.0f) |
| Replaces NaN values in the vector. More... | |
| override string | ToString () |
| Returns a string that represents the current Vector2. More... | |
| string | ToString (string format) |
| Returns a string respresentation of the vector. More... | |
| string | ToString (IFormatProvider provider) |
| Returns a string respresentation of the vector. More... | |
| override bool | Equals (object obj) |
| Checks if this vector is equal to an object. More... | |
| bool | Equals (ksVector2 other) |
| Checks if this vector is equal to another. More... | |
| override int | GetHashCode () |
| Gets the hash code for this vector. More... | |
Static Public Member Functions | |
| static implicit | operator float[] (ksVector2 value) |
| Implicit conversion from ksVector2 to float[2]. More... | |
| static implicit | operator ksVector2 (float[] value) |
| Implicit conversion from float[] to ksVector2. More... | |
| static ksVector2 | FromDegrees (float angle, float magnitude=1) |
| Constructs a Vector2 from an angle. More... | |
| static ksVector2 | FromRadians (float angle, float magnitude=1) |
| Constructs a Vector2 from an angle. More... | |
| static float | DeltaDegrees (ksVector2 from, ksVector2 to) |
| Returns the angle in degrees between two vectors. More... | |
| static float | DeltaRadians (ksVector2 from, ksVector2 to) |
| Returns the angle in radians between two vectors. More... | |
| static float | Dot (ksVector2 lhs, ksVector2 rhs) |
| Computes the dot product of two vectors. More... | |
| static ksVector2 | Max (ksVector2 lhs, ksVector2 rhs) |
| Returns a vector that is made from the largest components of two vectors. More... | |
| static ksVector2 | Min (ksVector2 lhs, ksVector2 rhs) |
| Returns a vector that is made from the smallest components of two vectors. More... | |
| static ksVector2 | Project (ksVector2 vector, ksVector2 target) |
| Projects a vector onto another vector. More... | |
| static ksVector2 | Reflect (ksVector2 direction, ksVector2 normal) |
| Reflects a vector off the plane defined by a normal. More... | |
| static ksVector2 | Lerp (ksVector2 from, ksVector2 to, float t) |
| Linearly interpolates between two vectors. More... | |
| static ksVector2 | Slerp (ksVector2 from, ksVector2 to, float t, bool lerpMagnitude=false) |
| Spherically interpolates between from and to by t. More... | |
| static ksVector2 | MoveTowards (ksVector2 start, ksVector2 target, float delta) |
| Moves a point towards a target point. More... | |
| static ksVector2 | Rotate (ksVector2 direction, float angle) |
| Rotates a vector by an angle. More... | |
| static ksVector2 | RotateRadians (ksVector2 direction, float angle) |
| Rotates a vector by an angle. More... | |
| static ksVector2 | Scale (ksVector2 a, ksVector2 b) |
| Multiplies two vectors component-wise. More... | |
| static ksVector2 | operator- (ksVector2 lhs, ksVector2 rhs) |
| Subtracts one vector from another. More... | |
| static ksVector2 | operator- (ksVector2 v) |
| Multiplies the vector by -1. More... | |
| static ksVector2 | operator* (ksVector2 vector, float scale) |
| Multiplies a ksVector2 by a number. More... | |
| static ksVector2 | operator* (float scale, ksVector2 vector) |
| Multiplies a ksVector2 by a number. More... | |
| static ksVector2 | operator/ (ksVector2 vector, float scale) |
| Divides a ksVector2 by a number. More... | |
| static ksVector2 | operator/ (float number, ksVector2 vector) |
| Divides a number by a ksVector2. More... | |
| static ksVector2 | operator+ (ksVector2 lhs, ksVector2 rhs) |
| Adds two ksVector2. More... | |
| static bool | operator== (ksVector2 lhs, ksVector2 rhs) |
| Checks if two vectors are equal. More... | |
| static bool | operator!= (ksVector2 lhs, ksVector2 rhs) |
| Checks if two vectors are not equal More... | |
| static implicit | operator Vector2 (ksVector2 value) |
| Implicit conversion from ksVector2 to Unity Vector2. More... | |
| static implicit | operator ksVector2 (Vector2 value) |
| Implicit conversion from Unity Vector2 to ksVector2. More... | |
| static ksVector2 | operator+ (ksVector2 lhs, Vector2 rhs) |
| Vector addition with ksVector2 and Unity Vector2. More... | |
| static Vector2 | operator+ (Vector2 rhs, ksVector2 lhs) |
| Vector addition with Unity Vector2 and ksVector2. More... | |
| static ksVector2 | operator- (ksVector2 lhs, Vector2 rhs) |
| Vector subtraction with ksVector2 and Unity Vector2. More... | |
| static Vector2 | operator- (Vector2 lhs, ksVector2 rhs) |
| Vector subtraction with Unity Vector2 and ksVector2. More... | |
| static bool | operator== (ksVector2 lhs, Vector2 rhs) |
| Equality comparison with with ksVector2 and Unity Vector2. More... | |
| static bool | operator== (Vector2 lhs, ksVector2 rhs) |
| Equality comparison with Unity Vector2 and ksVector2. More... | |
| static bool | operator!= (ksVector2 lhs, Vector2 rhs) |
| Inequality comparison with with ksVector2 and Unity Vector2. More... | |
| static bool | operator!= (Vector2 lhs, ksVector2 rhs) |
| Inequality comparison with Unity Vector2 and ksVector2. More... | |
Properties | |
| static ksVector2 | One [get] |
| static ksVector2 | Zero [get] |
| float | X [get, set] |
| X value. More... | |
| float | Y [get, set] |
| Y value. More... | |
| float | this[int index] [get, set] |
| Indexer. More... | |
Vector2 struct.
Vector struct
| KS.Reactor.ksVector2.ksVector2 | ( | float | x, |
| float | y | ||
| ) |
Constructor.
| x | X value. |
| y | Y value. |
| ksVector2 KS.Reactor.ksVector2.Abs | ( | ) |
Absolute value vector.
| void KS.Reactor.ksVector2.Clamp | ( | float | maxMagnitude | ) |
Clamps the magnitude of this vector.
| maxMagnitude | Max magnitude to clamp magnitude to. |
| ksVector2 KS.Reactor.ksVector2.Clamped | ( | float | maxMagnitude | ) |
Returns a copy of this vector with its magnitude clamped to maxLength.
| maxMagnitude | Max magnitude to clamp magnitude to. |
Returns the angle in degrees between two vectors.
| from | The angle extends round from this vector. |
| to | The angle extends round to this vector. |
Returns the angle in radians between two vectors.
| from | The angle extends round from this vector. |
| to | The angle extends round to this vector. |
Computes the dot product of two vectors.
| lhs | |
| rhs |
| bool KS.Reactor.ksVector2.Equals | ( | ksVector2 | other | ) |
Checks if this vector is equal to another.
| other | Other vector to compare with. |
| override bool KS.Reactor.ksVector2.Equals | ( | object | obj | ) |
Checks if this vector is equal to an object.
| obj | Object to compare with this vector. |
|
static |
Constructs a Vector2 from an angle.
| angle | Angle in degrees. |
| magnitude | Magnitude |
|
static |
Constructs a Vector2 from an angle.
| angle | Angle in radians. |
| magnitude | Magnitude. |
| override int KS.Reactor.ksVector2.GetHashCode | ( | ) |
Gets the hash code for this vector.
Linearly interpolates between two vectors.
| from | Vector to interpolate from. |
| to | Vector to interpolate to. |
| t | Value between 0 and 1 that determines the amount of interpolation. |
| float KS.Reactor.ksVector2.Magnitude | ( | ) |
Gets the magnitude.
| float KS.Reactor.ksVector2.MagnitudeSquared | ( | ) |
Gets the magnitude squared.
Returns a vector that is made from the largest components of two vectors.
| lhs | |
| rhs |
| float KS.Reactor.ksVector2.MaxValue | ( | bool | absolute = false | ) |
Gets the maximum component in the vector.
| absolute | Return the max absolute value. |
Returns a vector that is made from the smallest components of two vectors.
| lhs | |
| rhs |
| float KS.Reactor.ksVector2.MinValue | ( | bool | absolute = false | ) |
Gets the minimum component in the vector.
| absolute | Return the min absolute value. |
|
static |
Moves a point towards a target point.
| start | start point. |
| target | target to move towards. |
| delta | Delta distance to move. It will not overshoot the target. Negative values will move away from the target. |
| bool KS.Reactor.ksVector2.Normalize | ( | ) |
Normalizes this vector.
| ksVector2 KS.Reactor.ksVector2.Normalized | ( | ) |
Gets a normalized copy of this vector.
|
static |
Implicit conversion from ksVector2 to float[2].
| value |
|
static |
Implicit conversion from float[] to ksVector2.
| value |
|
static |
|
static |
Checks if two vectors are not equal
| lhs | |
| rhs |
|
static |
|
static |
Multiplies a ksVector2 by a number.
Multiplies each component of Vector2 by a number scale.
| scale | |
| vector |
Multiplies a ksVector2 by a number.
Multiplies each component of Vector2 by a number scale.
| vector | |
| scale |
|
static |
Subtracts one vector from another.
| lhs | |
| rhs |
Multiplies the vector by -1.
| v |
|
static |
Checks if two vectors are equal.
| lhs | |
| rhs |
|
static |
|
static |
Projects a vector onto another vector.
| vector | Vector to project. |
| target | Target to project onto. |
Reflects a vector off the plane defined by a normal.
| direction | Direction to reflect. |
| normal | Normal of plane to reflect off of. |
| bool KS.Reactor.ksVector2.ReplaceNaNs | ( | float | value = 0.0f | ) |
Replaces NaN values in the vector.
| value | Replacement value. |
Rotates a vector by an angle.
| direction | Direction to rotate. |
| angle | Angle in degrees. |
Rotates a vector by an angle.
| direction | Direction to rotate. |
| angle | Angle in radians. |
Multiplies two vectors component-wise.
| a | |
| b |
|
static |
Spherically interpolates between from and to by t.
| from | Vector to interpolate from. |
| to | Vector to interpolate to. |
| t | Value between 0 and 1 that determines the amount of interpolation. |
| lerpMagnitude | If false, magnitude won't be interpolated. |
| float KS.Reactor.ksVector2.ToDegrees | ( | ) |
Converts the direction of the vector to an angle.
| float KS.Reactor.ksVector2.ToRadians | ( | ) |
Converts the direction of the vector to an angle.
| override string KS.Reactor.ksVector2.ToString | ( | ) |
Returns a string that represents the current Vector2.
| string KS.Reactor.ksVector2.ToString | ( | IFormatProvider | provider | ) |
Returns a string respresentation of the vector.
| provider |
| string KS.Reactor.ksVector2.ToString | ( | string | format | ) |
Returns a string respresentation of the vector.
| format |
|
getset |
Indexer.
| index |
|
getset |
X value.
|
getset |
Y value.