# Vector3D

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

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

```rust
struct Vector3D
```

3D vector with double-precision components.

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

## Members

- [`x`](#struct_field-x)
- [`y`](#struct_field-y)
- [`z`](#struct_field-z)
- [`new`](#function-new)
- [`parse`](#function-parse)
- [`dot`](#function-dot)
- [`add`](#function-add)
- [`substract`](#function-substract)
- [`multiply`](#function-multiply)
- [`multiply_scalar`](#function-multiply_scalar)
- [`divide`](#function-divide)
- [`divide_scalar`](#function-divide_scalar)
- [`abs`](#function-abs)
- [`clamp`](#function-clamp)
- [`max`](#function-max)
- [`min`](#function-min)
- [`length`](#function-length)
- [`normalize`](#function-normalize)
- [`distance_squared`](#function-distance_squared)
- [`distance`](#function-distance)
- [`deconstruct`](#function-deconstruct)

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

### x

```rust
x: f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L14)

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

### y

```rust
y: f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L15)

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

### z

```rust
z: f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L16)

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

### new

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



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

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

### parse

```rust
fn parse(s: &str) -> Result<Self, FormatError>
```

Parses a `Vector3D` string (`"x, y, z"`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L26)

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

### dot

```rust
fn dot(vector1: Vector3D, vector2: Vector3D) -> f64
```

Calculates the dot product of two vectors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L38)

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

### add

```rust
fn add(left: Vector3D, right: Vector3D) -> Vector3D
```

Adds the second to the first vector.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L45)

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

### substract

```rust
fn substract(left: Vector3D, right: Vector3D) -> Vector3D
```

Subtracts the second from the first vector.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L51)

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

### multiply

```rust
fn multiply(left: Vector3D, right: Vector3D) -> Vector3D
```

Multiplies the first vector by the second, component-wise.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L57)

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

### multiply_scalar

```rust
fn multiply_scalar(left: Vector3D, right: f64) -> Vector3D
```

Multiplies the vector by the given scalar.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L63)

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

### divide

```rust
fn divide(left: Vector3D, right: Vector3D) -> Vector3D
```

Divides the first vector by the second, component-wise.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L69)

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

### divide_scalar

```rust
fn divide_scalar(left: Vector3D, right: f64) -> Vector3D
```

Divides the vector by the given scalar.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L75)

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

### abs

```rust
fn abs(self: &Self) -> Vector3D
```

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/vector3d.rs#L82)

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

### clamp

```rust
fn clamp(value: Vector3D, min: Vector3D, max: Vector3D) -> Vector3D
```

Restricts a vector between a minimum and a maximum value.

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

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

### max

```rust
fn max(left: Vector3D, right: Vector3D) -> Vector3D
```

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/vector3d.rs#L95)

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

### min

```rust
fn min(left: Vector3D, right: Vector3D) -> Vector3D
```

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/vector3d.rs#L106)

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

### length

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

Length of the vector.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L116)

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

### normalize

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

Returns a normalized version of this vector.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L122)

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

### distance_squared

```rust
fn distance_squared(value1: Vector3D, value2: Vector3D) -> f64
```

Computes the squared Euclidean distance between the two given points.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L128)

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

### distance

```rust
fn distance(value1: Vector3D, value2: Vector3D) -> f64
```

Computes the Euclidean distance between the two given points.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/vector3d.rs#L135)

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

### deconstruct

```rust
const fn deconstruct(self: &Self) -> (f64, f64, f64)
```

Deconstructs the vector into its components.

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

## 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`
- `From<Vector3D>`
- `From<Vector3>`
- `IInterpolator<Vector3D>`
- `ExpressionVariantValue`
- `ServerPropertyValue`
- `BatchValue`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)
- `Clone`
- `Copy`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`
- `Default`
- `Add`
- `Sub`
- `Neg`
- `Mul<f64>`
- `AddAssign`
- `SubAssign`
- `MulAssign<f64>`
- `FromStr`
- `Display`

## Availability

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