ExCodecs.Spatial.GaussianCloud (ex_codecs v0.2.3)

Copy Markdown View Source

A collection of %ExCodecs.Spatial.Gaussian{} values for codec interchange.

Fields

  • :gaussians[Gaussian.t()]; defaults to []. Ordering is preserved. Positions use application-defined Cartesian units.
  • :boundsBounds.t() | nil; defaults to nil. new/2 computes axis-aligned bounds from Gaussian centers by default; extents do not include each Gaussian's scale.

  • :metadataMetadata.t(); defaults to %Metadata{}.

Example

iex> alias ExCodecs.Spatial.{Gaussian, GaussianCloud}
iex> cloud = GaussianCloud.new([Gaussian.new({-1, 0, 0}), Gaussian.new({2, 0, 0})])
iex> {GaussianCloud.size(cloud), cloud.bounds.min_x, cloud.bounds.max_x}
{2, -1.0, 2.0}

Summary

Types

t()

A Gaussian cloud. See the module documentation for every field, its default, units or conventions, and a construction example.

Functions

Builds a Gaussian cloud.

Number of Gaussians.

Recomputes bounds from Gaussian positions.

Types

t()

@type t() :: %ExCodecs.Spatial.GaussianCloud{
  bounds: ExCodecs.Spatial.Bounds.t() | nil,
  gaussians: [ExCodecs.Spatial.Gaussian.t()],
  metadata: ExCodecs.Spatial.Metadata.t()
}

A Gaussian cloud. See the module documentation for every field, its default, units or conventions, and a construction example.

Functions

new(gaussians, opts \\ [])

@spec new(
  [ExCodecs.Spatial.Gaussian.t()],
  keyword()
) :: t()

Builds a Gaussian cloud.

Arguments

  • gaussians[Gaussian.t()]; the supplied list is retained.
  • opts — a keyword list with:
    • :compute_bounds — any truthy/falsy term; defaults to true.
    • :boundsBounds.t() | nil; a truthy value overrides computation.

    • :metadataMetadata.t(); defaults to %Metadata{}.

Returns

%GaussianCloud{}

Raises

Examples

iex> alias ExCodecs.Spatial.{Gaussian, GaussianCloud}
iex> c = GaussianCloud.new([Gaussian.new({0.0, 0.0, 0.0})])
iex> GaussianCloud.size(c)
1

size(gaussian_cloud)

@spec size(t()) :: non_neg_integer()

Number of Gaussians.

Arguments

  • cloud%GaussianCloud{}

Returns

non-negative integer

Raises

Examples

iex> ExCodecs.Spatial.GaussianCloud.size(ExCodecs.Spatial.GaussianCloud.new([]))
0

with_bounds(cloud)

@spec with_bounds(t()) :: t()

Recomputes bounds from Gaussian positions.

Arguments

  • cloud%GaussianCloud{}

Returns

Updated %GaussianCloud{}

Raises

Examples

iex> alias ExCodecs.Spatial.{Gaussian, GaussianCloud}
iex> c = GaussianCloud.new([Gaussian.new({1.0, 2.0, 3.0})], compute_bounds: false)
iex> GaussianCloud.with_bounds(c).bounds != nil
true