Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda