Skip to content

Struct Double3

Namespace: Apogee.Core.Numerics
Assembly: Apogee.Core.dll

A position in the double-precision world: three doubles (24 bytes). Float has 24 bits of precision, so at 5 km from the origin a float position moves in 0.5 mm steps; a double keeps sub-micrometre steps for thousands of kilometres. Only positions are double. Directions, rotations, scales and everything the GPU sees stay float: positions are turned into float offsets from a nearby origin (the camera) with before they are used. Plain scalar code on purpose: positions are added and subtracted, not crunched in bulk.

public readonly struct Double3 : IEquatable<Double3>

Implements

IEquatable<Double3>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

Double3(double, double, double)

A position in the double-precision world: three doubles (24 bytes). Float has 24 bits of precision, so at 5 km from the origin a float position moves in 0.5 mm steps; a double keeps sub-micrometre steps for thousands of kilometres. Only positions are double. Directions, rotations, scales and everything the GPU sees stay float: positions are turned into float offsets from a nearby origin (the camera) with before they are used. Plain scalar code on purpose: positions are added and subtracted, not crunched in bulk.

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

Parameters

x double

y double

z double

Double3(double)

public Double3(double value)

Parameters

value double

Fields

One

public static readonly Double3 One

Field Value

Double3

Properties

X

public double X { get; }

Property Value

double

Y

public double Y { get; }

Property Value

double

Z

public double Z { get; }

Property Value

double

Zero

public static Double3 Zero { get; }

Property Value

Double3

Methods

Distance(Double3, Double3)

public static double Distance(Double3 a, Double3 b)

Parameters

a Double3

b Double3

Returns

double

DistanceSquared(Double3, Double3)

public static double DistanceSquared(Double3 a, Double3 b)

Parameters

a Double3

b Double3

Returns

double

Dot(Double3, Double3)

public static double Dot(Double3 a, Double3 b)

Parameters

a Double3

b Double3

Returns

double

Equals(Double3)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Double3 other)

Parameters

other Double3

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object?

The object to compare with the current instance.

Returns

bool

true if obj and 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()

public double Length()

Returns

double

LengthSquared()

public double LengthSquared()

Returns

double

Lerp(Double3, Double3, double)

public static Double3 Lerp(Double3 a, Double3 b, double t)

Parameters

a Double3

b Double3

t double

Returns

Double3

Max(Double3, Double3)

public static Double3 Max(Double3 a, Double3 b)

Parameters

a Double3

b Double3

Returns

Double3

Min(Double3, Double3)

public static Double3 Min(Double3 a, Double3 b)

Parameters

a Double3

b Double3

Returns

Double3

RelativeTo(Double3)

The offset from origin to this position as floats. The subtraction is done in double, so the result is exact to float precision however far both are from the world's origin: this is how positions reach the GPU.

public Vector3 RelativeTo(Double3 origin)

Parameters

origin Double3

Returns

Vector3

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator +(Double3, Double3)

public static Double3 operator +(Double3 a, Double3 b)

Parameters

a Double3

b Double3

Returns

Double3

operator +(Double3, Vector3)

public static Double3 operator +(Double3 a, Vector3 b)

Parameters

a Double3

b Vector3

Returns

Double3

operator /(Double3, double)

public static Double3 operator /(Double3 a, double b)

Parameters

a Double3

b double

Returns

Double3

operator ==(Double3, Double3)

public static bool operator ==(Double3 a, Double3 b)

Parameters

a Double3

b Double3

Returns

bool

explicit operator Vector3(Double3)

Narrows to float; positions far from the origin lose precision here, which is what avoids.

public static explicit operator Vector3(Double3 value)

Parameters

value Double3

Returns

Vector3

implicit operator Double3(Vector3)

public static implicit operator Double3(Vector3 value)

Parameters

value Vector3

Returns

Double3

operator !=(Double3, Double3)

public static bool operator !=(Double3 a, Double3 b)

Parameters

a Double3

b Double3

Returns

bool

operator *(Double3, double)

public static Double3 operator *(Double3 a, double b)

Parameters

a Double3

b double

Returns

Double3

operator *(double, Double3)

public static Double3 operator *(double a, Double3 b)

Parameters

a double

b Double3

Returns

Double3

operator -(Double3, Double3)

public static Double3 operator -(Double3 a, Double3 b)

Parameters

a Double3

b Double3

Returns

Double3

operator -(Double3, Vector3)

public static Double3 operator -(Double3 a, Vector3 b)

Parameters

a Double3

b Vector3

Returns

Double3

operator -(Double3)

public static Double3 operator -(Double3 a)

Parameters

a Double3

Returns

Double3