# Vector3

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/numerics/struct-vector3/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct Vector3
```

A vector with three single-precision components.

The layout is the one of the reference runtime and is relied on when the
value is passed to a graphics API by address (as a vertex attribute, for
example): three consecutive singles, `x`, `y`, `z`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L17)

## Members

- [`x`](#struct_field-x)
- [`y`](#struct_field-y)
- [`z`](#struct_field-z)
- [`ZERO`](#assoc_const-zero)
- [`ONE`](#assoc_const-one)
- [`UNIT_X`](#assoc_const-unit_x)
- [`UNIT_Y`](#assoc_const-unit_y)
- [`UNIT_Z`](#assoc_const-unit_z)
- [`new`](#function-new)
- [`from_value`](#function-from_value)
- [`from_vector2`](#function-from_vector2)
- [`abs`](#function-abs)
- [`clamp`](#function-clamp)
- [`cross`](#function-cross)
- [`distance`](#function-distance)
- [`distance_squared`](#function-distance_squared)
- [`dot`](#function-dot)
- [`length`](#function-length)
- [`length_squared`](#function-length_squared)
- [`lerp`](#function-lerp)
- [`max`](#function-max)
- [`min`](#function-min)
- [`normalize`](#function-normalize)
- [`square_root`](#function-square_root)
- [`transform`](#function-transform)
- [`transform_quaternion`](#function-transform_quaternion)
- [`transform_normal`](#function-transform_normal)

<a id="struct_field-x"></a>

### x

```rust
x: f32
```

The X component of the vector.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L19)

<a id="struct_field-y"></a>

### y

```rust
y: f32
```

The Y component of the vector.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L21)

<a id="struct_field-z"></a>

### z

```rust
z: f32
```

The Z component of the vector.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L23)

<a id="assoc_const-zero"></a>

### ZERO

```rust
const ZERO: Vector3
```

The vector `(0, 0, 0)`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L28)

<a id="assoc_const-one"></a>

### ONE

```rust
const ONE: Vector3
```

The vector `(1, 1, 1)`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L30)

<a id="assoc_const-unit_x"></a>

### UNIT_X

```rust
const UNIT_X: Vector3
```

The vector `(1, 0, 0)`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L32)

<a id="assoc_const-unit_y"></a>

### UNIT_Y

```rust
const UNIT_Y: Vector3
```

The vector `(0, 1, 0)`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L34)

<a id="assoc_const-unit_z"></a>

### UNIT_Z

```rust
const UNIT_Z: Vector3
```

The vector `(0, 0, 1)`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L36)

<a id="function-new"></a>

### new

```rust
const fn new(x: f32, y: f32, z: f32) -> Self
```

Creates a vector from its components.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L40)

<a id="function-from_value"></a>

### from_value

```rust
const fn from_value(value: f32) -> Self
```

Creates a vector whose components all have the same value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L46)

<a id="function-from_vector2"></a>

### from_vector2

```rust
const fn from_vector2(value: Vector2, z: f32) -> Self
```

Creates a vector from a `Vector2` and a Z component.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L52)

<a id="function-abs"></a>

### abs

```rust
fn abs(value: Vector3) -> Vector3
```

Returns a vector whose elements are the absolute values of each of the
specified vector's elements.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L59)

<a id="function-clamp"></a>

### clamp

```rust
fn clamp(value1: Vector3, min: Vector3, max: Vector3) -> Vector3
```

Restricts a vector between a minimum and a maximum value
(`min(max(value, min), max)`, so `max` wins when the bounds are inverted).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L66)

<a id="function-cross"></a>

### cross

```rust
fn cross(vector1: Vector3, vector2: Vector3) -> Vector3
```

Computes the cross product of two vectors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L72)

<a id="function-distance"></a>

### distance

```rust
fn distance(value1: Vector3, value2: Vector3) -> f32
```

Computes the Euclidean distance between the two given points.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L82)

<a id="function-distance_squared"></a>

### distance_squared

```rust
fn distance_squared(value1: Vector3, value2: Vector3) -> f32
```

Returns the Euclidean distance squared between two specified points.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L88)

<a id="function-dot"></a>

### dot

```rust
fn dot(vector1: Vector3, vector2: Vector3) -> f32
```

Returns the dot product of two vectors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L94)

<a id="function-length"></a>

### length

```rust
fn length(self: &Self) -> f32
```

Returns the length of the vector.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L100)

<a id="function-length_squared"></a>

### length_squared

```rust
fn length_squared(self: &Self) -> f32
```

Returns the length of the vector squared.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L106)

<a id="function-lerp"></a>

### lerp

```rust
fn lerp(value1: Vector3, value2: Vector3, amount: f32) -> Vector3
```

Performs a linear interpolation between two vectors based on the given weighting.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L112)

<a id="function-max"></a>

### max

```rust
fn max(value1: Vector3, value2: Vector3) -> Vector3
```

Returns a vector whose elements are the maximum of each of the pairs of
elements in two specified vectors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L119)

<a id="function-min"></a>

### min

```rust
fn min(value1: Vector3, value2: Vector3) -> Vector3
```

Returns a vector whose elements are the minimum of each of the pairs of
elements in two specified vectors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L130)

<a id="function-normalize"></a>

### normalize

```rust
fn normalize(value: Vector3) -> Vector3
```

Returns a vector with the same direction as the specified vector, but
with a length of one (NaN components for a zero-length vector).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L141)

<a id="function-square_root"></a>

### square_root

```rust
fn square_root(value: Vector3) -> Vector3
```

Returns a vector whose elements are the square root of each of a
specified vector's elements.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L148)

<a id="function-transform"></a>

### transform

```rust
fn transform(position: Vector3, matrix: Matrix4x4) -> Vector3
```

Transforms a vector by a specified 4x4 matrix.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L154)

<a id="function-transform_quaternion"></a>

### transform_quaternion

```rust
fn transform_quaternion(value: Vector3, rotation: Quaternion) -> Vector3
```

Transforms a vector by the specified rotation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L163)

<a id="function-transform_normal"></a>

### transform_normal

```rust
fn transform_normal(normal: Vector3, matrix: Matrix4x4) -> Vector3
```

Transforms a vector normal by the given 4x4 matrix.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/numerics/vector3.rs#L187)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Copy`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`
- `Default`
- `From<Vector3D>`
- `From<Vector3>`
- `Add`
- `Sub`
- `Mul`
- `Mul<f32>`
- `Mul<Vector3>`
- `Div`
- `Div<f32>`
- `Neg`
- `AddAssign`
- `SubAssign`
- `MulAssign`
- `MulAssign<f32>`
- `DivAssign`
- `DivAssign<f32>`
- `Display`
- `IInterpolator<Vector3>`
- `SpringValue`
- `ExpressionVariantValue`
- `BatchValue`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
