Struct FastVec3d
- Namespace
- Vintagestory.API.MathTools
- Assembly
- VintagestoryAPI.dll
Represents a vector of 3 doubles
public struct FastVec3d
- Inherited Members
- Extension Methods
Constructors
FastVec3d(double, double, double)
Create a new vector with given coordinates
public FastVec3d(double x, double y, double z)
Parameters
FastVec3d(double[])
Create a new vector with given coordinates
public FastVec3d(double[] values)
Parameters
values
double[]
FastVec3d(BlockPos)
public FastVec3d(BlockPos pos)
Parameters
pos
BlockPos
FastVec3d(Vec3i)
public FastVec3d(Vec3i vec3i)
Parameters
vec3i
Vec3i
FastVec3d(Vec4d)
Create a new vector with given coordinates
public FastVec3d(Vec4d vec)
Parameters
vec
Vec4d
Fields
X
The X-Component of the vector
public double X
Field Value
Y
The Y-Component of the vector
public double Y
Field Value
Z
The Z-Component of the vector
public double Z
Field Value
Properties
this[int]
Returns the n-th coordinate
public double this[int index] { get; set; }
Parameters
index
int
Property Value
Methods
Add(double)
public FastVec3d Add(double d)
Parameters
d
double
Returns
Add(double, double, double)
Adds given x/y/z coordinates to the vector
public FastVec3d Add(double x, double y, double z)
Parameters
Returns
Add(BlockPos)
Adds given BlockPos's x/y/z coordinates to the vector
public FastVec3d Add(BlockPos pos)
Parameters
pos
BlockPos
Returns
Add(Vec3i)
Adds given vector's x/y/z coordinates to the vector
public FastVec3d Add(Vec3i vec)
Parameters
vec
Vec3i
Returns
AddCopy(double, double, double)
Adds given coordinates to a new vectors and returns it. The original calling vector remains unchanged
public FastVec3d AddCopy(double x, double y, double z)
Parameters
Returns
AddCopy(FastVec3d)
Adds both vectors into a new vector. Both source vectors remain unchanged.
public FastVec3d AddCopy(FastVec3d vec)
Parameters
vec
FastVec3d
Returns
Clone()
Creates a copy of the vetor
public FastVec3d Clone()
Returns
CreateFromBytes(BinaryReader)
public static FastVec3d CreateFromBytes(BinaryReader reader)
Parameters
reader
BinaryReader
Returns
Distance(FastVec3d)
Calculates the distance the two endpoints
public double Distance(FastVec3d vec)
Parameters
vec
FastVec3d
Returns
Distance(Vec3d)
Calculates the distance the two endpoints
public double 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 double Dot(Vec3d a)
Parameters
a
Vec3d
Returns
Dot(Vec3f)
Returns the dot product with given vector
public double Dot(Vec3f a)
Parameters
a
Vec3f
Returns
Length()
Returns the length of this vector
public double Length()
Returns
Mul(double)
Multiplies each coordinate with given multiplier
public FastVec3d Mul(double multiplier)
Parameters
multiplier
double
Returns
Negate()
public void Negate()
Normalize()
Turns the vector into a unit vector with length 1, but only if length is non-zero
public FastVec3d Normalize()
Returns
NormalizedCopy()
Creates a new vectors that is the normalized version of this vector.
public FastVec3d NormalizedCopy()
Returns
ReduceBy(double)
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(double val)
Parameters
val
double
Set(double, double, double)
Sets the vector to this coordinates
public FastVec3d Set(double x, double y, double z)
Parameters
Returns
Set(double[])
public FastVec3d Set(double[] vec)
Parameters
vec
double[]
Returns
Set(FastVec3d)
Sets the vector to the coordinates of given vector
public void Set(FastVec3d vec)
Parameters
vec
FastVec3d
Set(Vec3d)
Sets the vector to the coordinates of given vector
public FastVec3d 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