Struct FastVec3f
- Namespace
- Vintagestory.API.MathTools
- Assembly
- VintagestoryAPI.dll
Represents a vector of 3 floats. Go bug Tyron of you need more utility methods in this class.
public struct FastVec3f
- Inherited Members
- Extension Methods
Constructors
FastVec3f(float, float, float)
Create a new vector with given coordinates
public FastVec3f(float x, float y, float z)
Parameters
FastVec3f(float[])
Create a new vector with given coordinates
public FastVec3f(float[] values)
Parameters
values
float[]
FastVec3f(Vec3i)
public FastVec3f(Vec3i vec3i)
Parameters
vec3i
Vec3i
FastVec3f(Vec4f)
Create a new vector with given coordinates
public FastVec3f(Vec4f vec)
Parameters
vec
Vec4f
Fields
X
The X-Component of the vector
public float X
Field Value
Y
The Y-Component of the vector
public float Y
Field Value
Z
The Z-Component of the vector
public float Z
Field Value
Properties
B
Synonum for Z
public float B { get; set; }
Property Value
G
Synonum for Y
public float G { get; set; }
Property Value
this[int]
Returns the n-th coordinate
public float this[int index] { get; set; }
Parameters
index
int
Property Value
R
Synonum for X
public float R { get; set; }
Property Value
Methods
Add(float, float, float)
Adds given x/y/z coordinates to the vector
public FastVec3f Add(float x, float y, float z)
Parameters
Returns
AddCopy(float, float, float)
Adds given coordinates to a new vectors and returns it. The original calling vector remains unchanged
public FastVec3f AddCopy(float x, float y, float z)
Parameters
Returns
AddCopy(FastVec3f)
Adds both vectors into a new vector. Both source vectors remain unchanged.
public FastVec3f AddCopy(FastVec3f vec)
Parameters
vec
FastVec3f
Returns
Clone()
Creates a copy of the vetor
public FastVec3f Clone()
Returns
CreateFromBytes(BinaryReader)
public static FastVec3f CreateFromBytes(BinaryReader reader)
Parameters
reader
BinaryReader
Returns
Distance(FastVec3f)
Calculates the distance the two endpoints
public float Distance(FastVec3f vec)
Parameters
vec
FastVec3f
Returns
Distance(Vec3d)
Calculates the distance the two endpoints
public float Distance(Vec3d vec)
Parameters
vec
Vec3d
Returns
DistanceSq(double, double, double)
Calculates the square distance the two endpoints
public double DistanceSq(double x, double y, double z)
Parameters
Returns
Dot(double[])
Returns the dot product with given vector
public double Dot(double[] pos)
Parameters
pos
double[]
Returns
Dot(float[])
Returns the dot product with given vector
public double Dot(float[] pos)
Parameters
pos
float[]
Returns
Dot(Vec3d)
Returns the dot product with given vector
public float Dot(Vec3d a)
Parameters
a
Vec3d
Returns
Dot(Vec3f)
Returns the dot product with given vector
public float Dot(Vec3f a)
Parameters
a
Vec3f
Returns
Length()
Returns the length of this vector
public float Length()
Returns
Mul(float)
Multiplies each coordinate with given multiplier
public FastVec3f Mul(float multiplier)
Parameters
multiplier
float
Returns
Negate()
public void Negate()
Normalize()
Turns the vector into a unit vector with length 1, but only if length is non-zero
public FastVec3f Normalize()
Returns
NormalizedCopy()
Creates a new vectors that is the normalized version of this vector.
public FastVec3f NormalizedCopy()
Returns
ReduceBy(float)
Substracts val from each coordinate if the coordinate if positive, otherwise it is added. If 0, the value is unchanged. The value must be a positive number
public void ReduceBy(float val)
Parameters
val
float
Set(float, float, float)
Sets the vector to this coordinates
public FastVec3f Set(float x, float y, float z)
Parameters
Returns
Set(float[])
public FastVec3f Set(float[] vec)
Parameters
vec
float[]
Returns
Set(FastVec3f)
Sets the vector to the coordinates of given vector
public void Set(FastVec3f vec)
Parameters
vec
FastVec3f
Set(Vec3d)
Sets the vector to the coordinates of given vector
public FastVec3f Set(Vec3d vec)
Parameters
vec
Vec3d
Returns
ToDoubleArray()
public double[] ToDoubleArray()
Returns
- double[]
ToString()
Simple string represenation of the x/y/z components
public override string ToString()
Returns
ToVec3d()
Creates a new double precision vector with the same coordinates
public Vec3d ToVec3d()
Returns
Write(BinaryWriter)
public void Write(BinaryWriter writer)
Parameters
writer
BinaryWriter