# Rect3D

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-media3d/struct-rect3d/

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

```rust
struct Rect3D
```

An axis-aligned box in 3D space: a location (its corner of least coordinates) and a size, with
double-precision values (WPF's `System.Windows.Media.Media3D.Rect3D`). The bounds of the 3D
scene model are boxes.

`Rect3D::EMPTY` is the box of nothing: its location is positive infinity and its size is
`Size3D::EMPTY`. It contains nothing, intersects nothing, and is the identity of
`union`. The members that WPF guards with exceptions return a [`Size3DError`](/docs/0.5.0/api/ferroui-media3d/enum-size3derror/).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L19)

## Members

- [`EMPTY`](#assoc_const-empty)
- [`new`](#function-new)
- [`from_location_size`](#function-from_location_size)
- [`is_empty`](#function-is_empty)
- [`x`](#function-x)
- [`y`](#function-y)
- [`z`](#function-z)
- [`size_x`](#function-size_x)
- [`size_y`](#function-size_y)
- [`size_z`](#function-size_z)
- [`location`](#function-location)
- [`size`](#function-size)
- [`set_x`](#function-set_x)
- [`set_y`](#function-set_y)
- [`set_z`](#function-set_z)
- [`set_size_x`](#function-set_size_x)
- [`set_size_y`](#function-set_size_y)
- [`set_size_z`](#function-set_size_z)
- [`set_location`](#function-set_location)
- [`set_size`](#function-set_size)
- [`contains`](#function-contains)
- [`contains_xyz`](#function-contains_xyz)
- [`contains_rect`](#function-contains_rect)
- [`intersects_with`](#function-intersects_with)
- [`intersect`](#function-intersect)
- [`intersect_rects`](#function-intersect_rects)
- [`union`](#function-union)
- [`union_point`](#function-union_point)
- [`union_rects`](#function-union_rects)
- [`union_rect_point`](#function-union_rect_point)
- [`offset`](#function-offset)
- [`offset_xyz`](#function-offset_xyz)
- [`offset_rect`](#function-offset_rect)
- [`parse`](#function-parse)

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

### EMPTY

```rust
const EMPTY: Rect3D
```

The box of nothing (WPF's `Rect3D.Empty`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L30)

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

### new

```rust
fn new(x: f64, y: f64, z: f64, size_x: f64, size_y: f64, size_z: f64) -> Result<Self, Size3DError>
```

A box with the given location and size; `Size3DError::NegativeDimension` when a size is
negative.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L41)

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

### from_location_size

```rust
fn from_location_size(location: Point3D, size: Size3D) -> Self
```

A box at the location with the size; `Rect3D::EMPTY` when the size is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L56)

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

### is_empty

```rust
fn is_empty(self: &Self) -> bool
```

Whether this is `Rect3D::EMPTY`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L87)

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

### x

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

The X coordinate of the location.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L93)

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

### y

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

The Y coordinate of the location.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L99)

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

### z

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

The Z coordinate of the location.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L105)

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

### size_x

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

The extent along the X axis.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L111)

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

### size_y

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

The extent along the Y axis.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L117)

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

### size_z

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

The extent along the Z axis.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L123)

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

### location

```rust
fn location(self: &Self) -> Point3D
```

The corner of least coordinates.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L129)

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

### size

```rust
fn size(self: &Self) -> Size3D
```

The size; `Size3D::EMPTY` for the empty box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L134)

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

### set_x

```rust
fn set_x(self: &mut Self, value: f64) -> Result<(), Size3DError>
```

Sets the X coordinate of the location; the empty box cannot be moved.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L143)

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

### set_y

```rust
fn set_y(self: &mut Self, value: f64) -> Result<(), Size3DError>
```

Sets the Y coordinate of the location; the empty box cannot be moved.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L150)

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

### set_z

```rust
fn set_z(self: &mut Self, value: f64) -> Result<(), Size3DError>
```

Sets the Z coordinate of the location; the empty box cannot be moved.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L157)

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

### set_size_x

```rust
fn set_size_x(self: &mut Self, value: f64) -> Result<(), Size3DError>
```

Sets the extent along the X axis; the empty box cannot be changed, and a size is not
negative.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L165)

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

### set_size_y

```rust
fn set_size_y(self: &mut Self, value: f64) -> Result<(), Size3DError>
```

Sets the extent along the Y axis; the empty box cannot be changed, and a size is not
negative.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L172)

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

### set_size_z

```rust
fn set_size_z(self: &mut Self, value: f64) -> Result<(), Size3DError>
```

Sets the extent along the Z axis; the empty box cannot be changed, and a size is not
negative.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L179)

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

### set_location

```rust
fn set_location(self: &mut Self, location: Point3D) -> Result<(), Size3DError>
```

Sets the location; the empty box cannot be moved.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L185)

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

### set_size

```rust
fn set_size(self: &mut Self, size: Size3D) -> Result<(), Size3DError>
```

Sets the size: the empty size makes this the empty box; another size cannot be given to
the empty box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L195)

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

### contains

```rust
fn contains(self: &Self, point: Point3D) -> bool
```

Whether the point is in the box or on its faces; never for the empty box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L209)

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

### contains_xyz

```rust
fn contains_xyz(self: &Self, x: f64, y: f64, z: f64) -> bool
```

Whether the point with the coordinates is in the box or on its faces; never for the empty
box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L215)

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

### contains_rect

```rust
fn contains_rect(self: &Self, rect: Rect3D) -> bool
```

Whether the box is inside this one (faces may touch); never when either is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L228)

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

### intersects_with

```rust
fn intersects_with(self: &Self, rect: Rect3D) -> bool
```

Whether the boxes share a point (touching faces count); never when either is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L241)

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

### intersect

```rust
fn intersect(self: &mut Self, rect: Rect3D)
```

Makes this box the intersection of the two: `Rect3D::EMPTY` when they do not intersect.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L254)

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

### intersect_rects

```rust
fn intersect_rects(rect1: Rect3D, rect2: Rect3D) -> Rect3D
```

The intersection of two boxes (WPF's static `Rect3D.Intersect`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L271)

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

### union

```rust
fn union(self: &mut Self, rect: Rect3D)
```

Makes this box the smallest box that contains both. The empty box adds nothing.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L278)

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

### union_point

```rust
fn union_point(self: &mut Self, point: Point3D)
```

Makes this box the smallest box that contains it and the point.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L299)

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

### union_rects

```rust
fn union_rects(rect1: Rect3D, rect2: Rect3D) -> Rect3D
```

The smallest box that contains both boxes (WPF's static `Rect3D.Union`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L304)

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

### union_rect_point

```rust
fn union_rect_point(rect: Rect3D, point: Point3D) -> Rect3D
```

The smallest box that contains the box and the point (WPF's static `Rect3D.Union` of a
box and a point).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L312)

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

### offset

```rust
fn offset(self: &mut Self, offset: Vector3D) -> Result<(), Size3DError>
```

Moves the box by the vector; the empty box cannot be moved.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L320)

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

### offset_xyz

```rust
fn offset_xyz(self: &mut Self, offset_x: f64, offset_y: f64, offset_z: f64) -> Result<(), Size3DError>
```

Moves the box by the given amounts; the empty box cannot be moved.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L325)

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

### offset_rect

```rust
fn offset_rect(rect: Rect3D, offset: Vector3D) -> Result<Rect3D, Size3DError>
```

The box moved by the vector (WPF's static `Rect3D.Offset`); the empty box cannot be moved.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L334)

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

### parse

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

Parses the text form: `"Empty"`, or `"x,y,z,sizeX,sizeY,sizeZ"` (commas, white space or
both between the numbers) in the invariant culture, with no negative size.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/rect_3d.rs#L358)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- [`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/)
- `ErasedDestructor`
- `IntoEither`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- `Clone`
- `Copy`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`
- `Default`
- `FromStr`
- `Display`

## Availability

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