Curve interpolation algorithm

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
morevnaproject
Posts: 2
Joined: Sun May 26, 2024 8:17 am

Curve interpolation algorithm

Post 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!
User avatar
synthsin75
Posts: 10264
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Curve interpolation algorithm

Post by synthsin75 »

If memory serves, I believe it's cubic beziers, defined by 4 points.

Hayasidist knows all about that. Hopefully he chimes in.
User avatar
hayasidist
Posts: 3840
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Curve interpolation algorithm

Post 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
User avatar
SimplSam
Posts: 1218
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: Curve interpolation algorithm

Post 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.
Moho 14.3 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.3 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
morevnaproject
Posts: 2
Joined: Sun May 26, 2024 8:17 am

Re: Curve interpolation algorithm

Post by morevnaproject »

Awesome! Thank you so much for responding, everyone!
The information you provided helps a lot!
Post Reply