Skip to content

SquareScale

The SquareScale class maps an input value to an output using a square-root transformation. This is useful when a visual property (e.g., a square's side length) should be proportional to the square root of the area.

pydreamplet.scales.SquareScale

SquareScale(
    domain: tuple[float, float],
    output_range: tuple[float, float]
)

Parameters

  • domain (tuple[float, float]): The input domain (non-negative values).
  • output_range (tuple[float, float]): The target output range.
square = SquareScale((0, 100), (0, 10))
print(square.map(25))  # Maps the square-root of 25 to the output range

map

map(value: float) -> float

Scales the value using a square-root transformation.

domain

Get or set the numeric domain.

output_range

Get or set the target output range.