# RelativePoint

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

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

```rust
struct RelativePoint
```

Defines a point that may be defined relative to a containing element.

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

## Members

- [`point`](#struct_field-point)
- [`unit`](#struct_field-unit)
- [`TOP_LEFT`](#assoc_const-top_left)
- [`CENTER`](#assoc_const-center)
- [`BOTTOM_RIGHT`](#assoc_const-bottom_right)
- [`new`](#function-new)
- [`from_point`](#function-from_point)
- [`equals`](#function-equals)
- [`to_pixels`](#function-to_pixels)
- [`to_pixels_rect`](#function-to_pixels_rect)
- [`parse`](#function-parse)

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

### point

```rust
point: crate::Point
```

The point.

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

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

### unit

```rust
unit: RelativeUnit
```

The unit of the point.

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

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

### TOP_LEFT

```rust
const TOP_LEFT: RelativePoint
```

A point at the top left of the containing element.

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

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

### CENTER

```rust
const CENTER: RelativePoint
```

A point at the center of the containing element.

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

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

### BOTTOM_RIGHT

```rust
const BOTTOM_RIGHT: RelativePoint
```

A point at the bottom right of the containing element.

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

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

### new

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

Initializes a new instance of the `RelativePoint` structure.

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

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

### from_point

```rust
const fn from_point(point: Point, unit: RelativeUnit) -> Self
```

Initializes a new instance of the `RelativePoint` structure from a `Point`.

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

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

### equals

```rust
fn equals(self: &Self, p: RelativePoint) -> bool
```

Checks if the `RelativePoint` equals another point.

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

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

### to_pixels

```rust
fn to_pixels(self: &Self, size: Size) -> Point
```

Converts a `RelativePoint` into pixels, using `size` as the size of the
visual the point is relative to.

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

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

### to_pixels_rect

```rust
fn to_pixels_rect(self: &Self, rect: Rect) -> Point
```

Converts a `RelativePoint` into pixels, using `rect` as the bounding
rectangle the point is relative to.

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

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

### parse

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

Parses a `RelativePoint` string: `"x, y"` (absolute) or `"x%, y%"` (relative).

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

## 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`
- [`Transition<RelativePoint>`](/docs/0.5.0/api/ferroui-base/animation/trait-transition/)
- `IInterpolator<RelativePoint>`
- `From<RelativePoint>`
- `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`
- `FromStr`
- `Display`

## Availability

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