VectorD struct
Represents a three-dimensional vector. Uses Double, like vanilla's positions and movement (Vec3), which keep their precision far from the world's origin where a VectorF doesn't.
public struct VectorD : IEquatable<VectorD>, INetworkSerializable<VectorD>
In Obsidian.API.
Remarks
On the network it's three doubles (vanilla's Vec3.STREAM_CODEC).
Constructors
VectorD(double)
public VectorD(double value);Creates new instance of VectorD with VectorD.X, VectorD.Y and VectorD.Z set to value.
VectorD(double, double, double)
public VectorD(double x, double y, double z);Creates a new instance of VectorD with specific values.
Properties
Magnitude
public double Magnitude { get; }Calculates magnitude of this VectorD.
X
public double X { get; set; }The X component of the VectorD.
Y
public double Y { get; set; }The Y component of the VectorD.
Z
public double Z { get; set; }The Z component of the VectorD.
Methods
Clamp(VectorD, VectorD)
public VectorD Clamp(VectorD min, VectorD max);Returns VectorD clamped to the inclusive range of min and max.
public static VectorD Clamp(VectorD value, VectorD min, VectorD max);public static VectorD Cross(VectorD value1, VectorD value2);public void Deconstruct(out double x, out double y, out double z);Distance(VectorD, VectorD)
public static double Distance(VectorD from, VectorD to);Calculates the distance between two VectorDs.
public static double Dot(VectorD value1, VectorD value2);public override bool Equals(object obj);Equals(VectorD)
public bool Equals(VectorD other);Indicates whether this VectorD has exactly the same parts as other; see VectorD.IsNear to compare with a tolerance.
Floor()
public VectorD Floor();Rounds each part of this VectorD down to a whole number.
public override int GetHashCode();IsNear(VectorD, double)
public bool IsNear(VectorD other, double tolerance = 0.01);Indicates whether each part of this VectorD is within tolerance of other's.
public static VectorD Lerp(VectorD value1, VectorD value2, double amount);MagnitudeSquared()
public double MagnitudeSquared();Calculates magnitude of this VectorD squared.
Max(VectorD, VectorD)
public static VectorD Max(VectorD value1, VectorD value2);The larger of each part of two vectors.
Min(VectorD, VectorD)
public static VectorD Min(VectorD value1, VectorD value2);The smaller of each part of two vectors.
Normalize()
public VectorD Normalize();Performs vector normalization on this VectorD's coordinates.
Read(INetStreamReader)
public static VectorD Read(INetStreamReader reader);Reads a vector of three doubles.
ToString()
public override string ToString();Returns VectorD formatted as a String.
Write(VectorD, INetStreamWriter)
public static void Write(VectorD value, INetStreamWriter writer);Writes the vector as three doubles.
Operators
explicit operator Vector(VectorD)
public static explicit operator Vector(VectorD value);The block a position is in: each part rounded down, as vanilla's BlockPos.containing does.
explicit operator VectorF(VectorD)
public static explicit operator VectorF(VectorD value);Loses precision: doubles round to the nearest float.
implicit operator VectorD(Vector)
public static implicit operator VectorD(Vector value);A block position as the position of its lowest corner.
implicit operator VectorD(VectorF)
public static implicit operator VectorD(VectorF value);public static bool operator !=(VectorD a, VectorD b);public static VectorD operator *(double a, VectorD b);public static VectorD operator *(VectorD a, double b);public static VectorD operator *(VectorD a, VectorD b);public static VectorD operator +(VectorD a, (int, int, int) b);public static VectorD operator +(VectorD a, double b);public static VectorD operator +(VectorD a, VectorD b);public static VectorD operator -(VectorD a);public static VectorD operator -(VectorD a, double b);public static VectorD operator -(VectorD a, VectorD b);public static VectorD operator /(VectorD a, double b);public static VectorD operator /(VectorD a, VectorD b);public static bool operator ==(VectorD a, VectorD b);Fields
Down
public static readonly VectorD Down;A read-only field that represents VectorD with coordinates (0, -1, 0).
One
public static readonly VectorD One;A read-only field that represents VectorD with coordinates (1, 1, 1).
Up
public static readonly VectorD Up;A read-only field that represents VectorD with coordinates (0, 1, 0).
Zero
public static readonly VectorD Zero;A read-only field that represents VectorD with coordinates (0, 0, 0).