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
valuesdouble[]
FastVec3d(BlockPos)
public FastVec3d(BlockPos pos)
Parameters
posBlockPos
FastVec3d(FastVec3d)
public FastVec3d(FastVec3d vec)
Parameters
vecFastVec3d
FastVec3d(Vec3f)
public FastVec3d(Vec3f vec)
Parameters
vecVec3f
FastVec3d(Vec3i)
public FastVec3d(Vec3i vec3i)
Parameters
vec3iVec3i
FastVec3d(Vec4d)
Create a new vector with given coordinates
public FastVec3d(Vec4d vec)
Parameters
vecVec4d
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
indexint
Property Value
Methods
Add(double)
public FastVec3d Add(double d)
Parameters
ddouble
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
posBlockPos
Returns
Add(FastVec3d)
public FastVec3d Add(FastVec3d vec)
Parameters
vecFastVec3d
Returns
Add(IVec3)
public FastVec3d Add(IVec3 vec)
Parameters
vecIVec3
Returns
Add(Vec3d)
public FastVec3d Add(Vec3d vec)
Parameters
vecVec3d
Returns
Add(Vec3f)
public FastVec3d Add(Vec3f vec)
Parameters
vecVec3f
Returns
Add(Vec3i)
Adds given vector's x/y/z coordinates to the vector
public FastVec3d Add(Vec3i vec)
Parameters
vecVec3i
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
vecFastVec3d
Returns
AheadCopy(double, double, double)
public FastVec3d AheadCopy(double offset, double Pitch, double Yaw)
Parameters
Returns
Clone()
Creates a copy of the vetor
public FastVec3d Clone()
Returns
CreateFromBytes(BinaryReader)
public static FastVec3d CreateFromBytes(BinaryReader reader)
Parameters
readerBinaryReader
Returns
Distance(FastVec3d)
Calculates the distance the two endpoints
public double Distance(FastVec3d vec)
Parameters
vecFastVec3d
Returns
Distance(Vec3d)
Calculates the distance the two endpoints
public double Distance(Vec3d vec)
Parameters
vecVec3d
Returns
DistanceSq(double, double, double)
Calculates the square distance the two endpoints
public double DistanceSq(double x, double y, double z)
Parameters
Returns
DistanceSq(FastVec3d)
Calculates the square distance the two endpoints
public double DistanceSq(FastVec3d vec)
Parameters
vecFastVec3d
Returns
Dot(double[])
Returns the dot product with given vector
public double Dot(double[] pos)
Parameters
posdouble[]
Returns
Dot(float[])
Returns the dot product with given vector
public double Dot(float[] pos)
Parameters
posfloat[]
Returns
Dot(Vec3d)
Returns the dot product with given vector
public double Dot(Vec3d a)
Parameters
aVec3d
Returns
Dot(Vec3f)
Returns the dot product with given vector
public double Dot(Vec3f a)
Parameters
aVec3f
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
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
multiplierdouble
Returns
Mul(double, double, double)
Multiply each individual component
public FastVec3d Mul(double x, double y, double z)
Parameters
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
valdouble
ReverseSub(Vec3d)
Like .Sub() but subtracts this vec from the supplied parameter
public FastVec3d ReverseSub(Vec3d vec)
Parameters
vecVec3d
Returns
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
vecdouble[]
Returns
Set(FastVec3d)
Sets the vector to the coordinates of given vector
public void Set(FastVec3d vec)
Parameters
vecFastVec3d
Set(Vec3d)
Sets the vector to the coordinates of given vector
public FastVec3d Set(Vec3d vec)
Parameters
vecVec3d
Returns
Sub(FastVec3d)
public FastVec3d Sub(FastVec3d vec)
Parameters
vecFastVec3d
Returns
Sub(Vec3d)
public FastVec3d Sub(Vec3d vec)
Parameters
vecVec3d
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
writerBinaryWriter
Operators
operator +(FastVec3d, float)
public static FastVec3d operator +(FastVec3d left, float right)
Parameters
Returns
operator +(FastVec3d, FastVec3d)
public static FastVec3d operator +(FastVec3d left, FastVec3d right)
Parameters
Returns
operator +(FastVec3d, Vec3i)
public static FastVec3d operator +(FastVec3d left, Vec3i right)
Parameters
Returns
operator /(FastVec3d, double)
public static FastVec3d operator /(FastVec3d left, double right)
Parameters
Returns
operator /(FastVec3d, float)
public static FastVec3d operator /(FastVec3d left, float right)
Parameters
Returns
operator ==(FastVec3d, FastVec3d)
public static bool operator ==(FastVec3d left, FastVec3d right)
Parameters
Returns
operator !=(FastVec3d, FastVec3d)
public static bool operator !=(FastVec3d left, FastVec3d right)
Parameters
Returns
operator *(double, FastVec3d)
public static FastVec3d operator *(double left, FastVec3d right)
Parameters
Returns
operator *(float, FastVec3d)
public static FastVec3d operator *(float left, FastVec3d right)
Parameters
Returns
operator *(FastVec3d, double)
public static FastVec3d operator *(FastVec3d left, double right)
Parameters
Returns
operator *(FastVec3d, float)
public static FastVec3d operator *(FastVec3d left, float right)
Parameters
Returns
operator *(FastVec3d, FastVec3d)
public static double operator *(FastVec3d left, FastVec3d right)
Parameters
Returns
operator -(float, FastVec3d)
public static FastVec3d operator -(float left, FastVec3d right)
Parameters
Returns
operator -(FastVec3d, float)
public static FastVec3d operator -(FastVec3d left, float right)
Parameters
Returns
operator -(FastVec3d, FastVec3d)
public static FastVec3d operator -(FastVec3d left, FastVec3d right)