KS.Reactor.ksVector3 Struct Reference

ksVector3 struct. More...

Public Member Functions

 ksVector3 (float x, float y)
 Constructor that takes x and y values and set z to 0. More...
 
 ksVector3 (float x, float y, float z)
 Constructor. More...
 
float Magnitude ()
 Returns the magnitude. More...
 
float MagnitudeSquared ()
 Returns the magnitude squared. More...
 
ksVector3 Normalized ()
 Returns the a normalized copy of this vector. More...
 
bool Normalize ()
 Normalizes this vector. More...
 
ksVector3 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...
 
ksVector3 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 ksVector3. 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 (ksVector3 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[] (ksVector3 value)
 Implicit conversion from ksVector3 to float[3]. More...
 
static implicit operator ksVector3 (float[] value)
 Implicit conversion from float[] to ksVector3. More...
 
static float DeltaDegrees (ksVector3 from, ksVector3 to)
 Returns the angle in degrees between to vectors. More...
 
static float DeltaRadians (ksVector3 from, ksVector3 to)
 Returns the angle in degrees between to vectors. More...
 
static float Dot (ksVector3 lhs, ksVector3 rhs)
 Computes the dot product of two vectors. More...
 
static ksVector3 Cross (ksVector3 lhs, ksVector3 rhs)
 Computes the cross product of two vectors. More...
 
static ksVector3 Max (ksVector3 lhs, ksVector3 rhs)
 Returns a vector that is made from the largest components of two vectors. More...
 
static ksVector3 Min (ksVector3 lhs, ksVector3 rhs)
 Returns a vector that is made from the smallest components of two vectors More...
 
static void OrthoNormalize (ref ksVector3 normal, ref ksVector3 tangent)
 Normalizes vectors and makes tangent orthoganol to normal. More...
 
static ksVector3 Project (ksVector3 vector, ksVector3 target)
 Projects a vector onto another vector. More...
 
static ksVector3 Reflect (ksVector3 direction, ksVector3 normal)
 Reflects a vector off the plane defined by a normal. More...
 
static ksVector3 Lerp (ksVector3 from, ksVector3 to, float t)
 Linearly Interpolates between two vectors. More...
 
static ksVector3 Slerp (ksVector3 from, ksVector3 to, float t, bool lerpMagnitude=false)
 Spherically interpolates between from and to by t. More...
 
static ksVector3 MoveTowards (ksVector3 start, ksVector3 target, float delta)
 Moves a point towards a target point. More...
 
static ksVector3 RotateTowards (ksVector3 vector, ksVector3 direction, float deltaDegrees)
 Rotates a vector towards a direction. More...
 
static ksVector3 RotateTowardsRadians (ksVector3 vector, ksVector3 direction, float deltaRadians)
 Rotates a vector towards a direction. More...
 
static ksVector3 Scale (ksVector3 a, ksVector3 b)
 Multiplies two vectors component-wise. More...
 
static ksVector3 operator- (ksVector3 lhs, ksVector3 rhs)
 Subtracts one vector from another. More...
 
static ksVector3 operator- (ksVector3 v)
 Multiplies the vector by -1. More...
 
static ksVector3 operator* (ksVector3 vector, float scale)
 Multiplies a ksVector3 by a number. More...
 
static ksVector3 operator* (float scale, ksVector3 vector)
 Multiplies a ksVector3 by a number. More...
 
static ksVector3 operator/ (ksVector3 vector, float scale)
 Divides a ksVector3 by a number. More...
 
static ksVector3 operator/ (float number, ksVector3 vector)
 Dives a number by a ksVector3. More...
 
static ksVector3 operator+ (ksVector3 lhs, ksVector3 rhs)
 Adds two KSVector3s. More...
 
static bool operator== (ksVector3 lhs, ksVector3 rhs)
 Checks if two vectors are equal. More...
 
static bool operator!= (ksVector3 lhs, ksVector3 rhs)
 Checks if two vectors are not equal. More...
 
static implicit operator Vector3 (ksVector3 value)
 Implicit conversion from ksVector3 to Unity Vector3. More...
 
static implicit operator ksVector3 (Vector3 value)
 Implicit conversion from Unity Vector3 to ksVector3. More...
 
static ksVector3 operator+ (ksVector3 lhs, Vector3 rhs)
 Vector addition with ksVector3 and Unity Vector3. More...
 
static Vector3 operator+ (Vector3 rhs, ksVector3 lhs)
 Vector addition with Unity Vector3 and ksVector3. More...
 
static ksVector3 operator- (ksVector3 lhs, Vector3 rhs)
 Vector subtraction with ksVector3 and Unity Vector3. More...
 
static Vector3 operator- (Vector3 lhs, ksVector3 rhs)
 Vector subtraction with Unity Vector3 and ksVector3. More...
 
static bool operator== (ksVector3 lhs, Vector3 rhs)
 Equality comparison with with ksVector3 and Unity Vector3. More...
 
static bool operator== (Vector3 lhs, ksVector3 rhs)
 Equality comparison with Unity Vector3 and ksVector3. More...
 
static bool operator!= (ksVector3 lhs, Vector3 rhs)
 Inequality comparison with with ksVector3 and Unity Vector3. More...
 
static bool operator!= (Vector3 lhs, ksVector3 rhs)
 Inequality comparison with Unity Vector3 and ksVector3. More...
 

Static Public Attributes

static ksVector3 m_right = new ksVector3(1f, 0f, 0f)
 

Properties

static ksVector3 One [get]
 One. More...
 
static ksVector3 Zero [get]
 Zero. More...
 
static ksVector3 Forward [get]
 World forward direction. More...
 
static ksVector3 Up [get]
 World up direction. More...
 
static ksVector3 Right [get]
 World right direction. More...
 
static ksVector3 Backwards [get]
 World backwards direction. More...
 
static ksVector3 Down [get]
 World down direction. More...
 
static ksVector3 Left [get]
 World left direction. More...
 
float X [get, set]
 X value. More...
 
float Y [get, set]
 Y value. More...
 
float Z [get, set]
 Z value. More...
 
ksVector2 XY [get, set]
 X and Y values as a ksVector2 More...
 
ksVector2 XZ [get, set]
 X and Z values as a ksVector2 More...
 
ksVector2 YZ [get, set]
 Y and Z values as a ksVector2 More...
 
float this[int index] [get, set]
 Indexer. More...
 

Detailed Description

ksVector3 struct.

Vector struct

Constructor & Destructor Documentation

◆ ksVector3() [1/2]

KS.Reactor.ksVector3.ksVector3 ( float  x,
float  y 
)

Constructor that takes x and y values and set z to 0.

Parameters
xX value.
yY value.

◆ ksVector3() [2/2]

KS.Reactor.ksVector3.ksVector3 ( float  x,
float  y,
float  z 
)

Constructor.

Parameters
xX value.
yY value.
zZ value.

Member Function Documentation

◆ Abs()

ksVector3 KS.Reactor.ksVector3.Abs ( )

Absolute value vector.

Returns
New vector where all components are absolue values of this vector.

◆ Clamp()

void KS.Reactor.ksVector3.Clamp ( float  maxMagnitude)

Clamps the magnitude of this vector.

Parameters
maxMagnitudeMax magnitude to clamp magnitude to.

◆ Clamped()

ksVector3 KS.Reactor.ksVector3.Clamped ( float  maxMagnitude)

Returns a copy of this vector with its magnitude clamped to maxLength.

Parameters
maxMagnitudeMax magnitude to clamp magnitude to.
Returns
Clamped vector.

◆ Cross()

static ksVector3 KS.Reactor.ksVector3.Cross ( ksVector3  lhs,
ksVector3  rhs 
)
static

Computes the cross product of two vectors.

Parameters
lhs
rhs
Returns
Cross product.

◆ DeltaDegrees()

static float KS.Reactor.ksVector3.DeltaDegrees ( ksVector3  from,
ksVector3  to 
)
static

Returns the angle in degrees between to vectors.

Parameters
fromThe angle extends round from this vector.
toThe angle extends round to this vector.
Returns
Angle in degrees.

◆ DeltaRadians()

static float KS.Reactor.ksVector3.DeltaRadians ( ksVector3  from,
ksVector3  to 
)
static

Returns the angle in degrees between to vectors.

Parameters
fromThe angle extends round from this vector.
toThe angle extends round to this vector.
Returns
Angle in radians.

◆ Dot()

static float KS.Reactor.ksVector3.Dot ( ksVector3  lhs,
ksVector3  rhs 
)
static

Computes the dot product of two vectors.

Parameters
lhs
rhs
Returns
Dot product.

◆ Equals() [1/2]

bool KS.Reactor.ksVector3.Equals ( ksVector3  other)

Checks if this vector is equal to another.

Parameters
otherOther vector to compare with.
Returns
True if the vectors are equal.

◆ Equals() [2/2]

override bool KS.Reactor.ksVector3.Equals ( object  obj)

Checks if this vector is equal to an object.

Parameters
objObject to compare with this vector.
Returns
True if this vector is equal to the object.

◆ GetHashCode()

override int KS.Reactor.ksVector3.GetHashCode ( )

Gets the hash code for this vector.

Returns

◆ Lerp()

static ksVector3 KS.Reactor.ksVector3.Lerp ( ksVector3  from,
ksVector3  to,
float  t 
)
static

Linearly Interpolates between two vectors.

Parameters
fromVector to interpolate from.
toVector to interpolate to.
tValue between 0 and 1 that determines the amount of interpolation.
Returns
Interpolated vector.

◆ Magnitude()

float KS.Reactor.ksVector3.Magnitude ( )

Returns the magnitude.

Returns

◆ MagnitudeSquared()

float KS.Reactor.ksVector3.MagnitudeSquared ( )

Returns the magnitude squared.

Returns

◆ Max()

static ksVector3 KS.Reactor.ksVector3.Max ( ksVector3  lhs,
ksVector3  rhs 
)
static

Returns a vector that is made from the largest components of two vectors.

Parameters
lhs
rhs
Returns
Max vector.

◆ MaxValue()

float KS.Reactor.ksVector3.MaxValue ( bool  absolute = false)

Gets the maximum component in the vector.

Parameters
absoluteIf ture, returns the max absolute value.
Returns
Max component value.

◆ Min()

static ksVector3 KS.Reactor.ksVector3.Min ( ksVector3  lhs,
ksVector3  rhs 
)
static

Returns a vector that is made from the smallest components of two vectors

Parameters
lhs
rhsMin vector.
Returns

◆ MinValue()

float KS.Reactor.ksVector3.MinValue ( bool  absolute = false)

Gets the minimum component in the vector.

Parameters
absoluteIf true, return sthe min absolute value.
Returns
Min component value.

◆ MoveTowards()

static ksVector3 KS.Reactor.ksVector3.MoveTowards ( ksVector3  start,
ksVector3  target,
float  delta 
)
static

Moves a point towards a target point.

Parameters
startStart point.
targetTarget to move towards.
deltadelta distance to move. It will not overshoot the target. Negative values will move away from the target.
Returns

◆ Normalize()

bool KS.Reactor.ksVector3.Normalize ( )

Normalizes this vector.

Returns
False if the vector could not be normalized because it's the zero vector.

◆ Normalized()

ksVector3 KS.Reactor.ksVector3.Normalized ( )

Returns the a normalized copy of this vector.

Returns

◆ operator float[]()

static implicit KS.Reactor.ksVector3.operator float[] ( ksVector3  value)
static

Implicit conversion from ksVector3 to float[3].

Parameters
value

◆ operator ksVector3() [1/2]

static implicit KS.Reactor.ksVector3.operator ksVector3 ( float[]  value)
static

Implicit conversion from float[] to ksVector3.

Parameters
value

◆ operator ksVector3() [2/2]

static implicit KS.Reactor.ksVector3.operator ksVector3 ( Vector3  value)
static

Implicit conversion from Unity Vector3 to ksVector3.

Parameters
valueUnity vector
Returns
Reactor vector

◆ operator Vector3()

static implicit KS.Reactor.ksVector3.operator Vector3 ( ksVector3  value)
static

Implicit conversion from ksVector3 to Unity Vector3.

Parameters
valueReactor vector
Returns
Unity vectory

◆ operator!=() [1/3]

static bool KS.Reactor.ksVector3.operator!= ( ksVector3  lhs,
ksVector3  rhs 
)
static

Checks if two vectors are not equal.

Parameters
lhs
rhs
Returns
True if the vectors are not equal.

◆ operator!=() [2/3]

static bool KS.Reactor.ksVector3.operator!= ( ksVector3  lhs,
Vector3  rhs 
)
static

Inequality comparison with with ksVector3 and Unity Vector3.

Parameters
lhs
rhs
Returns
lhs != rhs

◆ operator!=() [3/3]

static bool KS.Reactor.ksVector3.operator!= ( Vector3  lhs,
ksVector3  rhs 
)
static

Inequality comparison with Unity Vector3 and ksVector3.

Parameters
lhs
rhs
Returns
llhs != rhs

◆ operator*() [1/2]

static ksVector3 KS.Reactor.ksVector3.operator* ( float  scale,
ksVector3  vector 
)
static

Multiplies a ksVector3 by a number.

Multiplies each component of ksVector3 by a number scale.

Parameters
scale
vector
Returns

◆ operator*() [2/2]

static ksVector3 KS.Reactor.ksVector3.operator* ( ksVector3  vector,
float  scale 
)
static

Multiplies a ksVector3 by a number.

Multiplies each component of ksVector3 by a number scale.

Parameters
vector
scale
Returns

◆ operator+() [1/3]

static ksVector3 KS.Reactor.ksVector3.operator+ ( ksVector3  lhs,
ksVector3  rhs 
)
static

Adds two KSVector3s.

Parameters
lhs
rhs
Returns

◆ operator+() [2/3]

static ksVector3 KS.Reactor.ksVector3.operator+ ( ksVector3  lhs,
Vector3  rhs 
)
static

Vector addition with ksVector3 and Unity Vector3.

Parameters
lhs
rhs
Returns
lhs + rhs

◆ operator+() [3/3]

static Vector3 KS.Reactor.ksVector3.operator+ ( Vector3  rhs,
ksVector3  lhs 
)
static

Vector addition with Unity Vector3 and ksVector3.

Parameters
lhs
rhs
Returns
lhs + rhs

◆ operator-() [1/4]

static ksVector3 KS.Reactor.ksVector3.operator- ( ksVector3  lhs,
ksVector3  rhs 
)
static

Subtracts one vector from another.

Parameters
lhs
rhs
Returns

◆ operator-() [2/4]

static ksVector3 KS.Reactor.ksVector3.operator- ( ksVector3  lhs,
Vector3  rhs 
)
static

Vector subtraction with ksVector3 and Unity Vector3.

Parameters
lhs
rhs
Returns
lhs - rhs

◆ operator-() [3/4]

static ksVector3 KS.Reactor.ksVector3.operator- ( ksVector3  v)
static

Multiplies the vector by -1.

Parameters
v
Returns

◆ operator-() [4/4]

static Vector3 KS.Reactor.ksVector3.operator- ( Vector3  lhs,
ksVector3  rhs 
)
static

Vector subtraction with Unity Vector3 and ksVector3.

Parameters
lhs
rhs
Returns
lhs - rhs

◆ operator/() [1/2]

static ksVector3 KS.Reactor.ksVector3.operator/ ( float  number,
ksVector3  vector 
)
static

Dives a number by a ksVector3.

Parameters
number
vector
Returns

◆ operator/() [2/2]

static ksVector3 KS.Reactor.ksVector3.operator/ ( ksVector3  vector,
float  scale 
)
static

Divides a ksVector3 by a number.

Parameters
vector
scale
Returns

◆ operator==() [1/3]

static bool KS.Reactor.ksVector3.operator== ( ksVector3  lhs,
ksVector3  rhs 
)
static

Checks if two vectors are equal.

Parameters
lhs
rhs
Returns
True if the vectors are equal.

◆ operator==() [2/3]

static bool KS.Reactor.ksVector3.operator== ( ksVector3  lhs,
Vector3  rhs 
)
static

Equality comparison with with ksVector3 and Unity Vector3.

Parameters
lhs
rhs
Returns
lhs == rhs

◆ operator==() [3/3]

static bool KS.Reactor.ksVector3.operator== ( Vector3  lhs,
ksVector3  rhs 
)
static

Equality comparison with Unity Vector3 and ksVector3.

Parameters
lhs
rhs
Returns
lhs == rhs

◆ OrthoNormalize()

static void KS.Reactor.ksVector3.OrthoNormalize ( ref ksVector3  normal,
ref ksVector3  tangent 
)
static

Normalizes vectors and makes tangent orthoganol to normal.

Parameters
normal
tangent

◆ Project()

static ksVector3 KS.Reactor.ksVector3.Project ( ksVector3  vector,
ksVector3  target 
)
static

Projects a vector onto another vector.

Parameters
vectorVector to project.
targetTarget to project onto.
Returns
Projection result.

◆ Reflect()

static ksVector3 KS.Reactor.ksVector3.Reflect ( ksVector3  direction,
ksVector3  normal 
)
static

Reflects a vector off the plane defined by a normal.

Parameters
directionDirection to reflect.
normalNormal of plane to reflect off of.
Returns
Reflected vector.

◆ ReplaceNaNs()

bool KS.Reactor.ksVector3.ReplaceNaNs ( float  value = 0.0f)

Replaces NaN values in the vector.

Parameters
valueReplacement value.
Returns
True if any of the values was replaced.

◆ RotateTowards()

static ksVector3 KS.Reactor.ksVector3.RotateTowards ( ksVector3  vector,
ksVector3  direction,
float  deltaDegrees 
)
static

Rotates a vector towards a direction.

Parameters
vectorVector to rotate.
directionDirection to rotate towards.
deltaDegreesMax amount in degrees to rotate the vector.
Returns

◆ RotateTowardsRadians()

static ksVector3 KS.Reactor.ksVector3.RotateTowardsRadians ( ksVector3  vector,
ksVector3  direction,
float  deltaRadians 
)
static

Rotates a vector towards a direction.

Parameters
vectorVector to rotate.
directionDirection to rotate towards.
deltaRadiansMax amount in radians to rotate the vector.
Returns

◆ Scale()

static ksVector3 KS.Reactor.ksVector3.Scale ( ksVector3  a,
ksVector3  b 
)
static

Multiplies two vectors component-wise.

Parameters
a
b
Returns

◆ Slerp()

static ksVector3 KS.Reactor.ksVector3.Slerp ( ksVector3  from,
ksVector3  to,
float  t,
bool  lerpMagnitude = false 
)
static

Spherically interpolates between from and to by t.

Parameters
fromVector to interpolate from.
toVector to interpolate to.
tValue between 0 and 1 that determines the amount of interpolation.
lerpMagnitudeIf false, magnitude won't be interpolated.
Returns
Interpolated vector.

◆ ToString() [1/3]

override string KS.Reactor.ksVector3.ToString ( )

Returns a string that represents the current ksVector3.

Returns
A string that represents the current ksVector3

◆ ToString() [2/3]

string KS.Reactor.ksVector3.ToString ( IFormatProvider  provider)

Returns a string respresentation of the vector.

Parameters
provider
Returns
String representation of the vector.

◆ ToString() [3/3]

string KS.Reactor.ksVector3.ToString ( string  format)

Returns a string respresentation of the vector.

Parameters
format
Returns
String representation of the vector.

Property Documentation

◆ Backwards

ksVector3 KS.Reactor.ksVector3.Backwards
staticget

World backwards direction.

◆ Down

ksVector3 KS.Reactor.ksVector3.Down
staticget

World down direction.

◆ Forward

ksVector3 KS.Reactor.ksVector3.Forward
staticget

World forward direction.

◆ Left

ksVector3 KS.Reactor.ksVector3.Left
staticget

World left direction.

◆ One

ksVector3 KS.Reactor.ksVector3.One
staticget

One.

◆ Right

ksVector3 KS.Reactor.ksVector3.Right
staticget

World right direction.

◆ this[int index]

float KS.Reactor.ksVector3.this[int index]
getset

Indexer.

Parameters
index
Returns

◆ Up

ksVector3 KS.Reactor.ksVector3.Up
staticget

World up direction.

◆ X

float KS.Reactor.ksVector3.X
getset

X value.

◆ XY

ksVector2 KS.Reactor.ksVector3.XY
getset

X and Y values as a ksVector2

◆ XZ

ksVector2 KS.Reactor.ksVector3.XZ
getset

X and Z values as a ksVector2

◆ Y

float KS.Reactor.ksVector3.Y
getset

Y value.

◆ YZ

ksVector2 KS.Reactor.ksVector3.YZ
getset

Y and Z values as a ksVector2

◆ Z

float KS.Reactor.ksVector3.Z
getset

Z value.

◆ Zero

ksVector3 KS.Reactor.ksVector3.Zero
staticget

Zero.