Table of Contents

Struct dvec3d_t

Namespace
Hi.Geom
Assembly
HiGeom.dll

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

mat Mat4d

matrix

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

src dvec3d_t

The source dvec3d_t to copy from.

dvec3d_t(vec3d_t, vec3d_t)

Ctor.

public dvec3d_t(vec3d_t p, vec3d_t n)

Parameters

p vec3d_t

Point

n vec3d_t

Normal

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

src IEnumerable<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

px double

Point.x

py double

Point.y

pz double

Point.z

nx double

Normal.x

ny double

Normal.y

nz double

Normal.z

dvec3d_t(double[])

Ctor.

public dvec3d_t(double[] src)

Parameters

src double[]

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

dirToValueFunc Func<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

reader BinaryReader

The 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

str string

string

See Also

Fields

Normal

Normal.

public vec3d_t Normal

Field Value

vec3d_t

Point

Point.

public vec3d_t Point

Field Value

vec3d_t

Properties

ElementNum

Element number: 6 for (Point(x,y,z),Normal(x,y,z)).

public static int ElementNum { get; }

Property Value

int

IsAllNaN

Gets a value indicating whether all components of both Point and Normal are NaN.

public readonly bool IsAllNaN { get; }

Property Value

bool

IsFinite

Gets a value indicating whether all components of both Point and Normal are finite.

public readonly bool IsFinite { get; }

Property Value

bool

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

index int

Property Value

double

NaN

Gets a dvec3d_t with all components set to NaN.

public static dvec3d_t NaN { get; }

Property Value

dvec3d_t

NativeByteSize

Byte size of the struct as core.dll sees it: sizeof(dvec3d_t), two vec3d_t.

public static int NativeByteSize { get; }

Property Value

int

Rank

Dimension (i.e. Size) of the Vector.

public readonly int Rank { get; }

Property Value

int

Zero

Gets a dvec3d_t with all components set to zero.

public static dvec3d_t Zero { get; }

Property Value

dvec3d_t

Methods

At(int)

Gets the component at the specified index.

public readonly double At(int dir)

Parameters

dir int

The 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()

For each. Point first. Normal second.

public readonly IEnumerable<double> Enumerate()

Returns

IEnumerable<double>

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

other dvec3d_t

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 readonly 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.

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

a dvec3d_t

The first dvec3d_t.

b dvec3d_t

The second dvec3d_t.

ratio double

The 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

reader BinaryReader

The 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

format string

The 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

format string

The format to use for each component

formatProvider IFormatProvider

The 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

writer BinaryWriter

The 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

a dvec3d_t
b dvec3d_t

Returns

dvec3d_t

The sum of left and right.

operator /(dvec3d_t, double)

Divides one value by another to compute their quotient.

public static dvec3d_t operator /(dvec3d_t src, double s)

Parameters

src dvec3d_t
s double

Returns

dvec3d_t

The quotient of left divided by right.

operator ==(dvec3d_t, dvec3d_t)

Compares two values to determine equality.

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

Parameters

left dvec3d_t

The value to compare with right.

right dvec3d_t

The value to compare with left.

Returns

bool

true if left is equal to right; otherwise, false.

operator !=(dvec3d_t, dvec3d_t)

Compares two values to determine inequality.

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

Parameters

left dvec3d_t

The value to compare with right.

right dvec3d_t

The value to compare with left.

Returns

bool

true if left is not equal to right; otherwise, false.

operator *(dvec3d_t, Mat4d)

Multiplies two values together to compute their product.

public static dvec3d_t operator *(dvec3d_t a, Mat4d b)

Parameters

a dvec3d_t
b Mat4d

Returns

dvec3d_t

The product of left multiplied by right.

operator *(dvec3d_t, double)

Multiplies two values together to compute their product.

public static dvec3d_t operator *(dvec3d_t src, double s)

Parameters

src dvec3d_t
s double

Returns

dvec3d_t

The product of left multiplied by right.

operator -(dvec3d_t, dvec3d_t)

Subtracts two values to compute their difference.

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

Parameters

a dvec3d_t
b dvec3d_t

Returns

dvec3d_t

The value of right subtracted from left.

operator -(dvec3d_t)

Create a negate dvec3d_t.

public static dvec3d_t operator -(dvec3d_t src)

Parameters

src dvec3d_t

src

Returns

dvec3d_t

negate dvec3d_t