Weyert,
Martin wrote some nice routines to do this sort of thing back in 2002 --
I used them here in the OMSC thing (get zip of as file to see his code):
http://flash-creations.com/notes/astb_saveshapes.php
Helen
Martin Wood wrote:
you can also combine that with some curve smoothing
Once you have 3 points you can calculate the angle between the first
and the third and use a tolerance (some call it the 'breaking angle')
to determine if the middle point can be removed from the data set.
so one idea could be to use 1 distance threshold and 1 angle threshold
0 -> DT : very small distance, just remove the intermediate points.
> DT : check the change in angles of line sections and remove those
that are under AT (the breaking angle). This would get rid of straight
and nearly straight lines with multiple points.
of course you could expand on this and make AT inversely proportionate
to the distance between points, so that as the distance between points
increases you break at a smaller angle.
this could be done either as you store them or as a post processing step.
hope that gives you some ideas.
martin.
Hans Wichman wrote:
Hi,
how about doing this while storing them?
You know the last point stored, every time u get a mouse event and
are ready to store the next point, u calculate the distance from the
last point first, and only store the new point if the distance is
bigger than a certain value.
greetz
Hans
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders