Page 1 of 1

Curve interpolation algorithm

Posted: Sun Aug 11, 2024 9:47 am
by morevnaproject
Hi everyone!
I am writing a python script to convert from Moho format to other vector software.
The script is already capable to extract points and convert simple shapes.
But I cannot figure out how Moho interpolates curve between points. Is there any documentation for this algorithm available?
Thanks in advance!

Re: Curve interpolation algorithm

Posted: Sun Aug 11, 2024 12:00 pm
by synthsin75
If memory serves, I believe it's cubic beziers, defined by 4 points.

Hayasidist knows all about that. Hopefully he chimes in.

Re: Curve interpolation algorithm

Posted: Sun Aug 11, 2024 1:10 pm
by hayasidist
yeah cubic bezier. Assuming you know what that is:

the actual Moho points are P0 and P3. You then need to derive P1 and P2 from the way Moho stores the "curvature" -- see https://mohoscripting.com/snippets/5

Re: Curve interpolation algorithm

Posted: Sun Aug 11, 2024 4:18 pm
by SimplSam
Also note: If you are reading the Moho JSON data - in some cases you may not get the true position of the points - if they are influenced by Bones, Actions, Smart Actions, Physics, Meshes or Curvers.

Re: Curve interpolation algorithm

Posted: Mon Aug 12, 2024 9:48 am
by morevnaproject
Awesome! Thank you so much for responding, everyone!
The information you provided helps a lot!