Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

244
Views
Draw curve -> Get equation

A part of the project I am working on requires an interface where a user draws a curve, and I want to output an approximate mathematical equation of that curve to perform a variety of tests on it.

I have thought of 2 approaches so far and was wondering if they are feasible or if there exists a better way of approaching the problem that I am missing/ cool mathematical trick that allows me to pull this off.

Approach 1:

Instead of having users draw a curve, give them the option of inserting bezier curve points and tweaking them to make their curve. Since bezier curves have a parametric equation that describes them, I could directly get the exact equation.

Cons: -It's more cumbersome for users to tweak and make a bezier than simply draw a curve

Approach 2:

Get the curve drawn and extract 'n' points. (I don't think this should be hard to do). Somehow go from these 'n' points to an equation of a curve passing through them. Naturally 'n' would be pretty large, say 100. Is there a neat way to get an equation for the "simplest continuous function" passing through 'n' points?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Approach 1 -- insert Bezier points and tweak control points -- is used in a lot of vector drawing programs, especially CAD-type applications where precision is important and points are laid out on a grid, etc. It is a slower way to draw, but it's used in these situations, because it's really difficult to draw a freehand curve carefully.

Approach 2 -- just draw and get an smooth approximation -- is also pretty popular when precision isn't required. I'm not sure what methods are usually used for this, or even if there is a "usually", but I don't think it's particularly difficult to do a pretty good job. I would:

  1. Connect all the points with line segments in the order in which they were drawn.
  2. Apply the Ramer-Douglas-Peucker algorithm to reduce the number of points.
  3. Interpolate the points with cubic spline interpolation. Be careful looking this up-there are many flavors of cubic spline interpolation and their names overlap. I would specifically prefer the versions that preserve 2nd derivative continuity.
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!