curve simplification script (2.5)

I have written a script to simplify curves.

It takes curves as inputs and generates new ones with fewer points.

It has two different modes.
The first (distance) is rather simple, while the second (curvature)
tries to keep the points with the highest curvature.

I guess it depends on the input-curve which mode delivers better results.

The fastest way to test it is to draw something with grease pencil,
convert that into a curve and then simplify it.

tests and suggestions are highly welcome.

one thing are you talking about the main points or intermediary points ?

i mean if you convert a curve to mesh you all the main and intermediry points
function of defresol

so is this what your talking or not ?


This has nothing to do with meshes.
The script works on the selected/active Curve
and produces a new simplified version. (also a curve).
If you convert a curve to a mesh you can control the intermediary points with the curve’s resolution setting.

Hello, thanks for this script, I guess I will try to make a similar one for animation curves, since the cleaning function which is there default is quite silly…

nice, someone noticed this.

It should be fairly easy to convert this to use on fCurves.
The simplification functions should work right out of the box, more or less i think.
Because it shouldn’t matter if the points are only 2D.

where do we find the paenl for this after running it?

T panel or N panel or somewhere else !

and do we select one curve then press one button to simplify the curve ?

can you give example before and after running to see the effect and get an idea what it does !


Hello, this is the updated script, the functions work great, however I am not able to do it so that the operator can be re-run, and the precision is set by default to a too low level. Thanks again for the implementation of the functions…
but as it is, it will help me a lot anyway.

Ricky blender - just select a curve, run the op and see the ‘last operator’ area…?

i have briefly looked over it. looks good :slight_smile:

If it’s ok with you i put your stuff in the script that is already in contrib.

You have added a test for 3 points on a line in the altitude function?
and i believe it has to be radians, not degrees. But i am not sure now. Haven’t tested, and if it works,…
who am i to complain :wink:

ah! you are so quick to reply.
and there was a bad bug in the op :slight_smile:
now it works as it should - with distance and curvature mode, with correct precision :slight_smile:
and yes, you are the right person to complain, your coding style is much cleaner than mine :wink: this pasteall version doesn’t have the radians there yet. And of course, use the script anyhow, I just hacked over your script :wink:

ok where do you find this last operator area ?
if that’s bottom area of tool panel then i don’t have anything!

i tried with a curve and did not see any changes!

can you show a pic of before and after
or may mkle a short videos on how it works !

also can this work with poly lines instead of bezier?

i check many panels and cannot find this new panel
i got 908 can it work with this version ?

Thabks and happy 2.5

great script again,
it works really well & is very useful.
Basically the script smooths the original curve so it’s nicer to view & work with.
some steps,
Activate the script in addons.
Create a Curve.
In Edit Mode, add some more points to the curve.
(hold Ctrl & Left Click to add more points)
Make it messy. :wink:
Go back to Object Mode.
In the Toolbar Menu,
Search for ‘Simplify’ ( you get it after ‘sim’ :wink: )
Press the Simplify Curves Button.
The script creates a duplicate of your curve & creates a menu with some settings.
The new curve object is a better, smoother, more consistent curve.

Meta Androcto - if you have an object with animation data, especially recorded animation data, try the “simpilfy f-curves” operator :slight_smile:

pildanovak: i thought about what you did in the altitude function.
And i am sorry to report that it makes no sense.
Your edglelength test is true if and only if all three points have exactly the same
In case of fcurves i believe this can never happen?
For 3d curves this may be true and i must confess that i am not sure what happens then,
but my guess is that it returns simply an altitude of 0 in that case, which would be fine.

ok i got this morning the 29061 built

seem to be working now

in insruction to get it to work

forgot to mention that you need to click on the name at the top so it runs after dong the search in search field in tool panel!

i’ll experiment with this

Thanks & happy 2.5

testscreenings - actually the angle function returns error if any of the 2 vectors is 0, so it cancels the script and makes it not work in such cases. Something like remove doubles would work too I suppose.
For the f-curves it actually can happen, if automerge of keyframes is off.

if edge1.length>0 and edge2.length>0: # this means if both of the vectors are non 0 it runs the angle function, so also for only 2 points on same location it goes to the else statement. But It was just a quick hack to make it work, I had an example curve where that happened(from greasepencil, there it can happen I gues quite often), and the script worked ok after that, although it probably didn’t remove those conflicting points correctly, because of ridiculous value for the angle - 180. This value I did put in because I supposed that in the case of a flat angle, one of the points gets removed.

by the way, I still wonder how well such short script works with the curves(both types), and it’s a really great feature :slight_smile: I did some animating overnight, using the recording feature, and the resulting curves behaved well after the simplification.

any planning to do this for a mesh line portion ?

like you select some points in a mesh in line and want to reduce it to a lower qty of points
but that would have to be in edit mode and not certain how you deal with faces here !

or you don’t do the faces and let it to the user to do it manually afterward may be !

i like the way it works when you increase the distance factor and see in viewport the results
of reducing the qty of points on curve

that’s very cool

happy 2.5

Thank you TestScreenings,

that’s really a great script. It is what I was looking for.
In particular, I am using it successfully with GreasePencil.
GreasePencil on Surface > Convert to Bezier Curve > SimplifyCurve > ConvertToMesh > Make Surface (with F).


in another thread here

soneone ask if it was possible to limit the resol per segment or portion of curve!

anyway that you can add an option to your script so that you can select the min max vertices on an existing curve then apply this algo to a portion of a curve only?


happy 2.5

i tried it and it’s doesn’t working, why?

Look the video:

drosah: I tried a little bit and it works for me. So please explain in which circumstance it doesn’t work exactly. The video is nice but as far as bug reports go not that helpful.