How to simplify/optimize a 3d path?
algorithm, optimization, path
Solution
Check out Ramer-Douglas-Peucker algorithm
Problem
I have a bunch of points in 3d ( an array that contains objects with x,y,z properties ). My problem is that there are a lot of unnecessary points as illustrated in the image bellow: (source: lifesine.eu) How can I cleanup this path ? At the moment the first thing that comes to mind is to - create an array for the optimized path - loop though all the points starting with index 1 instead of 0, and get the 'direction' for the path. If the direction changes, add the last of the two points( the current, not the previous ) to the optimized array. The advantage is that the points are stored in a drawing order, so that makes them a path, not just random ( not sorted ) points. Note: I am using actionscript 3, but I can understand syntax in other languages or pseudo code. Thank you!