Skip to main content

Formation

Struct Formation 

Source
pub struct Formation {
    pub positions: Vec<Vec3>,
    pub chars: Vec<char>,
}
Expand description

A formation: a list of 3D offsets from the entity center with per-slot characters.

Fields§

§positions: Vec<Vec3>§chars: Vec<char>

Implementations§

Source§

impl Formation

Source

pub fn single(ch: char) -> Self

A single glyph at the origin.

Source

pub fn grid_3x3() -> Self

A 3×3 grid (9 glyphs).

Source

pub fn grid(cols: i32, rows: i32, spacing: f32) -> Self

An N×M grid with given spacing.

Source

pub fn circle(n: usize, radius: f32) -> Self

A circle of N glyphs at the given radius.

Source

pub fn rings(spec: &[(usize, f32)]) -> Self

Concentric rings. Each entry is (glyph_count, radius).

Source

pub fn diamond(size: i32) -> Self

Diamond shape (all integer (x,y) within Manhattan distance ≤ size).

Source

pub fn cross(arm_length: i32) -> Self

Cross / plus sign with arm_length glyphs per arm (center + 4 arms).

Source

pub fn star(points: usize, inner_r: f32, outer_r: f32) -> Self

N-pointed star with inner_r and outer_r radii.

Source

pub fn hex_cluster(radius: f32) -> Self

Hexagonal close-pack: all hex centers within radius.

Source

pub fn spiral(turns: f32, density: usize) -> Self

Archimedean spiral: r = a * θ.

Source

pub fn fibonacci_spiral(n: usize, scale: f32) -> Self

Fibonacci (golden-ratio) phyllotaxis spiral — N points.

Source

pub fn dna_helix(height: f32, turns: f32, n: usize) -> Self

Double helix (DNA-like): two interleaved spirals winding vertically.

Source

pub fn triangle(size: f32) -> Self

Triangle (equilateral) of side length size.

Source

pub fn lissajous(n: usize, a: f32, b: f32, delta: f32, scale: f32) -> Self

Lissajous figure: parametric (sin(a·t+δ), sin(b·t)) for n points.

Source

pub fn lorenz_trace(n: usize, scale: f32) -> Self

Lorenz attractor sample: step the attractor n times and record positions.

Source

pub fn arrow(length: usize, direction: Vec3) -> Self

Arrow pointing in a direction (normalized), length glyphs long.

Source

pub fn scatter(n: usize, radius: f32, seed: u64) -> Self

Random scatter within radius, seeded for reproducibility.

Source

pub fn rune_sigma() -> Self

Rune: Sigma / S-curve.

Source

pub fn rune_infinity() -> Self

Rune: Infinity / ∞ shape.

Source

pub fn rune_chaos() -> Self

Rune: Chaos — a 3-armed triskelion.

Source

pub fn sierpinski(depth: u32, size: f32) -> Self

Boss formation: Sierpinski triangle approximation (2 levels deep).

Source

pub fn mandala(layers: usize, base_n: usize, base_r: f32) -> Self

Boss formation: Mandala (multiple concentric rings with rotational symmetry).

Source

pub fn scaled(self, s: f32) -> Self

Scale all positions by a scalar.

Source

pub fn rotated_z(self, angle: f32) -> Self

Rotate the entire formation around the Z axis by angle radians.

Source

pub fn translated(self, offset: Vec3) -> Self

Translate all positions by an offset.

Source

pub fn mirrored_x(self) -> Self

Reflect across the Y axis (mirror left-right).

Source

pub fn join(self, other: Formation) -> Self

Combine two formations into one.

Source

pub fn with_char(self, ch: char) -> Self

Replace all characters with a single glyph.

Source

pub fn len(&self) -> usize

Number of glyphs.

Source

pub fn is_empty(&self) -> bool

True if empty.

Source

pub fn centroid(&self) -> Vec3

Compute the centroid of all positions.

Source

pub fn bounding_radius(&self) -> f32

Compute bounding radius (max distance from centroid).

Source

pub fn normalized(self) -> Self

Normalize so bounding_radius == 1.0.

Trait Implementations§

Source§

impl Clone for Formation

Source§

fn clone(&self) -> Formation

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Formation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,