Get y from a curve by given x

Greeting,

I want to generate a list of y values from a curve by give the x. This is what I have gotten. Is there a node to achieve it or a python script would help as well.

Thank you for the help.

If you meant to attach an image it did not show up. Try again and we’ll see where you’re at.

There are two basic ways to go about this:

  1. Mathematically, using the function that defines the curve. This would just be a case of actually solving for y. Super straight forward but assumes you have a mathematical function representing the plotted curve - which I’m guessing you don’t.
  2. Geometrically, relying on the geometry functions (and obviously math) to locate a point along the curve and return its coordinates. This is still pretty straight forward but gets a little fuzzy depending on whether you want your x and y coordinates in relative (curve) space or global space. Same consideration for orientation and alignment.

Assuming the start of your curve is (0,0), you can use Curve.PointAtParameter to get a point located on your curve at a specific parameter location. Keep in mind a parameter in this context is a relative value between 0 and 1, so you will have to do some arithmetic to move between global coordinates and relative parameter, but the result will be a point in space that you can pull coordinate values from.

DynamoSandbox_2025-12-11_10-42-42

1 Like

Alternately use plane intersects to get the Y value at X

5 Likes

an alternative with scipy

Here is an example of interpolating a point from an abacus curve.

import sys
import clr
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry as DS
from Autodesk.DesignScript.Geometry import *

import scipy
from scipy.interpolate import interp1d
import numpy as np

curve = IN[0]
x_new = IN[1]

pts = [curve.PointAtParameter(i) for i in np.linspace(0, 1, 30)]
data = [[float(p.X), float(p.Y)] for p in pts]
x, y = [i for i in zip(*data)]

f_cubic = interp1d(x, y, kind='cubic', fill_value="extrapolate")
#
y_interpolate = f_cubic(x_new)

OUT = DS.Point.ByCoordinates(x_new, float(y_interpolate), 0)
2 Likes

Using planes is a good way to work with the global axes without having to convert anything relative to the curve’s geometry. Nice.

1 Like