Struct Vec3Hfr
3D vector with Fraction<decimal> elements.
Provides unlimited-precision exact arithmetic for geometric computations.
Corresponds to C++ vec3<wfr_t>.
public struct Vec3Hfr : IEquatable<Vec3Hfr>
- Implements
- Inherited Members
- Extension Methods
Constructors
Vec3Hfr(Fraction<decimal>, Fraction<decimal>, Fraction<decimal>)
Initializes a new Vec3Hfr with three fraction components.
public Vec3Hfr(Fraction<decimal> x, Fraction<decimal> y, Fraction<decimal> z)
Parameters
Vec3Hfr(Vec3d, decimal)
Initializes a new Vec3Hfr from a Vec3d with the specified resolution. Converts each double component to a fraction via Stern-Brocot approximation.
public Vec3Hfr(Vec3d src, decimal resolution)
Parameters
Fields
X
X component.
public Fraction<decimal> X
Field Value
Y
Y component.
public Fraction<decimal> Y
Field Value
Z
Z component.
public Fraction<decimal> Z
Field Value
Methods
Dot(Vec3Hfr)
Dot product.
public readonly Fraction<decimal> Dot(Vec3Hfr b)
Parameters
bVec3Hfr
Returns
Equals(Vec3Hfr)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(Vec3Hfr other)
Parameters
otherVec3HfrAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
Evaluate()
Evaluates all components.
public Vec3Hfr Evaluate()
Returns
GetCross(Vec3Hfr)
Cross product: this x b.
Corresponds to C++ get_cross.
public readonly Vec3Hfr GetCross(Vec3Hfr b)
Parameters
bVec3Hfr
Returns
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Pack()
Packs (reduces) all components to irreducible form.
public Vec3Hfr Pack()
Returns
ToString()
Returns the fully qualified type name of this instance.
public override readonly string ToString()
Returns
- string
The fully qualified type name.
ToVec3d()
Converts to a Vec3d by evaluating each fraction component.
public readonly Vec3d ToVec3d()
Returns
Operators
operator +(Vec3Hfr, Vec3Hfr)
Addition.
public static Vec3Hfr operator +(Vec3Hfr a, Vec3Hfr b)
Parameters
Returns
operator ==(Vec3Hfr, Vec3Hfr)
Equality operator.
public static bool operator ==(Vec3Hfr a, Vec3Hfr b)
Parameters
Returns
operator !=(Vec3Hfr, Vec3Hfr)
Inequality operator.
public static bool operator !=(Vec3Hfr a, Vec3Hfr b)
Parameters
Returns
operator *(Fraction<decimal>, Vec3Hfr)
Scalar multiplication.
public static Vec3Hfr operator *(Fraction<decimal> s, Vec3Hfr a)
Parameters
Returns
operator *(Vec3Hfr, Fraction<decimal>)
Scalar multiplication.
public static Vec3Hfr operator *(Vec3Hfr a, Fraction<decimal> s)
Parameters
Returns
operator -(Vec3Hfr, Vec3Hfr)
Subtraction.
public static Vec3Hfr operator -(Vec3Hfr a, Vec3Hfr b)
Parameters
Returns
operator -(Vec3Hfr)
Negation.
public static Vec3Hfr operator -(Vec3Hfr a)
Parameters
aVec3Hfr