RKTK API Docs RKTK Home Repo

Layout3d

Trait Layout3d 

Source
pub trait Layout3d {
    const PIXEL_COUNT: usize;

    // Required method
    fn shapes() -> impl Iterator<Item = Shape3d>;

    // Provided method
    fn points() -> impl Iterator<Item = Vec3> { ... }
}
Expand description

Trait for three-dimensional LED layouts.

Implementors of this trait represent a 3D arrangement of LEDs using one or more shapes.

Use layout3d! to define a type that implements Layout3d.

For our 3D space, we can think of:

  • (-1.0, -1.0, -1.0) as the left bottom back
  • (-1.0, -1.0, 1.0) as the left bottom front
  • (1.0, -1.0, -1.0) as the right bottom back
  • (1.0, -1.0, 1.0) as the right bottom front
  • (-1.0, 1.0, -1.0) as the left top back
  • (-1.0, 1.0, 1.0) as the left top front
  • (1.0, 1.0, -1.0) as the right top back
  • (1.0, 1.0, 1.0) as the right top front

Required Associated Constants§

Source

const PIXEL_COUNT: usize

The total number of LEDs in this layout.

Required Methods§

Source

fn shapes() -> impl Iterator<Item = Shape3d>

Returns an iterator over the shapes that make up this layout.

Provided Methods§

Source

fn points() -> impl Iterator<Item = Vec3>

Returns an iterator over all points (LED positions) in this layout.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§