Class Vec3d
- Namespace
- Vintagestory.API.MathTools
- Assembly
- VintagestoryAPI.dll
Represents a vector of 3 doubles. Go bug Tyron of you need more utility methods in this class.
[ProtoContract]
public class Vec3d : IVec3, IEquatable<Vec3d>
- Inheritance
-
Vec3d
- Implements
- Inherited Members
- Extension Methods
Constructors
Vec3d()
public Vec3d()
Vec3d(double, double, double)
public Vec3d(double x, double y, double z)
Parameters
Vec3d(EntityPos)
public Vec3d(EntityPos vec)
Parameters
vec
EntityPos
Vec3d(Vec4d)
Create a new vector with given coordinates
public Vec3d(Vec4d vec)
Parameters
vec
Vec4d
Fields
X
[ProtoMember(1)]
public double X
Field Value
Y
[ProtoMember(2)]
public double Y
Field Value
Z
[ProtoMember(3)]
public double Z
Field Value
Properties
AsBlockPos
[JsonIgnore]
public BlockPos AsBlockPos { get; }
Property Value
AsVec3i
public Vec3i AsVec3i { get; }
Property Value
this[int]
Returns the n-th coordinate
public double this[int index] { get; set; }
Parameters
index
int
Property Value
XInt
[JsonIgnore]
public int XInt { get; }
Property Value
YInt
[JsonIgnore]
public int YInt { get; }
Property Value
ZInt
[JsonIgnore]
public int ZInt { get; }
Property Value
Zero
Create a new instance with x/y/z set to 0
public static Vec3d Zero { get; }
Property Value
Methods
Add(double)
public Vec3d Add(double value)
Parameters
value
double
Returns
Add(double, double, double)
public Vec3d Add(double x, double y, double z)
Parameters
Returns
Add(BlockPos)
public Vec3d Add(BlockPos a)
Parameters
a
BlockPos
Returns
Add(Vec3d)
public Vec3d Add(Vec3d a)
Parameters
a
Vec3d
Returns
Add(Vec3d, Vec3d)
public static Vec3d Add(Vec3d a, Vec3d b)
Parameters
Returns
Add(Vec3f)
public Vec3d Add(Vec3f a)
Parameters
a
Vec3f
Returns
AddCopy(double, double, double)
public Vec3d AddCopy(double x, double y, double z)
Parameters
Returns
AddCopy(float, float, float)
public Vec3d AddCopy(float x, float y, float z)
Parameters
Returns
AddCopy(BlockFacing)
public Vec3d AddCopy(BlockFacing facing)
Parameters
facing
BlockFacing
Returns
AddCopy(BlockPos)
public Vec3d AddCopy(BlockPos pos)
Parameters
pos
BlockPos
Returns
AddCopy(Vec3d)
public Vec3d AddCopy(Vec3d a)
Parameters
a
Vec3d
Returns
AddCopy(Vec3f)
public Vec3d AddCopy(Vec3f a)
Parameters
a
Vec3f
Returns
Ahead(double, double, double)
public Vec3d Ahead(double offset, double Pitch, double Yaw)
Parameters
Returns
Ahead(double, float, float)
public Vec3d Ahead(double offset, float Pitch, float Yaw)
Parameters
Returns
AheadCopy(double, double, double)
public Vec3d AheadCopy(double offset, double Pitch, double Yaw)
Parameters
Returns
AheadCopy(double, float, float)
public Vec3d AheadCopy(double offset, float Pitch, float Yaw)
Parameters
Returns
Clone()
public Vec3d Clone()
Returns
CreateFromBytes(BinaryReader)
public static Vec3d CreateFromBytes(BinaryReader reader)
Parameters
reader
BinaryReader
Returns
Cross(Vec3d)
public Vec3d Cross(Vec3d vec)
Parameters
vec
Vec3d
Returns
Cross(Vec3d, Vec3d)
public void Cross(Vec3d a, Vec3d b)
Parameters
Cross(Vec3d, Vec4d)
public void Cross(Vec3d a, Vec4d b)
Parameters
Cross(Vec4d, Vec4d)
public void Cross(Vec4d a, Vec4d b)
Parameters
DistanceTo(double, double, double)
public float DistanceTo(double x, double y, double z)
Parameters
Returns
DistanceTo(Vec3d)
public float DistanceTo(Vec3d pos)
Parameters
pos
Vec3d
Returns
Dot(Vec3d)
public double Dot(Vec3d a)
Parameters
a
Vec3d
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
Equals(Vec3d)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Vec3d other)
Parameters
other
Vec3dAn object to compare with this object.
Returns
Equals(Vec3d, double)
public bool Equals(Vec3d other, double epsilon)
Parameters
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
HorLength()
public double HorLength()
Returns
HorizontalSquareDistanceTo(double, double)
public float HorizontalSquareDistanceTo(double x, double z)
Parameters
Returns
HorizontalSquareDistanceTo(Vec3d)
public float HorizontalSquareDistanceTo(Vec3d pos)
Parameters
pos
Vec3d
Returns
Length()
public double Length()
Returns
LengthSq()
public double LengthSq()
Returns
Mul(double)
public Vec3d Mul(double val)
Parameters
val
double
Returns
Mul(double, double, double)
public Vec3d Mul(double x, double y, double z)
Parameters
Returns
Negate()
public void Negate()
Normalize()
public Vec3d Normalize()
Returns
Offset(double, double, double)
Note: adjusts the calling Vec3d, does not make a copy
public Vec3d Offset(double x, double y, double z)
Parameters
Returns
Offset(Vec3d)
Note: adjusts the calling Vec3d, does not make a copy
public Vec3d Offset(Vec3d b)
Parameters
b
Vec3d
Returns
OffsetCopy(double, double, double)
public Vec3d OffsetCopy(double x, double y, double z)
Parameters
Returns
OffsetCopy(float, float, float)
public Vec3d OffsetCopy(float x, float y, float z)
Parameters
Returns
RotatedCopy(float)
public Vec3d RotatedCopy(float yaw)
Parameters
yaw
float
Returns
Scale(double)
Note: adjusts the calling Vec3d, does not make a copy
public Vec3d Scale(double f)
Parameters
f
double
Returns
Set(double, double, double)
public Vec3d Set(double x, double y, double z)
Parameters
Returns
Set(EntityPos)
public Vec3d Set(EntityPos pos)
Parameters
pos
EntityPos
Returns
Set(BlockPos)
public Vec3d Set(BlockPos pos)
Parameters
pos
BlockPos
Returns
Set(Vec3d)
public Vec3d Set(Vec3d pos)
Parameters
pos
Vec3d
Returns
Set(Vec3f)
public Vec3d Set(Vec3f pos)
Parameters
pos
Vec3f
Returns
Set(Vec3i)
public Vec3d Set(Vec3i pos)
Parameters
pos
Vec3i
Returns
SetWithDimension(EntityPos)
Include dimension info. We don't always want this, but sometimes we do
public Vec3d SetWithDimension(EntityPos pos)
Parameters
pos
EntityPos
Returns
SquareDistanceTo(double, double, double)
public float SquareDistanceTo(double x, double y, double z)
Parameters
Returns
SquareDistanceTo(float, float, float)
public float SquareDistanceTo(float x, float y, float z)
Parameters
Returns
SquareDistanceTo(EntityPos)
public float SquareDistanceTo(EntityPos pos)
Parameters
pos
EntityPos
Returns
SquareDistanceTo(Vec3d)
public float SquareDistanceTo(Vec3d pos)
Parameters
pos
Vec3d
Returns
Sub(double, double, double)
public Vec3d Sub(double x, double y, double z)
Parameters
Returns
Sub(BlockPos)
public Vec3d Sub(BlockPos pos)
Parameters
pos
BlockPos
Returns
Sub(Vec3d)
public Vec3d Sub(Vec3d vec)
Parameters
vec
Vec3d
Returns
Sub(Vec3d, Vec3d)
public static Vec3d Sub(Vec3d a, Vec3d b)
Parameters
Returns
SubCopy(double, double, double)
public Vec3d SubCopy(double x, double y, double z)
Parameters
Returns
SubCopy(Vec3d)
public Vec3d SubCopy(Vec3d sub)
Parameters
sub
Vec3d
Returns
ToBytes(BinaryWriter)
public void ToBytes(BinaryWriter writer)
Parameters
writer
BinaryWriter
ToDoubleArray()
public double[] ToDoubleArray()
Returns
- double[]
ToFloatArray()
public float[] ToFloatArray()
Returns
- float[]
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToVec3f()
public Vec3f ToVec3f()
Returns
Operators
operator +(Vec3d, float)
public static Vec3d operator +(Vec3d left, float right)
Parameters
Returns
operator +(Vec3d, Vec3d)
public static Vec3d operator +(Vec3d left, Vec3d right)
Parameters
Returns
operator +(Vec3d, Vec3i)
public static Vec3d operator +(Vec3d left, Vec3i right)
Parameters
Returns
operator /(Vec3d, double)
public static Vec3d operator /(Vec3d left, double right)
Parameters
Returns
operator /(Vec3d, float)
public static Vec3d operator /(Vec3d left, float right)
Parameters
Returns
operator ==(Vec3d, Vec3d)
public static bool operator ==(Vec3d left, Vec3d right)
Parameters
Returns
operator !=(Vec3d, Vec3d)
public static bool operator !=(Vec3d left, Vec3d right)
Parameters
Returns
operator *(double, Vec3d)
public static Vec3d operator *(double left, Vec3d right)
Parameters
Returns
operator *(float, Vec3d)
public static Vec3d operator *(float left, Vec3d right)
Parameters
Returns
operator *(Vec3d, double)
public static Vec3d operator *(Vec3d left, double right)
Parameters
Returns
operator *(Vec3d, float)
public static Vec3d operator *(Vec3d left, float right)
Parameters
Returns
operator *(Vec3d, Vec3d)
public static double operator *(Vec3d left, Vec3d right)
Parameters
Returns
operator -(float, Vec3d)
public static Vec3d operator -(float left, Vec3d right)
Parameters
Returns
operator -(Vec3d, float)
public static Vec3d operator -(Vec3d left, float right)
Parameters
Returns
operator -(Vec3d, Vec3d)
public static Vec3d operator -(Vec3d left, Vec3d right)