Skip to content

Projected

Mojo struct 🡭

Projected

@memory_only
struct Projected

One point after projection: where it lands on the page, and how far away it is.

x/y are in the camera’s own 2D space, centered on the origin and in the same units the data was – a frame maps them onto pixels the way a LinearScale maps any other value, so this struct knows nothing about a plot rect.

y already points up, the way data does, rather than down the way pixels do. The frame flips it exactly once, where every other mark’s y is flipped, instead of this module and the frame each flipping and the two having to agree.

Fields

  • x (Float64)
  • y (Float64)
  • depth (Float64): Distance along the view direction, larger being farther from the camera. Comparable only against another depth from the same camera; it is an ordering key, not a measurement.

Implemented traits

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable

Methods

__init__

fn def __init__(out self, x: Float64, y: Float64, depth: Float64)

Build a projected point.

Args:

  • x (Float64): Horizontal position in camera space.
  • y (Float64): Vertical position in camera space, y up.
  • depth (Float64): Sort key, larger being farther away.
  • self (Self)

Returns:

Self