Table of Contents

Class DVec3d

Namespace
Hi.Geom
Assembly
HiGeom.dll

Dual Vec3d with p(Vec3d) and n(Vec3d).

public class DVec3d : IEquatable<DVec3d>, IWriteBin, IEqualityOperators<DVec3d, DVec3d, bool>, IAdditionOperators<DVec3d, DVec3d, DVec3d>, ISubtractionOperators<DVec3d, DVec3d, DVec3d>, IMultiplyOperators<DVec3d, double, DVec3d>, IMultiplyOperators<DVec3d, Mat4d, DVec3d>, IDivisionOperators<DVec3d, double, DVec3d>, IVec<double>, IFormattable
Inheritance
DVec3d
Implements
Inherited Members
Extension Methods

Constructors

DVec3d()

Ctor. The members are initialized to null.

public DVec3d()

DVec3d(DVec3d, bool)

Initializes a new instance of the DVec3d class by copying another DVec3d.

public DVec3d(DVec3d src, bool shareFields = false)

Parameters

src DVec3d

The source DVec3d to copy from.

shareFields bool

If true, references to the source Point and Normal are used; otherwise, new instances are created with copied values.

DVec3d(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(Mat4d mat)

Parameters

mat Mat4d

matrix

DVec3d(UnnullableDVec3d)

Initializes a new instance of the DVec3d class from an UnnullableDVec3d.

public DVec3d(UnnullableDVec3d src)

Parameters

src UnnullableDVec3d

The source UnnullableDVec3d to copy from.

DVec3d(Vec3d, Vec3d)

Ctor.

public DVec3d(Vec3d p, Vec3d n)

Parameters

p Vec3d

Point

n Vec3d

Normal

DVec3d(IEnumerable<double>)

Initializes a new instance of the DVec3d class from an enumerable collection of doubles.

public DVec3d(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(double, double, double, double, double, double)

Ctor.

public DVec3d(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(double[])

Ctor.

public DVec3d(double[] src)

Parameters

src double[]

Array elements 0,1,2 initialize Point x,y,z; Array elements 3,4,5 initialize Point x,y,z

DVec3d(Func<int, double>)

Initializes a new instance of the DVec3d class using a function that maps indices to values.

public DVec3d(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(BinaryReader)

Initializes a new instance of the DVec3d class from binary data.

public DVec3d(BinaryReader reader)

Parameters

reader BinaryReader

The binary reader to read the data from.

DVec3d(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(string str)

Parameters

str string

string

See Also

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 bool IsAllNaN { get; }

Property Value

bool

IsFinite

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

public bool IsFinite { get; }

Property Value

bool

this[int]

Gets or sets the element at the specified index.

public double this[int index] { get; set; }

Parameters

index int

The zero-based index of the element to get or set.

Property Value

double

The element at the specified index.

NaN

Gets a DVec3d with all components set to NaN.

public static DVec3d NaN { get; }

Property Value

DVec3d

Normal

Normal.

public Vec3d Normal { get; set; }

Property Value

Vec3d

Point

Point.

public Vec3d Point { get; set; }

Property Value

Vec3d

Rank

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

public int Rank { get; }

Property Value

int

Zero

Gets a DVec3d with all components set to zero.

public static DVec3d Zero { get; }

Property Value

DVec3d

Methods

At(int)

Gets a reference to the component at the specified index.

public ref double At(int dir)

Parameters

dir int

The index of the component to access (0-5). Indices 0-2 access Point coordinates (x,y,z), and indices 3-5 access Normal coordinates (x,y,z).

Returns

double

A reference to the specified component.

Enumerate()

For each. Point first. Normal second.

public IEnumerable<double> Enumerate()

Returns

IEnumerable<double>

Equals(DVec3d)

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

public bool Equals(DVec3d other)

Parameters

other DVec3d

An object to compare with this object.

Returns

bool

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

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

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

GenNaN()

Creates a new DVec3d with all components set to NaN.

public static DVec3d GenNaN()

Returns

DVec3d

A new DVec3d with all components set to NaN.

GenZero()

Creates a new DVec3d with all components set to zero.

public static DVec3d GenZero()

Returns

DVec3d

A new DVec3d with all components set to zero.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Interpolate(DVec3d, DVec3d, double)

Interpolates between two DVec3d instances.

public static DVec3d Interpolate(DVec3d a, DVec3d b, double ratio)

Parameters

a DVec3d

The first DVec3d.

b DVec3d

The second DVec3d.

ratio double

The interpolation ratio (0.0 to 1.0).

Returns

DVec3d

A new DVec3d interpolated between a and b.

Set(DVec3d, bool)

Sets the values of this instance from another DVec3d.

public void Set(DVec3d src, bool shareFields = false)

Parameters

src DVec3d

The source DVec3d to copy values from.

shareFields bool

If true, references to the source Point and Normal are used; otherwise, their values are copied.

Set(double, double, double, double, double, double)

public void Set(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

Remarks

If the Point or Normal is null, the function will corrupt.

SetEachValueAbs()

Sets each component of both Point and Normal to its absolute value.

public DVec3d SetEachValueAbs()

Returns

DVec3d

This instance after the operation.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

ToString(string)

Returns a string representation of this DVec3d using the specified format for component values.

public string ToString(string format)

Parameters

format string

The format string to use for component values.

Returns

string

A string representation of this DVec3d.

ToString(string, IFormatProvider)

Returns a string representation of the dual vector formatted according to the specified format.

public 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

ToUnnullableDVec3d()

Converts this DVec3d to an UnnullableDVec3d.

public UnnullableDVec3d ToUnnullableDVec3d()

Returns

UnnullableDVec3d

A new UnnullableDVec3d containing the data from this DVec3d.

WriteBin(BinaryWriter)

Writes the object's data to a binary stream.

public void WriteBin(BinaryWriter writer)

Parameters

writer BinaryWriter

The binary writer to write to

Operators

operator +(DVec3d, DVec3d)

Adds two values together to compute their sum.

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

Parameters

a DVec3d
b DVec3d

Returns

DVec3d

The sum of left and right.

operator /(DVec3d, double)

Divides one value by another to compute their quotient.

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

Parameters

src DVec3d
s double

Returns

DVec3d

The quotient of left divided by right.

operator ==(DVec3d, DVec3d)

Compares two values to determine equality.

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

Parameters

left DVec3d

The value to compare with right.

right DVec3d

The value to compare with left.

Returns

bool

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

operator !=(DVec3d, DVec3d)

Compares two values to determine inequality.

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

Parameters

left DVec3d

The value to compare with right.

right DVec3d

The value to compare with left.

Returns

bool

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

operator *(DVec3d, Mat4d)

Multiplies two values together to compute their product.

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

Parameters

a DVec3d
b Mat4d

Returns

DVec3d

The product of left multiplied by right.

operator *(DVec3d, double)

Multiplies two values together to compute their product.

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

Parameters

src DVec3d
s double

Returns

DVec3d

The product of left multiplied by right.

operator -(DVec3d, DVec3d)

Subtracts two values to compute their difference.

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

Parameters

a DVec3d
b DVec3d

Returns

DVec3d

The value of right subtracted from left.

operator -(DVec3d)

Create a negate DVec3d. The field objects are created, i.e. the field objects are not shared with this.

public static DVec3d operator -(DVec3d src)

Parameters

src DVec3d

src

Returns

DVec3d

negate DVec3d