# Vec4D

## Description

`struct` `Tinman.Core.Math.Vectors.Vec4D`

A four-dimensional vector with 64-bit floating-point precision.

```/     \
|  X  |
|  Y  |
|  Z  |
|  W  |
\     /```

## Public / Constants

### Undefined

`public` `static` `readonly` `attribute` `Undefined` → `(Vec4D)`

A vector with undefined value.

### Zero

`public` `static` `readonly` `attribute` `Zero` → `(Vec4D)`

The zero vector.

## Public / Constructors

### Vec4​D

`public` `constructor` `Vec4D` → `(4)`

in : float64

X-coordinate of vector.

in : float64

Y-coordinate of vector.

in : float64

Z-coordinate of vector.

in : float64

W-coordinate of vector.

Creates a new instance of Vec4D.

## Public / Methods

`[Pure]`
`public` `method` `Add1` → `(1)`

in : Vec4D

The vector.

returns → Vec4D

The resulting vector.

Adds this vector and the given one.

`[Pure]`
`public` `method` `Add2` → `(4)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

in : float64

W-component of vector.

returns → Vec4D

The resulting vector.

Adds this vector and the given one.

### Ceiling

`[Pure]`
`public` `method` `Ceiling` → `()`

returns → Vec4D

The resulting vector.

Computes the component-wise ceiling of this vector.

### Choose

`[Pure]`
`public` `method` `Choose` → `(2)`

idx in : int32

The zero-based component index.

opt : float64 = 0

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

returns → float64

The resulting vector.

Chooses a component of this vector.

### Div

`[Pure]`
`public` `method` `Div` → `(1)`

in : float64

The scalar value.

returns → Vec4D

The resulting vector.

Divides this vector by the given scalar value.

### Dot

`[Pure]`
`public` `method` `Dot1` → `(1)`

in : Vec4D

The vector.

returns → float64

The resulting vector.

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

`[Pure]`
`public` `method` `Dot2` → `(4)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

in : float64

W-component of vector.

returns → float64

The resulting vector.

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

### Equals

`[Pure]`
`public` `method` `Equals2` → `(4)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

in : float64

W-component of vector.

returns → bool

`true` if both vectors are equal, `false` if they are not.

Checks if this vector and the given one are equal.

### Equals​Almost

`[Pure]`
`public` `method` `EqualsAlmost1` → `(1)`

in : Vec4D

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.

Maths.Similar2

`[Pure]`
`public` `method` `EqualsAlmost2` → `(4)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

in : float64

W-component of 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.

Maths.Similar2

### Floor

`[Pure]`
`public` `method` `Floor` → `()`

returns → Vec4D

The resulting vector.

Computes the component-wise floor of this vector.

### Max

`[Pure]`
`public` `method` `Max1` → `(1)`

in : Vec4D

The vector.

returns → Vec4D

The resulting vector.

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

`[Pure]`
`public` `method` `Max2` → `(4)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

in : float64

W-component of vector.

returns → Vec4D

The resulting vector.

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

### Min

`[Pure]`
`public` `method` `Min1` → `(1)`

in : Vec4D

The vector.

returns → Vec4D

The resulting vector.

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

`[Pure]`
`public` `method` `Min2` → `(4)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

in : float64

W-component of vector.

returns → Vec4D

The resulting vector.

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

### Mul

`[Pure]`
`public` `method` `Mul1` → `(1)`

in : Vec4D

The vector.

returns → Vec4D

The resulting vector.

Multiplies this vector with the given one.

`[Pure]`
`public` `method` `Mul2` → `(4)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

in : float64

W-component of vector.

returns → Vec4D

The resulting vector.

Multiplies this vector with the given one.

`[Pure]`
`public` `method` `Mul3` → `(1)`

in : float64

The scalar value.

returns → Vec4D

The resulting vector.

Multiplies this vector with the given scalar value.

### Neg

`[Pure]`
`public` `method` `Neg` → `()`

returns → Vec4D

The resulting vector.

Negates this vector.

### Norm

`[Pure]`
`public` `method` `Norm` → `()`

returns → Vec4D

The resulting vector.

Normalizes this vector to unit length.

### Sub

`[Pure]`
`public` `method` `Sub1` → `(1)`

in : Vec4D

The vector.

returns → Vec4D

The resulting vector.

Subtracts the given vector from this one.

`[Pure]`
`public` `method` `Sub2` → `(4)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

in : float64

W-component of vector.

returns → Vec4D

The resulting vector.

Subtracts the given vector from this one.

## 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).

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

### W

`public` `readonly` `attribute` `W` → `(float64)`

W-coordinate of vector.

### X

`public` `readonly` `attribute` `X` → `(float64)`

X-coordinate of vector.

### Y

`public` `readonly` `attribute` `Y` → `(float64)`

Y-coordinate of vector.

### Z

`public` `readonly` `attribute` `Z` → `(float64)`

Z-coordinate of vector.

## Serialization

### Serializer

`public` `static` `readonly` `attribute` `Serializer` → `(ITypeSerializerEx<Vec4D>)`

The serialization helper object for values of Vec4D.