Skip to main content

CorePlotting::LayoutTransform

CorePlotting::LayoutTransform

Pure geometric transform that is output = input * gain + offset. More…

#include <LayoutTransform.hpp>

Public Functions

Name
LayoutTransform() =default
Default constructor (identity transform).
LayoutTransform(float off, float g)
Construct with offset and gain.
float apply(float value) const
Apply transform as output = input * gain + offset.
float inverse(float transformed) const
Inverse transform to recover original value from transformed.
LayoutTransform compose(LayoutTransform const & other) const
Compose transforms where result applies this AFTER other.
glm::mat4 toModelMatrixY() const
Convert to 4x4 Model matrix for Y-axis transform.
glm::mat4 toModelMatrixX() const
Convert to 4x4 Model matrix for X-axis transform.
bool isIdentity(float epsilon =1e-6f) const
Check if this is approximately an identity transform.
LayoutTransform identity()
Create identity transform.

Public Attributes

Name
float offset
Translation (applied after scaling).
float gain
Scale factor.

Detailed Description

struct CorePlotting::LayoutTransform;

Pure geometric transform that is output = input * gain + offset.

This is the fundamental building block for positioning data in world space. The LayoutEngine outputs these, and they become part of the Model matrix.

The transform is applied as: transformed_value = raw_value * gain + offset

This simple abstraction allows:

  • Data normalization (z-score, peak-to-peak, etc.)
  • Layout positioning (vertical stacking)
  • User adjustments (manual gain/offset tweaks)

Transforms can be composed: applying A then B is equivalent to A.compose(B).

Public Functions Documentation

function LayoutTransform

LayoutTransform() =default

Default constructor (identity transform).

function LayoutTransform

inline LayoutTransform(
    float off,
    float g
)

Construct with offset and gain.

Parameters:

  • off Offset (translation)
  • g Gain (scale factor)

function apply

inline float apply(
    float value
) const

Apply transform as output = input * gain + offset.

function inverse

inline float inverse(
    float transformed
) const

Inverse transform to recover original value from transformed.

Note: Returns 0 if gain is effectively zero (non-invertible)

function compose

inline LayoutTransform compose(
    LayoutTransform const & other
) const

Compose transforms where result applies this AFTER other.

Parameters:

  • other Transform applied first

Return: Combined transform equivalent to applying other then this

If we apply other then this: result = (x * other.gain + other.offset) * this.gain + this.offset = x * (other.gain * this.gain) + (other.offset * this.gain + this.offset)

function toModelMatrixY

inline glm::mat4 toModelMatrixY() const

Convert to 4x4 Model matrix for Y-axis transform.

Creates a matrix that applies this transform to Y coordinates only. X and Z coordinates pass through unchanged.

function toModelMatrixX

inline glm::mat4 toModelMatrixX() const

Convert to 4x4 Model matrix for X-axis transform.

Creates a matrix that applies this transform to X coordinates only.

function isIdentity

inline bool isIdentity(
    float epsilon =1e-6f
) const

Check if this is approximately an identity transform.

function identity

static inline LayoutTransform identity()

Create identity transform.

Public Attributes Documentation

variable offset

float offset {0.0f};

Translation (applied after scaling).

variable gain

float gain {1.0f};

Scale factor.


Updated on 2026-11-13 at 20:25:42 +0000