@Marcus: as you can see, *fitBspline* (green) produces a better result than *my version* (red). Moreover, it requires way too many controls. My original curve is 4 CVs, so I would expect a solution close to 4 CVs as well. You can see the difference b/w mine and the maya one on *fitting_curve1.jpg* and *fitting_curve2.jpg* (closeup) @Alok: the problem with what's exposed here is the same (I believe) as the one coming with the Graphics Gems solution. I didn't find an implementation, so I may be wrong, but seems that at no point the partial derivative is actually discussed. Instead, they just take *P1-P0* (in yellow on *fitting_curve3.jpg*) to be the tangent (from P0->Pn, with n input points), but the "*true*" tangent is different (in red on *fitting_curve3.jpg*). Of course, the algorithm has no idea of this true tangent, since all it gets is a vector of input points.
Hope it makes sense Thank you Le mardi 1 juin 2021 à 13:43:29 UTC-4, Marcus Ottosson a écrit : > Would it be possible to post the results you weren't happy with, along > with the results in Maya you thought gave better results? > > On Tue, 1 Jun 2021 at 14:24, Alok Gandhi <alok.ga...@gmail.com> wrote: > >> This might be a useful read maybe? >> https://raphlinus.github.io/curves/2021/03/11/bezier-fitting.html >> >> On Tue, Jun 1, 2021 at 6:20 PM vince touache <fruit...@gmail.com> wrote: >> >>> hello, >>> >>> I was looking for an algorithm to predict the best Bezier curve, given a >>> vector of points. I ended up implementing "An Algorithm for Automatically >>> Fitting Digitized Curves" from Graphics Gems vol.1, but I'm not 100% happy >>> with the result. >>> Out of curiosity, I compared it against the *fitBspline* node in Maya, >>> which seems to give a better result. >>> >>> Does anyone know what algorithm the *fitBspline *node is using >>> internally? And/or does anyone know other bezier curve fitting algorithms? >>> >>> TLDR: >>> what I don't like with the Graphics Gems approach is that it assumes the >>> tangent is the unit vector P1-P0 / ||P1-P0||, which is always wrong. Close >>> to be right, but not right. So I'd like something that can retrieve the >>> tangents more accurately >>> >>> Thank you >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to python_inside_m...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/7062536a-121b-4112-85da-24ebc99f8d3an%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/python_inside_maya/7062536a-121b-4112-85da-24ebc99f8d3an%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to python_inside_m...@googlegroups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMTx4yJjYMk4wDd6o3CwZ3PoHbaVAkc59xtp2m-P7zzu7A%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMTx4yJjYMk4wDd6o3CwZ3PoHbaVAkc59xtp2m-P7zzu7A%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8494aa36-8898-4ccb-be28-7801dff913cdn%40googlegroups.com.