# Curves with domain other than [0, 1]

Attention Topic was automatically imported from the old Question2Answer platform.

Hey there,

I’m trying to use a Curve to interpolated some samples in a script. I could not find a way to change the domain from [0, 1] from within the editor nor from a script. Here’s a minimal example of what I would like to have:

``````var myCurve = Curve.new()
myCurve.max_value = 10.0
myCurve.add_point(Vector2(0, 0), 1, 1, Curve.TANGENT_LINEAR, Curve.TANGENT_LINEAR)
myCurve.add_point(Vector2(5, 10), 1, 1, Curve.TANGENT_LINEAR, Curve.TANGENT_LINEAR)
for i in range(0, 50):
var x = i / 10.
var y = myCurve.sample(x)
print(Vector2(x, y))
``````

which yields

(0, 0)
(0.1, 1)
(0.2, 2)
(0.3, 3)
(0.4, 4)
(0.5, 5)
(0.6, 6.000001)
(0.7, 7)
(0.8, 8)
(0.9, 8.999999)
(1, 10)
(1.1, 10)
(1.2, 10)
(1.3, 10)

I could scale my input values to [0, 1]. But I wanted to know whether there is a possibility to extend the domain of Curves and if not, why this is prohibited.

Thanks a lot,
Stefan

I guessing because Curves are normalized and 1 is 100% and 100% is max

Moreus | 2023-03-12 18:56