Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

**First time visiting? Here are some places to start:**

- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

# Most efficient way to turn a curve into a list of numbers?

Evan_Reese
Member Posts:

**500**PRO
This is for the Attractor Pattern feature. I want to add the ability for the user to draw a custom falloff curve for the pattern that will change the way the number range is distributed. Currently, the falloff is linear, as in the image on the right. I'd like to be able to draw an s-shaped spline on the top plane (or any arbitrary curve), and get the result on the left (which I've just faked here by using a different base surface). Since there are potentially so many instances, I'm looking for the most lightweight strategy to get these new numbers, while still giving the user full control over the curve shape. Anybody have any ideas about how to do it

My initial thought was to use raycast to find the xy coordinate at each point on the curve, which I think could work, but it can take a few seconds when the point count gets into the thousands. Does someone know a more efficient way?

*efficiently?*My initial thought was to use raycast to find the xy coordinate at each point on the curve, which I think could work, but it can take a few seconds when the point count gets into the thousands. Does someone know a more efficient way?

Evan Reese / Principal and Industrial Designer with Fractal

Website: fractalmade.com

Instagram: @evan.reese.designs

Website: fractalmade.com

Instagram: @evan.reese.designs

0

## Answers

1,018✭✭✭✭✭3,2633,263500PROWebsite: fractalmade.com

Instagram: @evan.reese.designs

1,018✭✭✭✭✭1,017✭✭✭✭500PROWebsite: fractalmade.com

Instagram: @evan.reese.designs

1,017✭✭✭✭Asymptotic decay

y = e^(-ax)

Exponential decay

y = 1-e^a(x-1)

Sinusoidal

y = .5(1+cos(πx))

Circular/elliptical

y = sqrt(1-x^2)

Parabolic

y = 1-ax^2

General polynomial

y = ax + bx^2 + cx^3...

500PROWebsite: fractalmade.com

Instagram: @evan.reese.designs

1,017✭✭✭✭500PROmebeing able to produce a certain result; it's about making this kind of patterning available to people who aren't comfortable with code and math, which is what I like about the custom sketch option, and some solid presets like sine, and gaussian.Website: fractalmade.com

Instagram: @evan.reese.designs

35PROhttps://sighack.com/post/easing-functions-in-processing

https://bitbucket.org/kluivers/jk-interpolation/src/master/JKInterpolationMath.m

500PROWebsite: fractalmade.com

Instagram: @evan.reese.designs