Table of Contents

Struct Vector3d

Namespace
FixedMathSharp
Assembly
FixedMathSharp.dll

Represents a 3D vector with fixed-point precision, supporting a wide range of vector operations such as rotation, scaling, interpolation, and projection.

[MemoryPackable(GenerateType.Object)]
public struct Vector3d : IEquatable<Vector3d>, IComparable<Vector3d>, IEqualityComparer<Vector3d>, ISpanFormattable, IFormattable, IMemoryPackable<Vector3d>, IMemoryPackFormatterRegister
Implements
IMemoryPackable<Vector3d>
IMemoryPackFormatterRegister
Inherited Members
Extension Methods

Remarks

The Vector3d struct is designed for high-precision applications in 3D space, including games, simulations, and physics engines. It offers essential operations like addition, subtraction, dot product, cross product, distance calculation, and normalization.

FixedMathSharp's canonical 3D basis is +X right, +Y up, and +Z forward. Direction-named core APIs use that convention; engine-specific naming, basis, handedness, and matrix semantics should be converted at adapter boundaries.

Use Cases:

  • Modeling 3D positions, directions, and velocities with fixed-point precision.
  • Performing vector transformations, including rotations using quaternions.
  • Calculating distances, angles, projections, and interpolation between vectors.
  • Essential for fixed-point math scenarios where floating-point precision isn't suitable.

Constructors

Vector3d(Fixed64, Fixed64, Fixed64)

Initializes a new instance of the Vector3d structure with the specified X, Y, and Z components.

[JsonConstructor]
public Vector3d(Fixed64 x, Fixed64 y, Fixed64 z)

Parameters

x Fixed64

The value of the X component of the vector.

y Fixed64

The value of the Y component of the vector.

z Fixed64

The value of the Z component of the vector.

Vector3d(int, int, int)

Initializes a new instance of the Vector3d structure using integer values for the X, Y, and Z components.

public Vector3d(int xInt, int yInt, int zInt)

Parameters

xInt int

The value of the X component as an integer.

yInt int

The value of the Y component as an integer.

zInt int

The value of the Z component as an integer.

Fields

X

The X component of the vector.

[JsonInclude]
[MemoryPackOrder(0)]
public Fixed64 X

Field Value

Fixed64

Y

The Y component of the vector.

[JsonInclude]
[MemoryPackOrder(1)]
public Fixed64 Y

Field Value

Fixed64

Z

The Z component of the vector.

[JsonInclude]
[MemoryPackOrder(2)]
public Fixed64 Z

Field Value

Fixed64

Properties

Backward

The backward direction vector in the canonical 3D basis (0, 0, -1).

public static Vector3d Backward { get; }

Property Value

Vector3d

Direction

Calculates the forward direction vector from pitch (x) and yaw (y) angles.

[JsonIgnore]
[MemoryPackIgnore]
public Vector3d Direction { get; }

Property Value

Vector3d

Remarks

This is commonly used to determine the direction an object is facing in 3D space, where 'x' represents pitch around the X axis and 'y' represents yaw around the Y axis. At zero pitch and yaw this returns Forward. Positive pitch rotates the forward direction toward Down.

Down

The downward direction vector in the canonical 3D basis (0, -1, 0).

public static Vector3d Down { get; }

Property Value

Vector3d

Forward

The forward direction vector in the canonical 3D basis (0, 0, 1).

public static Vector3d Forward { get; }

Property Value

Vector3d

Remarks

FixedMathSharp defines semantic forward as +Z. Use CoordinateConvention3d at adapter boundaries when an external API uses different semantic axes, such as -Z forward or +X forward with +Z up.

IsZero

Are all components of this vector equal to zero?

[JsonIgnore]
[MemoryPackIgnore]
public bool IsZero { get; }

Property Value

bool

this[int]

Gets or sets the component value at the specified index.

[JsonIgnore]
[MemoryPackIgnore]
public Fixed64 this[int index] { get; set; }

Parameters

index int

The zero-based index of the component to access. Valid values are 0 (x), 1 (y), or 2 (z).

Property Value

Fixed64

The value of the component at the specified index.

Remarks

Use this indexer to access or modify the x, y, or z components of the vector by index. Index 0 corresponds to x, 1 to y, and 2 to z.

Exceptions

IndexOutOfRangeException

Thrown if index is less than 0 or greater than 2.

Left

The left direction vector in the canonical 3D basis (-1, 0, 0).

public static Vector3d Left { get; }

Property Value

Vector3d

LeftHandNormal

Provides a rotated version of the current vector, where rotation is a 90 degrees rotation around the Y axis in the clockwise direction.

[JsonIgnore]
[MemoryPackIgnore]
public Vector3d LeftHandNormal { get; }

Property Value

Vector3d

LongStateHash

Returns a long hash of the vector based on its x, y, and z values.

[JsonIgnore]
[MemoryPackIgnore]
public long LongStateHash { get; }

Property Value

long

Magnitude

Returns the actual length of this vector (RO).

[JsonIgnore]
[MemoryPackIgnore]
public Fixed64 Magnitude { get; }

Property Value

Fixed64

MagnitudeSquared

This vector's squared magnitude (aka length squared). If you're doing distance checks, use MagnitudeSquared and square the distance you're checking against. If you need to know the actual distance, use Magnitude.

[JsonIgnore]
[MemoryPackIgnore]
public Fixed64 MagnitudeSquared { get; }

Property Value

Fixed64

The magnitude.

Negative

(-1, -1, -1)

public static Vector3d Negative { get; }

Property Value

Vector3d

Normalized

Normalizes the given vector, returning a unit vector with the same direction.

[JsonIgnore]
[MemoryPackIgnore]
public Vector3d Normalized { get; }

Property Value

Vector3d

A normalized (unit) vector with the same direction.

One

(1, 1, 1)

public static Vector3d One { get; }

Property Value

Vector3d

Right

The right direction vector in the canonical 3D basis (1, 0, 0).

public static Vector3d Right { get; }

Property Value

Vector3d

RightHandNormal

Provides a rotated version of the current vector, where rotation is a 90 degrees rotation around the Y axis in the counter-clockwise direction.

[JsonIgnore]
[MemoryPackIgnore]
public Vector3d RightHandNormal { get; }

Property Value

Vector3d

Remarks

These operations rotate the vector 90 degrees around the Y-axis. Note that the positive direction of rotation is defined by the right-hand rule: If your right hand's thumb points in the positive Y direction, then your fingers curl in the positive direction of rotation.

StateHash

Returns a hash of the vector based on its state.

[JsonIgnore]
[MemoryPackIgnore]
public int StateHash { get; }

Property Value

int

Up

The upward direction vector in the canonical 3D basis (0, 1, 0).

public static Vector3d Up { get; }

Property Value

Vector3d

Zero

(0, 0, 0)

public static Vector3d Zero { get; }

Property Value

Vector3d

Methods

Abs(Vector3d)

Returns a new Vector3d where each component is the absolute value of the corresponding input component.

public static Vector3d Abs(Vector3d value)

Parameters

value Vector3d

The input vector.

Returns

Vector3d

A vector with absolute values for each component.

Add(Vector3d, Vector3d)

Adds two vectors component-wise.

public static Vector3d Add(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d
v2 Vector3d

Returns

Vector3d

AddInPlace(Fixed64)

Adds the specified values to the components of the vector in place and returns the modified vector.

public Vector3d AddInPlace(Fixed64 amount)

Parameters

amount Fixed64

The amount to add to the components.

Returns

Vector3d

The modified vector after addition.

AddInPlace(Fixed64, Fixed64, Fixed64)

Adds the specified values to the components of the vector in place and returns the modified vector.

public Vector3d AddInPlace(Fixed64 xAmount, Fixed64 yAmount, Fixed64 zAmount)

Parameters

xAmount Fixed64

The amount to add to the x component.

yAmount Fixed64

The amount to add to the y component.

zAmount Fixed64

The amount to add to the z component.

Returns

Vector3d

AddInPlace(Vector3d)

Adds the specified vector components to the corresponding components of the in place vector and returns the modified vector.

public Vector3d AddInPlace(Vector3d other)

Parameters

other Vector3d

The other vector to add the components.

Returns

Vector3d

AllComponentsGreaterThanEpsilon()

Checks whether all components are strictly greater than Epsilon.

public bool AllComponentsGreaterThanEpsilon()

Returns

bool

Angle(Vector3d, Vector3d)

Computes the angle in degrees between two vectors.

public static Fixed64 Angle(Vector3d from, Vector3d to)

Parameters

from Vector3d

The starting vector.

to Vector3d

The target vector.

Returns

Fixed64

The angle in degrees between the two vectors.

Remarks

This method calculates the angle by using the dot product between the vectors and normalizing the result. The angle is always the smaller angle between the two vectors on a plane.

AreAlmostParallel(Vector3d, Vector3d, Fixed64)

Determines if two vectors are approximately parallel based on a cosine similarity threshold.

public static bool AreAlmostParallel(Vector3d v1, Vector3d v2, Fixed64 cosThreshold)

Parameters

v1 Vector3d

The first normalized vector.

v2 Vector3d

The second normalized vector.

cosThreshold Fixed64

The cosine similarity threshold for near-parallel vectors.

Returns

bool

True if the vectors are nearly parallel, false otherwise.

AreParallel(Vector3d, Vector3d)

Determines if two vectors are exactly parallel by checking if their cross product is zero.

public static bool AreParallel(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d

The first vector.

v2 Vector3d

The second vector.

Returns

bool

True if the vectors are exactly parallel, false otherwise.

BarycentricCoordinates(Vector3d, Vector3d, Vector3d, Fixed64, Fixed64)

Calculates the barycentric coordinates of a point with respect to a triangle defined by three vertices.

public static Vector3d BarycentricCoordinates(Vector3d coordA, Vector3d coordB, Vector3d coordC, Fixed64 weightB, Fixed64 weightC)

Parameters

coordA Vector3d

The first vertex of the triangle.

coordB Vector3d

The second vertex of the triangle.

coordC Vector3d

The third vertex of the triangle.

weightB Fixed64

The barycentric weight for the second vertex.

weightC Fixed64

The barycentric weight for the third vertex.

Returns

Vector3d

The cartesian translation represented by the barycentric coordinates within the triangle.

CatmullRom(Vector3d, Vector3d, Vector3d, Vector3d, Fixed64)

Calculates a position between four points using Catmull-Rom interpolation.

public static Vector3d CatmullRom(Vector3d value1, Vector3d value2, Vector3d value3, Vector3d value4, Fixed64 amount)

Parameters

value1 Vector3d

The first point.

value2 Vector3d

The second point.

value3 Vector3d

The third point.

value4 Vector3d

The fourth point.

amount Fixed64

The interpolation factor.

Returns

Vector3d

The interpolated position.

Clamp(Vector3d, Vector3d, Vector3d)

Clamps each component of the given Vector3d within the specified min and max bounds.

public static Vector3d Clamp(Vector3d value, Vector3d min, Vector3d max)

Parameters

value Vector3d

The vector to clamp.

min Vector3d

The minimum bounds.

max Vector3d

The maximum bounds.

Returns

Vector3d

A vector with each component clamped between min and max.

ClampMagnitude(Vector3d, Fixed64)

Clamps the given Vector3d within the specified magnitude.

public static Vector3d ClampMagnitude(Vector3d value, Fixed64 maxMagnitude)

Parameters

value Vector3d
maxMagnitude Fixed64

Returns

Vector3d

ClosestPointOnLineSegment(Vector3d, Vector3d, Vector3d)

Calculates the closest point on a line segment defined by start and end points to a given point in space.

public static Vector3d ClosestPointOnLineSegment(Vector3d point, Vector3d start, Vector3d end)

Parameters

point Vector3d

The point to project onto the segment.

start Vector3d

The start of the line segment.

end Vector3d

The end of the line segment.

Returns

Vector3d

The closest point on the line segment to the given point.

Remarks

Endpoint differences and projection products are evaluated across the complete raw domain before the parameter is clamped and rounded. A direction whose exact Q64.64 squared-length total is at most 2^31 raw units rounds to zero in Q32.32 and returns start.

CompareDistanceSquared(Vector3d, Vector3d, Vector3d, Vector3d)

Compares the exact squared distances between two pairs of points without fixed-point saturation.

public static int CompareDistanceSquared(Vector3d leftStart, Vector3d leftEnd, Vector3d rightStart, Vector3d rightEnd)

Parameters

leftStart Vector3d
leftEnd Vector3d
rightStart Vector3d
rightEnd Vector3d

Returns

int

A negative value when the left distance is shorter, zero when the distances are equal, or a positive value when the left distance is longer.

CompareMagnitudeSquared(Vector3d, Vector3d)

Compares the exact squared magnitudes of two vectors without fixed-point saturation.

public static int CompareMagnitudeSquared(Vector3d left, Vector3d right)

Parameters

left Vector3d
right Vector3d

Returns

int

A negative value when left is shorter, zero when the magnitudes are equal, or a positive value when left is longer.

CompareProjection(Vector3d, Vector3d, Vector3d)

Compares the exact component-difference projections of two vectors.

public static int CompareProjection(Vector3d candidate, Vector3d current, Vector3d direction)

Parameters

candidate Vector3d

The candidate point.

current Vector3d

The point to compare against.

direction Vector3d

The projection direction; it need not be normalized.

Returns

int

A negative value, zero, or a positive value when the candidate projection is respectively less than, equal to, or greater than the current projection.

CompareTo(Vector3d)

Compares the current Vector3d instance with another Vector3d based on their squared magnitudes.

public int CompareTo(Vector3d other)

Parameters

other Vector3d

The Vector3d instance to compare with the current instance.

Returns

int

A value less than zero if this instance is less than other; zero if this instance is equal to other; or a value greater than zero if this instance is greater than other, as determined by their squared magnitudes.

Remarks

This comparison uses the squared magnitude of each vector, which avoids the computational cost of calculating the actual magnitude. Use this method when only relative vector lengths are important.

Cross(Fixed64, Fixed64, Fixed64)

Returns the cross vector of this vector with another vector.

public Vector3d Cross(Fixed64 otherX, Fixed64 otherY, Fixed64 otherZ)

Parameters

otherX Fixed64
otherY Fixed64
otherZ Fixed64

Returns

Vector3d

A new vector representing the cross product.

Cross(Vector3d, Vector3d)

Cross Product of two vectors.

public static Vector3d Cross(Vector3d lhs, Vector3d rhs)

Parameters

lhs Vector3d
rhs Vector3d

Returns

Vector3d

CrossProduct(Fixed64, Fixed64, Fixed64)

Computes the cross product magnitude of this vector with another vector.

public Fixed64 CrossProduct(Fixed64 otherX, Fixed64 otherY, Fixed64 otherZ)

Parameters

otherX Fixed64

The X component of the other vector.

otherY Fixed64

The Y component of the other vector.

otherZ Fixed64

The Z component of the other vector.

Returns

Fixed64

The cross product magnitude.

CrossProduct(Vector3d, Vector3d)

Computes the cross product magnitude of this vector with another vector.

public static Fixed64 CrossProduct(Vector3d lhs, Vector3d rhs)

Parameters

lhs Vector3d
rhs Vector3d

Returns

Fixed64

The cross product magnitude.

Deconstruct(out Fixed64, out Fixed64, out Fixed64)

Deconstructs the Vector3d into its three Fixed64 components.

public void Deconstruct(out Fixed64 x, out Fixed64 y, out Fixed64 z)

Parameters

x Fixed64
y Fixed64
z Fixed64

Deconstruct(out double, out double, out double)

Deconstructs the Vector3d into its three double components.

public void Deconstruct(out double x, out double y, out double z)

Parameters

x double
y double
z double

Deconstruct(out int, out int, out int)

Deconstructs the Vector3d into its three int components.

public void Deconstruct(out int x, out int y, out int z)

Parameters

x int
y int
z int

Deconstruct(out long, out long, out long)

Deconstructs the Vector3d into its three long components.

public void Deconstruct(out long x, out long y, out long z)

Parameters

x long
y long
z long

Distance(Fixed64, Fixed64, Fixed64)

Computes the distance between this vector and another vector.

public Fixed64 Distance(Fixed64 otherX, Fixed64 otherY, Fixed64 otherZ)

Parameters

otherX Fixed64

The x component of the other vector.

otherY Fixed64

The y component of the other vector.

otherZ Fixed64

The z component of the other vector.

Returns

Fixed64

The distance between the two vectors.

Distance(Vector3d, Vector3d)

Computes the distance between this vector and another vector.

public static Fixed64 Distance(Vector3d start, Vector3d end)

Parameters

start Vector3d
end Vector3d

Returns

Fixed64

The distance between the two vectors.

DistanceSquared(Fixed64, Fixed64, Fixed64)

Calculates the squared distance between two vectors, avoiding the need for a square root operation.

public Fixed64 DistanceSquared(Fixed64 otherX, Fixed64 otherY, Fixed64 otherZ)

Parameters

otherX Fixed64
otherY Fixed64
otherZ Fixed64

Returns

Fixed64

The squared distance between the two vectors.

DistanceSquared(Vector3d, Vector3d)

Calculates the squared distance between two vectors, avoiding the need for a square root operation.

public static Fixed64 DistanceSquared(Vector3d start, Vector3d end)

Parameters

start Vector3d
end Vector3d

Returns

Fixed64

The squared distance between the two vectors.

Divide(Vector3d, Fixed64)

Divides each vector component by the specified scalar.

public static Vector3d Divide(Vector3d value, Fixed64 divisor)

Parameters

value Vector3d
divisor Fixed64

Returns

Vector3d

Divide(Vector3d, Vector3d)

Divides each component of the first vector by the corresponding component of the second vector.

public static Vector3d Divide(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d
v2 Vector3d

Returns

Vector3d

DivideInPlace(Fixed64)

Divides each component of the vector by the specified scalar divisor in place and returns the modified vector.

public Vector3d DivideInPlace(Fixed64 divisor)

Parameters

divisor Fixed64

Returns

Vector3d

DivideInPlace(Fixed64, Fixed64, Fixed64)

Divides each component of the vector by the corresponding divisor in place and returns the modified vector.

public Vector3d DivideInPlace(Fixed64 divisorX, Fixed64 divisorY, Fixed64 divisorZ)

Parameters

divisorX Fixed64
divisorY Fixed64
divisorZ Fixed64

Returns

Vector3d

DivideInPlace(Vector3d)

Divides each component of the vector by the corresponding component of the given vector in place and returns the modified vector.

public Vector3d DivideInPlace(Vector3d divisor)

Parameters

divisor Vector3d

Returns

Vector3d

Dot(Fixed64, Fixed64, Fixed64)

Computes the dot product of this vector with another vector specified by its components.

public Fixed64 Dot(Fixed64 otherX, Fixed64 otherY, Fixed64 otherZ)

Parameters

otherX Fixed64

The x component of the other vector.

otherY Fixed64

The y component of the other vector.

otherZ Fixed64

The z component of the other vector.

Returns

Fixed64

The dot product of the two vectors.

Dot(Vector3d, Vector3d)

Dot Product of two vectors.

public static Fixed64 Dot(Vector3d lhs, Vector3d rhs)

Parameters

lhs Vector3d
rhs Vector3d

Returns

Fixed64

Equals(Vector3d)

public bool Equals(Vector3d other)

Parameters

other Vector3d

Returns

bool

Equals(Vector3d, Vector3d)

public bool Equals(Vector3d x, Vector3d y)

Parameters

x Vector3d
y Vector3d

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

FromDouble(double, double, double)

Initializes a new instance of the Vector3d structure using the specified X, Y, and Z coordinates as double-precision floating-point values.

public static Vector3d FromDouble(double xDoub, double yDoub, double zDoub)

Parameters

xDoub double

The X coordinate of the vector, specified as a double-precision floating-point value.

yDoub double

The Y coordinate of the vector, specified as a double-precision floating-point value.

zDoub double

The Z coordinate of the vector, specified as a double-precision floating-point value.

Returns

Vector3d

Remarks

This constructor allows for convenient creation of a Vector3d from double values, which are internally converted to the Fixed64 representation used by the structure. Components are converted through FromDouble(double), so non-finite values throw ArgumentOutOfRangeException and finite values outside the Q32.32 range throw OverflowException.

GetDirection(Vector3d, Vector3d)

Returns the normalized direction from start toward end across the complete coordinate domain.

public static Vector3d GetDirection(Vector3d start, Vector3d end)

Parameters

start Vector3d
end Vector3d

Returns

Vector3d

Remarks

Equal endpoints return Zero. Endpoint differences are evaluated exactly even when a component cannot be represented by Fixed64.

GetHashCode()

public override int GetHashCode()

Returns

int

GetHashCode(Vector3d)

public int GetHashCode(Vector3d obj)

Parameters

obj Vector3d

Returns

int

GetMagnitude(Vector3d)

Returns the magnitude (length) of this vector.

public static Fixed64 GetMagnitude(Vector3d vector)

Parameters

vector Vector3d

The vector whose magnitude is being calculated.

Returns

Fixed64

The magnitude of the vector.

GetNormalized(Vector3d)

Normalizes the given vector, returning a unit vector with the same direction.

public static Vector3d GetNormalized(Vector3d value)

Parameters

value Vector3d

The vector to normalize.

Returns

Vector3d

A normalized (unit) vector with the same direction.

GetNormalizedProjectionOnPlane(Vector3d, Vector3d)

Returns the normalized direction of a vector projected onto a plane.

public static Vector3d GetNormalizedProjectionOnPlane(Vector3d vector, Vector3d planeNormal)

Parameters

vector Vector3d
planeNormal Vector3d

Returns

Vector3d

Remarks

The rejection is formed exactly with full-domain intermediates before returning its nearest representable normalized direction. A zero normal returns the normalized input vector; a zero projection returns Zero.

HermiteSpline(Vector3d, Vector3d, Vector3d, Vector3d, Fixed64)

Calculates a position between two points using Hermite spline interpolation, which takes into account the tangents at the endpoints for smoother transitions.

public static Vector3d HermiteSpline(Vector3d value1, Vector3d tangent1, Vector3d value2, Vector3d tangent2, Fixed64 amount)

Parameters

value1 Vector3d

The first point.

tangent1 Vector3d

The tangent at the first point.

value2 Vector3d

The second point.

tangent2 Vector3d

The tangent at the second point.

amount Fixed64

The interpolation factor.

Returns

Vector3d

The interpolated position.

InverseRotate(Vector3d, Vector3d, FixedQuaternion)

Applies the inverse of a specified quaternion rotation to the vector around a given position.

public static Vector3d InverseRotate(Vector3d source, Vector3d position, FixedQuaternion rotation)

Parameters

source Vector3d

The vector to rotate.

position Vector3d

The position around which the vector is rotated.

rotation FixedQuaternion

The quaternion representing the inverse rotation.

Returns

Vector3d

The rotated vector.

IsNormalized()

Checks whether the nonzero squared magnitude is within Epsilon of 1.

public bool IsNormalized()

Returns

bool

Lerp(Vector3d, Vector3d, Fixed64)

Linearly interpolates between two points.

public static Vector3d Lerp(Vector3d a, Vector3d b, Fixed64 mag)

Parameters

a Vector3d

Start value, returned when t = 0.

b Vector3d

End value, returned when t = 1.

mag Fixed64

Value used to interpolate between a and b.

Returns

Vector3d

Interpolated value, equals to a + (b - a) * t.

Max(Vector3d, Vector3d)

Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.

public static Vector3d Max(Vector3d value1, Vector3d value2)

Parameters

value1 Vector3d

The first vector.

value2 Vector3d

The second vector.

Returns

Vector3d

The maximized vector.

Midpoint(Vector3d, Vector3d)

Computes the midpoint between two vectors.

public static Vector3d Midpoint(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d

The first vector.

v2 Vector3d

The second vector.

Returns

Vector3d

The midpoint vector.

Min(Vector3d, Vector3d)

Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.

public static Vector3d Min(Vector3d value1, Vector3d value2)

Parameters

value1 Vector3d

The first vector.

value2 Vector3d

The second vector.

Returns

Vector3d

The minimized vector.

Multiply(Vector3d, Fixed64)

Multiplies each vector component by the specified scalar.

public static Vector3d Multiply(Vector3d value, Fixed64 factor)

Parameters

value Vector3d
factor Fixed64

Returns

Vector3d

Multiply(Vector3d, Vector3d)

Multiplies two vectors component-wise.

public static Vector3d Multiply(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d
v2 Vector3d

Returns

Vector3d

MultiplyInPlace(Fixed64)

Multiplies the components of the vector by the specified scalar factor in place and returns the modified vector.

public Vector3d MultiplyInPlace(Fixed64 factor)

Parameters

factor Fixed64

The scalar factor to multiply each component by.

Returns

Vector3d

MultiplyInPlace(Fixed64, Fixed64, Fixed64)

Multiplies each component of the vector by the corresponding factor in place and returns the modified vector.

public Vector3d MultiplyInPlace(Fixed64 factorX, Fixed64 factorY, Fixed64 factorZ)

Parameters

factorX Fixed64
factorY Fixed64
factorZ Fixed64

Returns

Vector3d

MultiplyInPlace(Vector3d)

Multiplies each component of the vector by the corresponding component of the given vector in place and returns the modified vector.

public Vector3d MultiplyInPlace(Vector3d factor)

Parameters

factor Vector3d

The vector containing the multiplication factors for each component.

Returns

Vector3d

Negate(Vector3d)

Returns a vector that is the negation of the specified vector, effectively reversing its direction.

public static Vector3d Negate(Vector3d value)

Parameters

value Vector3d

Returns

Vector3d

NormalizeInPlace()

Normalizes this vector in place, making its magnitude (length) equal to 1, and returns the modified vector.

public Vector3d NormalizeInPlace()

Returns

Vector3d

The normalized vector.

Remarks

If the vector is zero-length or already normalized, no operation is performed. This method modifies the current vector in place and supports method chaining.

NormalizeInPlace(out Fixed64)

Normalizes this vector in place and outputs its original magnitude.

public Vector3d NormalizeInPlace(out Fixed64 mag)

Parameters

mag Fixed64

Returns

Vector3d

Remarks

If the vector is zero-length or already normalized, no operation is performed, but the original magnitude will still be output.

Project(Vector3d, Vector3d)

Projects a vector onto another vector.

public static Vector3d Project(Vector3d vector, Vector3d onNormal)

Parameters

vector Vector3d
onNormal Vector3d

Returns

Vector3d

ProjectNonNegativeDifference(Vector3d, Vector3d, Vector3d)

Projects target minus source onto a direction without intermediate saturation, then returns a conservative nonnegative result.

public static Fixed64 ProjectNonNegativeDifference(Vector3d target, Vector3d source, Vector3d direction)

Parameters

target Vector3d

The target point.

source Vector3d

The source point.

direction Vector3d

The projection direction; it need not be normalized.

Returns

Fixed64

Zero for a nonpositive projection, the positive projection floored to Q32.32, or MaxValue when only the final result is unrepresentable.

ProjectNonNegativeDifferenceParameter(Vector3d, Vector3d, Vector3d)

Projects target minus source onto direction and returns the nonnegative parametric coordinate along that direction.

public static Fixed64 ProjectNonNegativeDifferenceParameter(Vector3d target, Vector3d source, Vector3d direction)

Parameters

target Vector3d
source Vector3d
direction Vector3d

Returns

Fixed64

Remarks

Unlike ProjectNonNegativeDifference(Vector3d, Vector3d, Vector3d), this method divides the exact dot product by the direction's exact squared length. The direction therefore need not have an exactly unit squared length. Zero and negative projections return zero; an unrepresentable positive parameter saturates to MaxValue.

ProjectOnPlane(Vector3d, FixedPlane)

Projects a point onto a plane defined by a normal and a distance from the origin.

public static Vector3d ProjectOnPlane(Vector3d point, FixedPlane plane)

Parameters

point Vector3d

The point to project.

plane FixedPlane

The plane onto which the point is projected.

Returns

Vector3d

The projected point.

ProjectOnPlane(Vector3d, Vector3d)

Projects a vector onto a plane defined by a normal orthogonal to the plane.

public static Vector3d ProjectOnPlane(Vector3d vector, Vector3d planeNormal)

Parameters

vector Vector3d
planeNormal Vector3d

Returns

Vector3d

Reflect(Vector3d, Vector3d)

Reflects a vector off the plane defined by a normal. The result is a vector that points in the direction a perfectly reflected ray would go, based on the incoming vector and the normal of the plane it reflects off.

public static Vector3d Reflect(Vector3d vector, Vector3d normal)

Parameters

vector Vector3d

The vector to reflect.

normal Vector3d

The normal of the plane to reflect off.

Returns

Vector3d

The reflected vector.

Rotate(Vector3d, Vector3d, FixedQuaternion)

Rotates the vector around a given position using a specified quaternion rotation.

public static Vector3d Rotate(Vector3d source, Vector3d position, FixedQuaternion rotation)

Parameters

source Vector3d

The vector to rotate.

position Vector3d

The position around which the vector is rotated.

rotation FixedQuaternion

The quaternion representing the rotation.

Returns

Vector3d

The rotated vector.

ScalarTripleProductSign(Vector3d, Vector3d, Vector3d)

Returns the exact sign of the scalar triple product without fixed-point saturation.

public static int ScalarTripleProductSign(Vector3d first, Vector3d second, Vector3d third)

Parameters

first Vector3d
second Vector3d
third Vector3d

Returns

int

1 for a positive product, -1 for a negative product, or 0 when the vectors are exactly coplanar.

Set(Fixed64, Fixed64, Fixed64)

Set x, y and z components of an existing Vector3.

public Vector3d Set(Fixed64 newX, Fixed64 newY, Fixed64 newZ)

Parameters

newX Fixed64
newY Fixed64
newZ Fixed64

Returns

Vector3d

Sign(Vector3d)

Returns a new Vector3d where each component is the sign of the corresponding input component.

public static Vector3d Sign(Vector3d value)

Parameters

value Vector3d

The input vector.

Returns

Vector3d

A vector where each component is -1, 0, or 1 based on the sign of the input.

Slerp(Vector3d, Vector3d, Fixed64)

Spherically interpolates between two vectors, moving along the shortest arc on a unit sphere.

public static Vector3d Slerp(Vector3d start, Vector3d end, Fixed64 percent)

Parameters

start Vector3d

The starting vector.

end Vector3d

The ending vector.

percent Fixed64

A value between 0 and 1 that represents the interpolation amount. 0 returns the start vector, and 1 returns the end vector.

Returns

Vector3d

The interpolated vector between the two input vectors.

Remarks

Slerp is used to interpolate between two unit vectors on a sphere, providing smooth rotation. It can be more computationally expensive than linear interpolation (Lerp) but results in smoother, arc-like motion.

SmoothStep(Vector3d, Vector3d, Fixed64)

Calculates a position between two points using a cubic Hermite interpolation, which is similar to HermiteSpline but assumes zero tangents at the endpoints for a smoother curve.

public static Vector3d SmoothStep(Vector3d value1, Vector3d value2, Fixed64 amount)

Parameters

value1 Vector3d

The first point.

value2 Vector3d

The second point.

amount Fixed64

The interpolation factor.

Returns

Vector3d

The interpolated position.

SnapSmallComponentsToZero(Fixed64?)

Returns a new vector with components whose absolute values are less than the specified threshold set to zero.

public Vector3d SnapSmallComponentsToZero(Fixed64? threshold = null)

Parameters

threshold Fixed64?

The minimum absolute value a component must have to be retained. If null, a default epsilon value is used.

Returns

Vector3d

A new Vector3d instance with small components snapped to zero based on the specified threshold.

Remarks

This method is useful for eliminating insignificant floating-point errors by zeroing out very small vector components. The default threshold is suitable for most cases where near-zero values are considered noise.

SpeedLerp(Vector3d, Vector3d, Fixed64, Fixed64)

Moves from a to b at some speed dependent of a delta time with out passing b.

public static Vector3d SpeedLerp(Vector3d a, Vector3d b, Fixed64 speed, Fixed64 dt)

Parameters

a Vector3d
b Vector3d
speed Fixed64
dt Fixed64

Returns

Vector3d

Subtract(Vector3d, Vector3d)

Subtracts two vectors component-wise.

public static Vector3d Subtract(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d
v2 Vector3d

Returns

Vector3d

SubtractInPlace(Fixed64)

Subtracts the specified value from all components of the vector in place and returns the modified vector.

public Vector3d SubtractInPlace(Fixed64 amount)

Parameters

amount Fixed64

The amount to subtract from each component.

Returns

Vector3d

SubtractInPlace(Fixed64, Fixed64, Fixed64)

Subtracts the specified values from the components of the vector in place and returns the modified vector.

public Vector3d SubtractInPlace(Fixed64 xAmount, Fixed64 yAmount, Fixed64 zAmount)

Parameters

xAmount Fixed64

The amount to subtract from the x component.

yAmount Fixed64

The amount to subtract from the y component.

zAmount Fixed64

The amount to subtract from the z component.

Returns

Vector3d

SubtractInPlace(Vector3d)

Subtracts the specified vector from the components of the vector in place and returns the modified vector.

public Vector3d SubtractInPlace(Vector3d other)

Parameters

other Vector3d

Returns

Vector3d

ToDegrees(Vector3d)

Converts each component of the vector from radians to degrees.

public static Vector3d ToDegrees(Vector3d radians)

Parameters

radians Vector3d

The vector with components in radians.

Returns

Vector3d

A new vector with components converted to degrees.

ToRadians(Vector3d)

Converts each component of the vector from degrees to radians.

public static Vector3d ToRadians(Vector3d degrees)

Parameters

degrees Vector3d

The vector with components in degrees.

Returns

Vector3d

A new vector with components converted to radians.

ToString()

Returns a string that represents the current object in the format "(x, y, z)".

public override string ToString()

Returns

string

A string representation of the object, displaying the x, y, and z values in a formatted tuple.

ToString(string?, IFormatProvider?)

Returns a string that represents the current object in the format "(x, y, z)".

public string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string
formatProvider IFormatProvider

Returns

string

ToVector2d()

Converts this Vector3d to a Vector2d, dropping the Y component (height) of this vector in the resulting vector.

public Vector2d ToVector2d()

Returns

Vector2d

A new Vector2d where (X, Z) from this Vector3d become (X, Y) in the resulting vector.

ToVector4d(Fixed64)

Converts this Vector3d to a Vector4d with an explicit W component.

public Vector4d ToVector4d(Fixed64 w)

Parameters

w Fixed64

Returns

Vector4d

Transform(Vector3d, Fixed4x4)

Transforms a vector by the given 4x4 matrix, applying rotation, scaling, and translation as defined by the matrix.

public static Vector3d Transform(Vector3d vector, Fixed4x4 matrix)

Parameters

vector Vector3d

The vector to transform.

matrix Fixed4x4

The transformation matrix.

Returns

Vector3d

The transformed vector.

Remarks

TryAdd(Vector3d, Vector3d, out Vector3d)

Attempts to add two vectors without component saturation.

public static bool TryAdd(Vector3d left, Vector3d right, out Vector3d result)

Parameters

left Vector3d

The left operand.

right Vector3d

The right operand.

result Vector3d

The exact component-wise sum when every component is representable; otherwise, default.

Returns

bool

true when every exact component is representable; otherwise, false.

TryAddSubtract(Vector3d, Vector3d, Vector3d, out Vector3d)

Attempts to add two vectors and subtract a third component-wise without intermediate saturation.

public static bool TryAddSubtract(Vector3d firstAddend, Vector3d secondAddend, Vector3d subtrahend, out Vector3d result)

Parameters

firstAddend Vector3d

The first addend.

secondAddend Vector3d

The second addend.

subtrahend Vector3d

The vector to subtract from the exact component-wise sum.

result Vector3d

The exact component-wise result when every component is representable; otherwise, default.

Returns

bool

true when every exact component is representable; otherwise, false.

TryComposeScaledLocalPoints(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d, FixedQuaternion, out Vector3d)

Attempts to compose two component-scaled offsets in a shared frame and one rotated inner-frame displacement with one final round-half-to-even conversion per component.

public static bool TryComposeScaledLocalPoints(Vector3d outerLocalPoint, Vector3d outerScale, Vector3d innerFrameOffset, Vector3d innerFrameScale, Vector3d innerLocalDisplacement, FixedQuaternion innerRotation, out Vector3d result)

Parameters

outerLocalPoint Vector3d
outerScale Vector3d
innerFrameOffset Vector3d
innerFrameScale Vector3d
innerLocalDisplacement Vector3d
innerRotation FixedQuaternion
result Vector3d

Returns

bool

Remarks

Computes outerScale * outerLocalPoint

  • innerFrameScale * innerFrameOffset
  • Rotate(innerLocalDisplacement) without narrowing either scaled offset or the rotated displacement independently.

TryCross(Vector3d, Vector3d, out Vector3d)

Attempts to calculate the cross product with one final round-half-to-even conversion per component.

public static bool TryCross(Vector3d left, Vector3d right, out Vector3d result)

Parameters

left Vector3d
right Vector3d
result Vector3d

Returns

bool

TryDot(Vector3d, Vector3d, out Fixed64)

Attempts to calculate the dot product with one final round-half-to-even conversion.

public static bool TryDot(Vector3d left, Vector3d right, out Fixed64 result)

Parameters

left Vector3d
right Vector3d
result Fixed64

Returns

bool

TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)

Formats this vector into the provided destination buffer.

public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)

Parameters

destination Span<char>
charsWritten int
format ReadOnlySpan<char>
provider IFormatProvider

Returns

bool

TryGetDistance(Vector3d, Vector3d, out Fixed64)

Attempts to return the distance between two endpoints without saturating any component difference.

public static bool TryGetDistance(Vector3d start, Vector3d end, out Fixed64 distance)

Parameters

start Vector3d

The first endpoint.

end Vector3d

The second endpoint.

distance Fixed64

The rounded distance, or MaxValue when it is not representable.

Returns

bool

true when the distance fits in Fixed64; otherwise, false.

TryGetMagnitude(Vector3d, out Fixed64)

Attempts to return the magnitude of the given vector without saturating the result.

public static bool TryGetMagnitude(Vector3d vector, out Fixed64 magnitude)

Parameters

vector Vector3d

The vector to measure.

magnitude Fixed64

The magnitude, or MaxValue when it is not representable.

Returns

bool

true when the magnitude fits in Fixed64; otherwise, false.

TryGetMagnitudeCeiling(out Fixed64)

Attempts to return this vector's magnitude rounded outward to the smallest containing Q32.32 value.

public readonly bool TryGetMagnitudeCeiling(out Fixed64 magnitude)

Parameters

magnitude Fixed64

Returns

bool

false only when the final ceiling exceeds the positive Fixed64 domain.

TryGetWeightedAverage(ReadOnlySpan<Vector3d>, ReadOnlySpan<Fixed64>, out Vector3d)

Attempts to calculate the exact non-negative weighted average with one final round-half-to-even conversion per component.

public static bool TryGetWeightedAverage(ReadOnlySpan<Vector3d> values, ReadOnlySpan<Fixed64> weights, out Vector3d average)

Parameters

values ReadOnlySpan<Vector3d>
weights ReadOnlySpan<Fixed64>
average Vector3d

Returns

bool

Remarks

Zero-weight values are ignored. The operation returns false only when the total weight is zero.

TryLinearCombination(Vector3d, Fixed64, Vector3d, Fixed64, Vector3d, Fixed64, out Vector3d)

Attempts to combine three scaled vectors with one final round-half-to-even conversion per component.

public static bool TryLinearCombination(Vector3d first, Fixed64 firstScale, Vector3d second, Fixed64 secondScale, Vector3d third, Fixed64 thirdScale, out Vector3d result)

Parameters

first Vector3d
firstScale Fixed64
second Vector3d
secondScale Fixed64
third Vector3d
thirdScale Fixed64
result Vector3d

Returns

bool

TryLinearCombination(Vector3d, Fixed64, Vector3d, Fixed64, out Vector3d)

Attempts to combine two scaled vectors with one final round-half-to-even conversion per component.

public static bool TryLinearCombination(Vector3d first, Fixed64 firstScale, Vector3d second, Fixed64 secondScale, out Vector3d result)

Parameters

first Vector3d
firstScale Fixed64
second Vector3d
secondScale Fixed64
result Vector3d

Returns

bool

TryScaledLinearCombination(Vector3d, Fixed64, Vector3d, Fixed64, Vector3d, Fixed64, Fixed64, out Vector3d)

Attempts to combine three scaled vectors, apply a final scale, and round each completed component once.

public static bool TryScaledLinearCombination(Vector3d first, Fixed64 firstScale, Vector3d second, Fixed64 secondScale, Vector3d third, Fixed64 thirdScale, Fixed64 resultScale, out Vector3d result)

Parameters

first Vector3d
firstScale Fixed64
second Vector3d
secondScale Fixed64
third Vector3d
thirdScale Fixed64
resultScale Fixed64
result Vector3d

Returns

bool

TrySubtract(Vector3d, Vector3d, out Vector3d)

Attempts to subtract two vectors without component saturation.

public static bool TrySubtract(Vector3d left, Vector3d right, out Vector3d result)

Parameters

left Vector3d

The left operand.

right Vector3d

The right operand.

result Vector3d

The exact component-wise difference when every component is representable; otherwise, default.

Returns

bool

true when every exact component is representable; otherwise, false.

TrySubtractSums(Vector3d, Vector3d, Vector3d, Vector3d, out Vector3d)

Attempts to compute (firstLeft + firstRight) - (secondLeft + secondRight) component-wise without intermediate saturation.

public static bool TrySubtractSums(Vector3d firstLeft, Vector3d firstRight, Vector3d secondLeft, Vector3d secondRight, out Vector3d result)

Parameters

firstLeft Vector3d
firstRight Vector3d
secondLeft Vector3d
secondRight Vector3d
result Vector3d

Returns

bool

UnclampedLerp(Vector3d, Vector3d, Fixed64)

Linearly interpolates between two vectors without clamping the interpolation factor between 0 and 1.

public static Vector3d UnclampedLerp(Vector3d a, Vector3d b, Fixed64 t)

Parameters

a Vector3d

The start vector.

b Vector3d

The end vector.

t Fixed64

The interpolation factor. Values outside the range [0, 1] will cause the interpolation to go beyond the start or end points.

Returns

Vector3d

The interpolated vector.

Remarks

Unlike traditional Lerp, this function allows interpolation factors greater than 1 or less than 0, which means the resulting vector can extend beyond the endpoints.

Operators

operator +(Fixed64, Vector3d)

Adds a scalar value to each component of the specified vector and returns the resulting vector.

public static Vector3d operator +(Fixed64 mag, Vector3d v1)

Parameters

mag Fixed64

The scalar value to add to each component of the vector.

v1 Vector3d

The vector to which the scalar value will be added.

Returns

Vector3d

A new Vector3d whose components are the sum of the corresponding components of the input vector and the scalar value.

operator +(Vector3d, Fixed64)

Adds a scalar value to each component of the specified vector and returns the resulting vector.

public static Vector3d operator +(Vector3d v1, Fixed64 mag)

Parameters

v1 Vector3d

The vector to which the scalar value will be added.

mag Fixed64

The scalar value to add to each component of the vector.

Returns

Vector3d

A new Vector3d whose components are the sum of the corresponding components of the input vector and the scalar value.

operator +(Vector3d, Vector3d)

Adds two Vector3d instances component-wise.

public static Vector3d operator +(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d

The first vector to add.

v2 Vector3d

The second vector to add.

Returns

Vector3d

A new Vector3d whose components are the sum of the corresponding components of v1 and v2.

operator +(Vector3d, (int x, int y, int z))

Adds a Vector3d instance to a tuple representing x, y, and z components and returns the resulting vector.

public static Vector3d operator +(Vector3d v1, (int x, int y, int z) v2)

Parameters

v1 Vector3d

The first vector to add.

v2 (int x, int y, int z)

A tuple containing the x, y, and z values to add to the vector.

Returns

Vector3d

A new Vector3d that is the sum of the original vector and the specified tuple components.

operator +((int x, int y, int z), Vector3d)

Adds a 3-tuple of integers to a Vector3d instance, returning the resulting vector.

public static Vector3d operator +((int x, int y, int z) v2, Vector3d v1)

Parameters

v2 (int x, int y, int z)

A tuple containing the X, Y, and Z components to add to the vector.

v1 Vector3d

The Vector3d instance to which the tuple components are added.

Returns

Vector3d

A new Vector3d representing the sum of the original vector and the specified tuple components.

operator /(Vector3d, Fixed64)

Divides each component of a vector by a specified scalar value.

public static Vector3d operator /(Vector3d v1, Fixed64 div)

Parameters

v1 Vector3d

The vector whose components are to be divided.

div Fixed64

The scalar value by which to divide each component of the vector.

Returns

Vector3d

A new vector whose components are the result of dividing the corresponding components of the input vector by the specified scalar. Returns a zero vector if the scalar is zero.

Remarks

If the scalar value is zero, the result is a zero vector to avoid division by zero.

operator /(Vector3d, Vector3d)

Divides each component of one vector by the corresponding component of another vector.

public static Vector3d operator /(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d

The vector whose components are to be divided (the dividend).

v2 Vector3d

The vector whose components are used as divisors.

Returns

Vector3d

A new Vector3d whose components are the result of dividing the corresponding components of v1 by v2. If a component of v2 is zero, the corresponding result component is set to zero.

Remarks

Division by zero for any component in v2 results in a zero value for the corresponding component in the result vector.

operator /(Vector3d, int)

Divides each component of a vector by the specified integer value.

public static Vector3d operator /(Vector3d v1, int div)

Parameters

v1 Vector3d

The vector whose components are to be divided.

div int

The integer divisor. If zero, the result is a zero vector.

Returns

Vector3d

A new vector whose components are the result of dividing each component of the input vector by the specified divisor. Returns a zero vector if the divisor is zero.

operator ==(Vector3d, Vector3d)

Determines whether two Vector3d instances are equal.

public static bool operator ==(Vector3d left, Vector3d right)

Parameters

left Vector3d
right Vector3d

Returns

bool

operator >(Vector3d, Vector3d)

Determines whether each component of the left vector is greater than the corresponding component of the right vector.

public static bool operator >(Vector3d left, Vector3d right)

Parameters

left Vector3d

The first vector to compare.

right Vector3d

The second vector to compare.

Returns

bool

true if the x, y, and z components of left are all greater than those of right; otherwise, false.

operator >=(Vector3d, Vector3d)

Determines whether each component of the left Vector3d is greater than or equal to the corresponding component of the right Vector3d.

public static bool operator >=(Vector3d left, Vector3d right)

Parameters

left Vector3d

The first Vector3d to compare.

right Vector3d

The second Vector3d to compare.

Returns

bool

true if the x, y, and z components of left are each greater than or equal to those of right; otherwise, false.

operator !=(Vector3d, Vector3d)

Determines whether two Vector3d instances are not equal.

public static bool operator !=(Vector3d left, Vector3d right)

Parameters

left Vector3d
right Vector3d

Returns

bool

operator <(Vector3d, Vector3d)

Determines whether each component of the first Vector3d is less than the corresponding component of the second Vector3d.

public static bool operator <(Vector3d left, Vector3d right)

Parameters

left Vector3d

The first Vector3d to compare.

right Vector3d

The second Vector3d to compare.

Returns

bool

true if the x, y, and z components of left are all less than those of right; otherwise, false.

Remarks

This operator performs a component-wise comparison. All components of left must be less than the corresponding components of right for the result to be true.

operator <=(Vector3d, Vector3d)

Determines whether each component of the first Vector3d is less than or equal to the corresponding component of the second Vector3d.

public static bool operator <=(Vector3d left, Vector3d right)

Parameters

left Vector3d

The first Vector3d to compare.

right Vector3d

The second Vector3d to compare.

Returns

bool

true if the x, y, and z components of left are each less than or equal to the corresponding components of right; otherwise, false.

operator *(Fixed3x3, Vector3d)

Multiplies a 3x3 matrix by a 3-dimensional vector and returns the resulting vector.

public static Vector3d operator *(Fixed3x3 matrix, Vector3d vector)

Parameters

matrix Fixed3x3

The 3x3 matrix to multiply.

vector Vector3d

The 3-dimensional vector to be transformed by the matrix.

Returns

Vector3d

A new Vector3d that is the result of multiplying the specified matrix by the specified vector.

Remarks

This operation applies the linear transformation represented by the matrix to the vector. The multiplication is performed using standard matrix-vector multiplication rules.

operator *(Fixed4x4, Vector3d)

Transforms the specified 3D vector by the given 4x4 matrix using homogeneous coordinates.

public static Vector3d operator *(Fixed4x4 matrix, Vector3d point)

Parameters

matrix Fixed4x4

The 4x4 matrix to apply to the vector. Must represent a valid transformation.

point Vector3d

The 3D vector to be transformed.

Returns

Vector3d

A new Vector3d representing the transformed vector after applying the matrix.

Remarks

If the matrix is affine, the transformation is performed without perspective division. For non-affine matrices, the result is divided by the computed w component to account for perspective transformations. If the computed w component is zero, it is treated as one to avoid division by zero.

operator *(Fixed64, Vector3d)

Multiplies the specified vector by a scalar value.

public static Vector3d operator *(Fixed64 mag, Vector3d v1)

Parameters

mag Fixed64

The scalar value by which to multiply each component of the vector.

v1 Vector3d

The vector to be scaled.

Returns

Vector3d

A new vector whose components are the products of the corresponding components of the input vector and the scalar value.

operator *(FixedQuaternion, Vector3d)

Rotates the specified 3D point by the given quaternion.

public static Vector3d operator *(FixedQuaternion rotation, Vector3d point)

Parameters

rotation FixedQuaternion

The quaternion representing the rotation to apply.

point Vector3d

The 3D point to be rotated.

Returns

Vector3d

A new Vector3d representing the rotated point.

Remarks

This operator applies the rotation to the point as if performing a geometric transformation in 3D space.

operator *(Vector3d, Fixed3x3)

Multiplies a 3x3 matrix by a 3-dimensional vector and returns the resulting vector.

public static Vector3d operator *(Vector3d vector, Fixed3x3 matrix)

Parameters

vector Vector3d

The 3-dimensional vector to be transformed by the matrix.

matrix Fixed3x3

The 3x3 matrix to multiply.

Returns

Vector3d

A new Vector3d that is the result of multiplying the specified matrix by the specified vector.

Remarks

This operation applies the linear transformation represented by the matrix to the vector. The multiplication is performed using standard matrix-vector multiplication rules.

operator *(Vector3d, Fixed4x4)

Transforms the specified 3D vector by the given 4x4 matrix using homogeneous coordinates.

public static Vector3d operator *(Vector3d vector, Fixed4x4 matrix)

Parameters

vector Vector3d
matrix Fixed4x4

The 4x4 matrix to apply to the vector. Must represent a valid transformation.

Returns

Vector3d

A new Vector3d representing the transformed vector after applying the matrix.

Remarks

If the matrix is affine, the transformation is performed without perspective division. For non-affine matrices, the result is divided by the computed w component to account for perspective transformations. If the computed w component is zero, it is treated as one to avoid division by zero.

operator *(Vector3d, Fixed64)

Multiplies the specified vector by a scalar value.

public static Vector3d operator *(Vector3d v1, Fixed64 mag)

Parameters

v1 Vector3d

The vector to be scaled.

mag Fixed64

The scalar value by which to multiply each component of the vector.

Returns

Vector3d

A new vector whose components are the products of the corresponding components of the input vector and the scalar value.

operator *(Vector3d, FixedQuaternion)

Rotates the specified 3D point by the given quaternion.

public static Vector3d operator *(Vector3d point, FixedQuaternion rotation)

Parameters

point Vector3d

The 3D point to be rotated.

rotation FixedQuaternion

The quaternion representing the rotation to apply.

Returns

Vector3d

A new Vector3d representing the rotated point.

Remarks

This operator applies the rotation to the point as if performing a geometric transformation in 3D space.

operator *(Vector3d, Vector3d)

Multiplies the corresponding components of two vectors and returns the resulting vector.

public static Vector3d operator *(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d

The first vector to multiply.

v2 Vector3d

The second vector to multiply.

Returns

Vector3d

A new Vector3d whose components are the products of the corresponding components of the input vectors.

Remarks

This operation performs component-wise multiplication, not a dot or cross product. Each component of the result is calculated as the product of the corresponding components of the input vectors.

operator *(Vector3d, int)

Multiplies each component of the specified vector by the given scalar value.

public static Vector3d operator *(Vector3d v1, int mag)

Parameters

v1 Vector3d

The vector whose components are to be multiplied.

mag int

The scalar value by which to multiply each component of the vector.

Returns

Vector3d

A new Vector3d whose components are the products of the corresponding components of the input vector and the scalar value.

operator *(int, Vector3d)

Multiplies each component of the specified vector by the given scalar value.

public static Vector3d operator *(int mag, Vector3d v1)

Parameters

mag int

The scalar value by which to multiply each component of the vector.

v1 Vector3d

The vector whose components are to be multiplied.

Returns

Vector3d

A new Vector3d whose components are the products of the corresponding components of the input vector and the scalar value.

operator -(Vector3d, Fixed64)

Subtracts the specified scalar value from each component of the given vector.

public static Vector3d operator -(Vector3d v1, Fixed64 mag)

Parameters

v1 Vector3d

The vector from which to subtract the scalar value from each component.

mag Fixed64

The scalar value to subtract from each component of the vector.

Returns

Vector3d

A new Vector3d whose components are the result of subtracting the scalar value from the corresponding components of the input vector.

operator -(Vector3d, Vector3d)

Subtracts the components of one Vector3d from another and returns the resulting vector.

public static Vector3d operator -(Vector3d v1, Vector3d v2)

Parameters

v1 Vector3d

The vector to subtract from.

v2 Vector3d

The vector to subtract.

Returns

Vector3d

A Vector3d whose components are the result of subtracting the corresponding components of v2 from v1.

operator -(Vector3d, (int x, int y, int z))

Subtracts the specified tuple from the given vector and returns the resulting vector.

public static Vector3d operator -(Vector3d v1, (int x, int y, int z) v2)

Parameters

v1 Vector3d

The vector from which to subtract the tuple values.

v2 (int x, int y, int z)

A tuple containing the x, y, and z values to subtract from the vector.

Returns

Vector3d

A new Vector3d representing the result of subtracting the tuple values from the original vector.

operator -((int x, int y, int z), Vector3d)

Subtracts the components of a specified Vector3d from the corresponding components of a 3-tuple of integers and returns the resulting Vector3d.

public static Vector3d operator -((int x, int y, int z) v1, Vector3d v2)

Parameters

v1 (int x, int y, int z)

A tuple containing the x, y, and z components to subtract from.

v2 Vector3d

The Vector3d whose components are subtracted from the corresponding components of the tuple.

Returns

Vector3d

A Vector3d whose components are the result of subtracting the components of v2 from the corresponding components of v1.

Remarks

This operator enables direct subtraction between a tuple of three integers and a Vector3d, returning a new Vector3d instance.

operator -(Vector3d)

Negates each component of the specified vector.

public static Vector3d operator -(Vector3d v1)

Parameters

v1 Vector3d

The vector whose components are to be negated.

Returns

Vector3d

A new vector whose components are the negated values of the input vector.