Table of Contents

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

x double
y double
z double

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

double

Y

The Y-Component of the vector

public double Y

Field Value

double

Z

The Z-Component of the vector

public double Z

Field Value

double

Properties

this[int]

Returns the n-th coordinate

public double this[int index] { get; set; }

Parameters

index int

Property Value

double

Methods

Add(double)

public FastVec3d Add(double d)

Parameters

d double

Returns

FastVec3d

Add(double, double, double)

Adds given x/y/z coordinates to the vector

public FastVec3d Add(double x, double y, double z)

Parameters

x double
y double
z double

Returns

FastVec3d

Add(BlockPos)

Adds given BlockPos's x/y/z coordinates to the vector

public FastVec3d Add(BlockPos pos)

Parameters

pos BlockPos

Returns

FastVec3d

Add(Vec3i)

Adds given vector's x/y/z coordinates to the vector

public FastVec3d Add(Vec3i vec)

Parameters

vec Vec3i

Returns

FastVec3d

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

x double
y double
z double

Returns

FastVec3d

AddCopy(FastVec3d)

Adds both vectors into a new vector. Both source vectors remain unchanged.

public FastVec3d AddCopy(FastVec3d vec)

Parameters

vec FastVec3d

Returns

FastVec3d

Clone()

Creates a copy of the vetor

public FastVec3d Clone()

Returns

FastVec3d

CreateFromBytes(BinaryReader)

public static FastVec3d CreateFromBytes(BinaryReader reader)

Parameters

reader BinaryReader

Returns

FastVec3d

Distance(FastVec3d)

Calculates the distance the two endpoints

public double Distance(FastVec3d vec)

Parameters

vec FastVec3d

Returns

double

Distance(Vec3d)

Calculates the distance the two endpoints

public double Distance(Vec3d vec)

Parameters

vec Vec3d

Returns

double

DistanceSq(double, double, double)

Calculates the square distance the two endpoints

public double DistanceSq(double x, double y, double z)

Parameters

x double
y double
z double

Returns

double

Dot(double[])

Returns the dot product with given vector

public double Dot(double[] pos)

Parameters

pos double[]

Returns

double

Dot(float[])

Returns the dot product with given vector

public double Dot(float[] pos)

Parameters

pos float[]

Returns

double

Dot(Vec3d)

Returns the dot product with given vector

public double Dot(Vec3d a)

Parameters

a Vec3d

Returns

double

Dot(Vec3f)

Returns the dot product with given vector

public double Dot(Vec3f a)

Parameters

a Vec3f

Returns

double

Length()

Returns the length of this vector

public double Length()

Returns

double

Mul(double)

Multiplies each coordinate with given multiplier

public FastVec3d Mul(double multiplier)

Parameters

multiplier double

Returns

FastVec3d

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

FastVec3d

NormalizedCopy()

Creates a new vectors that is the normalized version of this vector.

public FastVec3d NormalizedCopy()

Returns

FastVec3d

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

x double
y double
z double

Returns

FastVec3d

Set(double[])

public FastVec3d Set(double[] vec)

Parameters

vec double[]

Returns

FastVec3d

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

FastVec3d

ToDoubleArray()

public double[] ToDoubleArray()

Returns

double[]

ToString()

Simple string represenation of the x/y/z components

public override string ToString()

Returns

string

ToVec3d()

Creates a new double precision vector with the same coordinates

public Vec3d ToVec3d()

Returns

Vec3d

Write(BinaryWriter)

public void Write(BinaryWriter writer)

Parameters

writer BinaryWriter