# `BB.Message.Geometry.Point3D`
[🔗](https://github.com/beam-bots/bb/blob/main/lib/bb/message/geometry/point3d.ex#L5)

A 3D point in space.

Wraps a `BB.Math.Vec3` for use as a message payload.

## Fields

- `vec` - The point as `BB.Math.Vec3.t()` in metres

## Examples

    alias BB.Message.Geometry.Point3D
    alias BB.Math.Vec3

    {:ok, msg} = Point3D.new(:base_link, Vec3.new(0.3, 0.2, 0.1))

    # Access coordinates
    point = msg.payload
    Point3D.x(point)  # => 0.3
    Point3D.to_vec3(point)  # => %Vec3{}

# `t`

```elixir
@type t() :: %BB.Message.Geometry.Point3D{vec: BB.Math.Vec3.t()}
```

# `new`

```elixir
@spec new(
  atom(),
  keyword()
) :: {:ok, BB.Message.t()} | {:error, term()}
@spec new(atom(), BB.Math.Vec3.t()) :: {:ok, BB.Message.t()} | {:error, term()}
```

Create a new Point3D message from a Vec3.

## Examples

    alias BB.Math.Vec3

    {:ok, msg} = Point3D.new(:base_link, Vec3.new(0.3, 0.2, 0.1))

# `to_vec3`

```elixir
@spec to_vec3(t()) :: BB.Math.Vec3.t()
```

Get the underlying Vec3.

# `x`

```elixir
@spec x(t()) :: float()
```

Get the X coordinate.

# `y`

```elixir
@spec y(t()) :: float()
```

Get the Y coordinate.

# `z`

```elixir
@spec z(t()) :: float()
```

Get the Z coordinate.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
