Struct dvec3d_t
Dual vec3d_t with p(vec3d_t) and n(vec3d_t): a sequential-layout
value type of two vec3d_t fields, the 48-byte mirror of the C++ geom::dvec3<double>.
It has no in-place mutating method: write Point/Normal (or a component
through the indexer) on a variable, field or array element, never on a property receiver, or build
a new value with the Get* members. A default dvec3d_t is Zero.
public struct dvec3d_t : IEquatable<dvec3d_t>, IWriteBin, IEqualityOperators<dvec3d_t, dvec3d_t, bool>, IAdditionOperators<dvec3d_t, dvec3d_t, dvec3d_t>, ISubtractionOperators<dvec3d_t, dvec3d_t, dvec3d_t>, IMultiplyOperators<dvec3d_t, double, dvec3d_t>, IMultiplyOperators<dvec3d_t, Mat4d, dvec3d_t>, IDivisionOperators<dvec3d_t, double, dvec3d_t>, IVec<double>, IFormattable
- Implements
- Inherited Members
- Extension Methods
Constructors
dvec3d_t(Mat4d)
Ctor.
set mat[12] to Point.x;
set mat[13] to Point.y;
set mat[14] to Point.z;
set mat[8] to Normal.x;
set mat[9] to Normal.y;
set mat[10] to Normal.z;
public dvec3d_t(Mat4d mat)
Parameters
matMat4dmatrix
dvec3d_t(dvec3d_t)
Copy ctor. Assignment copies a dvec3d_t just as well; this overload stays for the call sites that spell the copy out.
public dvec3d_t(dvec3d_t src)
Parameters
srcdvec3d_tThe source dvec3d_t to copy from.
dvec3d_t(vec3d_t, vec3d_t)
Ctor.
public dvec3d_t(vec3d_t p, vec3d_t n)
Parameters
dvec3d_t(IEnumerable<double>)
Initializes a new instance of the dvec3d_t struct from an enumerable collection of doubles.
public dvec3d_t(IEnumerable<double> src)
Parameters
srcIEnumerable<double>The source collection containing at least 6 double values. The first 3 values initialize the Point, and the last 3 values initialize the Normal.
dvec3d_t(double, double, double, double, double, double)
Ctor.
public dvec3d_t(double px, double py, double pz, double nx, double ny, double nz)
Parameters
dvec3d_t(double[])
Ctor.
public dvec3d_t(double[] src)
Parameters
srcdouble[]Array elements 0,1,2 initialize Point x,y,z; Array elements 3,4,5 initialize Normal x,y,z
dvec3d_t(Func<int, double>)
Initializes a new instance of the dvec3d_t struct using a function that maps indices to values.
public dvec3d_t(Func<int, double> dirToValueFunc)
Parameters
dirToValueFuncFunc<int, double>A function that takes an index (0-5) and returns the corresponding coordinate value. Indices 0-2 are for Point coordinates, and 3-5 are for Normal coordinates.
dvec3d_t(BinaryReader)
Initializes a new instance of the dvec3d_t struct from binary data. A cleared presence bit leaves that member at NaN, the value-typed “absent”.
public dvec3d_t(BinaryReader reader)
Parameters
readerBinaryReaderThe binary reader to read the data from.
dvec3d_t(string)
Ctor. The reading format is ((x,y,z),(x,y,z)), the first xyz is for Point; the second xyz is for Normal.
public dvec3d_t(string str)
Parameters
strstringstring
- See Also
Fields
Normal
Normal.
public vec3d_t Normal
Field Value
Point
Point.
public vec3d_t Point
Field Value
Properties
ElementNum
Element number: 6 for (Point(x,y,z),Normal(x,y,z)).
public static int ElementNum { get; }
Property Value
IsAllNaN
Gets a value indicating whether all components of both Point and Normal are NaN.
public readonly bool IsAllNaN { get; }
Property Value
IsFinite
Gets a value indicating whether all components of both Point and Normal are finite.
public readonly bool IsFinite { get; }
Property Value
this[int]
Component access: 0-2 are Point x,y,z and 3-5 are Normal x,y,z. The setter writes the field directly, so it works on a variable, field or array element and is a compile error (CS1612) on a property receiver.
public double this[int index] { readonly get; set; }
Parameters
indexint
Property Value
NaN
Gets a dvec3d_t with all components set to NaN.
public static dvec3d_t NaN { get; }
Property Value
NativeByteSize
Byte size of the struct as core.dll sees it: sizeof(dvec3d_t), two vec3d_t.
public static int NativeByteSize { get; }
Property Value
Rank
Dimension (i.e. Size) of the Vector.
public readonly int Rank { get; }
Property Value
Zero
Gets a dvec3d_t with all components set to zero.
public static dvec3d_t Zero { get; }
Property Value
Methods
At(int)
Gets the component at the specified index.
public readonly double At(int dir)
Parameters
dirintThe index of the component (0-5). Indices 0-2 read Point x,y,z and 3-5 read Normal x,y,z; any other index reads Point.x. Writing goes through the indexer.
Returns
- double
The component value.
Enumerate()
public readonly IEnumerable<double> Enumerate()
Returns
Equals(dvec3d_t)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(dvec3d_t other)
Parameters
otherdvec3d_tAn 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.
GenNaN()
Creates a new dvec3d_t with all components set to NaN.
public static dvec3d_t GenNaN()
Returns
- dvec3d_t
A new dvec3d_t with all components set to NaN.
GenZero()
Creates a new dvec3d_t with all components set to zero.
public static dvec3d_t GenZero()
Returns
- dvec3d_t
A new dvec3d_t with all components set to zero.
GetEachValueAbs()
A dual vector with each component of both Point and Normal at its absolute value.
public readonly dvec3d_t GetEachValueAbs()
Returns
- dvec3d_t
the absolute dual vector
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.
Interpolate(dvec3d_t, dvec3d_t, double)
Interpolates between two dvec3d_t instances.
public static dvec3d_t Interpolate(dvec3d_t a, dvec3d_t b, double ratio)
Parameters
advec3d_tThe first dvec3d_t.
bdvec3d_tThe second dvec3d_t.
ratiodoubleThe interpolation ratio (0.0 to 1.0).
Returns
- dvec3d_t
A new dvec3d_t interpolated between a and b.
ReadBin(BinaryReader)
Reads a dual vector written by WriteBin(BinaryWriter).
public static dvec3d_t ReadBin(BinaryReader reader)
Parameters
readerBinaryReaderThe binary reader to read the data from.
Returns
- dvec3d_t
the dual vector
ToString()
Returns the fully qualified type name of this instance.
public override readonly string ToString()
Returns
- string
The fully qualified type name.
ToString(string)
Returns a string representation of this dvec3d_t using the specified format for component values.
public readonly string ToString(string format)
Parameters
formatstringThe format string to use for component values.
Returns
- string
A string representation of this dvec3d_t.
ToString(string, IFormatProvider)
Returns a string representation of the dual vector formatted according to the specified format.
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
formatstringThe format to use for each component
formatProviderIFormatProviderThe format provider to use
Returns
- string
A formatted string representation of the dual vector
WriteBin(BinaryWriter)
Writes the object's data to a binary stream.
public readonly void WriteBin(BinaryWriter writer)
Parameters
writerBinaryWriterThe binary writer to write to
Remarks
The presence mask stays in the stream for the old readers and always claims both members: a value-typed member has no absent state, so an unset normal is NaN and is written as such.
Operators
operator +(dvec3d_t, dvec3d_t)
Adds two values together to compute their sum.
public static dvec3d_t operator +(dvec3d_t a, dvec3d_t b)
Parameters
Returns
- dvec3d_t
The sum of
leftandright.
operator /(dvec3d_t, double)
Divides one value by another to compute their quotient.
public static dvec3d_t operator /(dvec3d_t src, double s)
Parameters
Returns
- dvec3d_t
The quotient of
leftdivided byright.
operator ==(dvec3d_t, dvec3d_t)
Compares two values to determine equality.
public static bool operator ==(dvec3d_t left, dvec3d_t right)
Parameters
Returns
operator !=(dvec3d_t, dvec3d_t)
Compares two values to determine inequality.
public static bool operator !=(dvec3d_t left, dvec3d_t right)
Parameters
Returns
operator *(dvec3d_t, Mat4d)
Multiplies two values together to compute their product.
public static dvec3d_t operator *(dvec3d_t a, Mat4d b)
Parameters
Returns
- dvec3d_t
The product of
leftmultiplied byright.
operator *(dvec3d_t, double)
Multiplies two values together to compute their product.
public static dvec3d_t operator *(dvec3d_t src, double s)
Parameters
Returns
- dvec3d_t
The product of
leftmultiplied byright.
operator -(dvec3d_t, dvec3d_t)
Subtracts two values to compute their difference.
public static dvec3d_t operator -(dvec3d_t a, dvec3d_t b)
Parameters
Returns
- dvec3d_t
The value of
rightsubtracted fromleft.
operator -(dvec3d_t)
Create a negate dvec3d_t.
public static dvec3d_t operator -(dvec3d_t src)
Parameters
srcdvec3d_tsrc