BB.Message.Geometry.Point3D (bb v0.15.0)

View Source

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{}

Summary

Functions

Create a new Point3D message from a Vec3.

Get the underlying Vec3.

Get the X coordinate.

Get the Y coordinate.

Get the Z coordinate.

Types

t()

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

Functions

new(frame_id, attrs)

@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(point3_d)

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

Get the underlying Vec3.

x(point3_d)

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

Get the X coordinate.

y(point3_d)

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

Get the Y coordinate.

z(point3_d)

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

Get the Z coordinate.