SVec3D
A 3-element structure that can be used to represent positions and directions in 3D-space.
Constructors
Method New(x:Double, y:Double, z:Double)
Creates a new SVec3D from the supplied arguments.
Operators
Method Operator+:SVec3D(b:SVec3D)
Adds b to this vector, returning a new vector.
Method Operator-:SVec3D(b:SVec3D)
Subtracts b from this vector, returning a new vector.
Method Operator*:SVec3D(b:SVec3D)
Multiplies the vector by b, returning a new vector.
Method Operator/:SVec3D(b:SVec3D)
Devides the vector by b, returning a new vector.
Method Operator-:SVec3D()
Returns a negated version of this vector.
Method Operator*:SVec3D(s:Double)
Multiplies the vector by s, returning a new vector.
Method Operator/:SVec3D(s:Double)
Divides the vector by s, returning a new vector.
Method Operator[]:Double(index:Int)
Retrieves the x, y or z component using [0], [1] or [2] respectively.
Method Operator<>:Int(b:SVec3D)
Returns True if b is different.
Method Operator=:Int(b:SVec3D)
Returns True if the vector and b are aproximately equal.
Methods
Method Clamp:SVec3D(minv:SVec3D, maxv:SVec3D)
Returns a vector clamped between the vectors minv and maxv.
Method Cross:SVec3D(b:SVec3D)
Returns the Cross Product of the two vectors.
A cross product of zero indicates that the two vectors are parallel.
Method Min:SVec3D(b:SVec3D)
Returns a vector that is made from the smallest components of the two vectors.
Method Max:SVec3D(b:SVec3D)
Returns a vector that is made from the largest components of the two vectors.
Method Interpolate:SVec3D(b:SVec3D, t:Double)
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:SVec3D()
Returns a vector with a magnitude of 1.
When normalized, a vector keeps the same direction but its length is 1.0.
Method Dot:Double(b:SVec3D)
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:Double()
Returns the length of the vector.
Method LengthSquared:Double()
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:Double(b:SVec3D)
Returns the distance between the vector and b.
Method DistanceToSquared:Double(b:SVec3D)
Returns the squared distance between the vector and b.
Method Reflect:SVec3D(n:SVec3D)
Returns a vector reflected from the given plane, specified by its normal vector.
Method ToString:String() Override
Returns a String representation of the vector.