Skip to content

CircleScale

The CircleScale class maps an input value to a circle radius such that the circle’s area is linearly proportional to the input value. This ensures that if the area of a circle is meant to represent a value, the radius is calculated appropriately.

pydreamplet.scales.CircleScale

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

Parameters

  • domain (tuple[float, float]): The numeric input domain.
  • output_range (tuple[float, float]): The desired radius range (rmin, rmax).
circle_scale = CircleScale((0, 100), (5, 20))
print(circle_scale.map(50))  # Outputs the radius corresponding to the value 50

map

map(value: float) -> float

Maps the input value to a circle radius based on area proportionality.

domain

Get or set the numeric domain.

output_range

Get or set the radius range.