SVec3I
An Int backed 3-element structure that can be used to represent positions and directions in 3D-space.
Constructors
Method New(x:Int, y:Int, z:Int)
Creates a new SVec3I from the supplied arguments.
Operators
Method Operator+:SVec3I(b:SVec3I)
Adds b to this vector, returning a new vector.
Method Operator-:SVec3I(b:SVec3I)
Subtracts b from this vector, returning a new vector.
Method Operator*:SVec3I(b:SVec3I)
Multiplies the vector by b, returning a new vector.
Method Operator/:SVec3I(b:SVec3I)
Devides the vector by b, returning a new vector.
Method Operator-:SVec3I()
Returns a negated version of this vector.
Method Operator*:SVec3I(s:Int)
Multiplies the vector by s, returning a new vector.
Method Operator/:SVec3I(s:Int)
Divides the vector by s, returning a new vector.
Method Operator/:SVec3I(s:Float)
Divides the vector by s, returning a new vector.
Method Operator[]:Int(index:Int)
Retrieves the x, y or z component using [0], [1] or [2] respectively.
Method Operator<>:Int(b:SVec3I)
Returns True if b is different.
Method Operator=:Int(b:SVec3I)
Returns True if the vector and b are aproximately equal.
Methods
Method Clamp:SVec3I(minv:SVec3I, maxv:SVec3I)
Returns a vector clamped between the vectors minv and maxv.
Method Cross:SVec3I(b:SVec3I)
Returns the Cross Product of the two vectors.
A cross product of zero indicates that the two vectors are parallel.
Method Min:SVec3I(b:SVec3I)
Returns a vector that is made from the smallest components of the two vectors.
Method Max:SVec3I(b:SVec3I)
Returns a vector that is made from the largest components of the two vectors.
Method Interpolate:SVec3I(b:SVec3I, t:Int)
Linearly interpolates between two vectors.
Interpolates between this vector and b by the interpolant t. This is commonly used to find a point some fraction of the way along a line between two endpoints (e.g. to move an object gradually between those points).
Method Normal:SVec3I()
Returns a vector with a magnitude of 1.
When normalized, a vector keeps the same direction but its length is 1.0.
Method Dot:Int(b:SVec3I)
Returns the dot product of two vectors.
For normalized vectors Dot returns 1 if they point in exactly the same direction, -1 if they point in completely opposite directions, and a number in between for other cases (e.g. Dot returns zero if vectors are perpendicular).
Method Length:Int()
Returns the length of the vector.
Method LengthSquared:Int()
Returns the squared length of the vector.
Calculating the squared length instead of the length is much faster. Often if you are comparing lengths of two vectors you can just compare their squared lengths.
Method DistanceTo:Int(b:SVec3I)
Returns the distance between the vector and b.
Method DistanceToSquared:Int(b:SVec3I)
Returns the squared distance between the vector and b.
Method Reflect:SVec3I(n:SVec3I)
Returns a vector reflected from the given plane, specified by its normal vector.
Method ToString:String() Override
Returns a String representation of the vector.