IVecOps

Description

[StaticTemplate]
interface Tinman.Core.Math.Vectors.IVecOps
<TVector val : IVecOps<TVector, TCoord>>
<TCoord val>

Derived from

IEquatable<TVector>

Extended by

IVec2Ops
IVec3Ops
IVec4Ops

Defines common operations for 2D, 3D and 4D vector types.

Public / Methods

Add


[Pure]
public method Add → (1)

in : TVector

The vector.

returns → TVector

The resulting vector.

Adds this vector and the given one (component-wise).

See also

IVecOps.Sub

Ceiling


[Pure]
public method Ceiling → ()

returns → TVector

The resulting vector.

Computes the ceiling of this vector (component-wise).

Vectors with an integral component type are always identical to their ceiling.

See also

IVecOps.Floor

Div


[Pure]
public method Div → (1)

in : TCoord

The scalar value.

returns → TVector

The resulting vector.

Divides this vector by the given scalar value (component-wise).

Vectors with an integral component type will perform an integer division.

See also

IVecOps.Mul2

Dot


[Pure]
public method Dot → (1)

in : TVector

The vector.

returns → TCoord

The resulting vector.

Computes the dot product between this vector and the given one.

Equals​Almost


[Pure]
public method EqualsAlmost → (1)

in : TVector

The vector.

returns → bool

true if both vectors are similar, false if they are not.

Checks if this vector and the given one are similar but necessarily equal.

Vectors with an integral component type will delegate to object.Equals.

Floor


[Pure]
public method Floor → ()

returns → TVector

The resulting vector.

Computes the floor of this vector (component-wise).

Vectors with an integral component type are always identical to their floor.

See also

IVecOps.Ceiling

Get


[Pure]
public method Get → (2)

idx in : int32

The zero-based component index.

opt : TCoord = default(TCoord)

The value to return if idx in is out of range.

returns → TCoord

The resulting vector.

Returns a component of this vector.

Max


[Pure]
public method Max → (1)

in : TVector

The vector.

returns → TVector

The resulting vector.

Computes the maximum of this vector and the given one (component-wise).

See also

IVecOps.Min

Min


[Pure]
public method Min → (1)

in : TVector

The vector.

returns → TVector

The resulting vector.

Computes the minimum of this vector and the given one (component-wise).

See also

IVecOps.Max

Mul

2 overloads


[Pure]
public method Mul1 → (1)

in : TVector

The vector.

returns → TVector

The resulting vector.

Multiplies this vector with the given one (component-wise).


[Pure]
public method Mul2 → (1)

in : TCoord

The scalar value.

returns → TVector

The resulting vector.

Multiplies this vector with the given scalar value (component-wise).

See also

IVecOps.Div

Neg


[Pure]
public method Neg → ()

returns → TVector

The resulting vector.

Negates this vector (component-wise).

Norm


[Pure]
public method Norm → ()

returns → TVector

The resulting vector.

Normalizes this vector to unit length, by dividing it by its length.

Vectors with an integral component type will perform an integer division.

Shift​Left


[Pure]
public method ShiftLeft → (1)

in : int32

The shift amount.

returns → TVector

The resulting vector.

Performs a left bit shift on each component of this vector.

Vectors with a floating-point component type will perform a multiplication by 2^v.

Shift​Right


[Pure]
public method ShiftRight → (1)

in : int32

The shift amount.

returns → TVector

The resulting vector.

Performs a right bit shift on each component of this vector.

Vectors with a floating-point component type will perform a division by 2^v.

Sub


[Pure]
public method Sub → (1)

in : TVector

The vector.

returns → TVector

The resulting vector.

Subtracts the given vector from this one (component-wise).

See also

IVecOps.Add

To​String


[Pure]
public method ToString → (1)

flags in : FormatFlags

The format flags to use.

returns → string

The string representation.

Returns the string representation of this vector.

See also

Format.ThisNum

Public / Attributes

Is​Undefined


public attribute IsUndefined → (get)

value : bool

true if this vector has an undefined value, false if not.

Checks if this vector has an undefined value.

A vector is undefined if at least one component is NaN (not-a-number). Vectors with an integral component type cannot be undefined.

See also

Maths.IsNan

Length


public attribute Length → (get)

value : float64

[>=0]
The vector length.

Returns the length of this vector.

Length​Sqr


public attribute LengthSqr → (get)

value : float64

[>=0]
The squared vector length.

Returns the squared length of this vector.