I've continued to translate into C++ the old cam-experiments I wrote in C#. The kd-tree search for which triangles lie under the cutter seems to work, and the best way to visualize what is going on is through a video. Trying Vimeo for a change, to see if it's any better than youtube for these CAD/CAM-visualizations, since they advertise HD.
There are 360 original frames captured from VTK, and the original was created with
mogrify -format jpg -quality 97 *.png
followed by (copy/pasted from some site google found for me...)
mencoder mf://*.jpg -mf fps=25:type=jpg -aspect 16:9 -of lavf -ovc lavc -lavcopts aglobal=1:vglobal=1:coder=0:vcodec=mpeg4:vbitrate=4500 -vf scale=1280:720 -ofps 30000/1001 -o OUTPUT3.mp4
If anyone knows something better which produces nice results on youtube or vimeo, let me know.
The original is 1280x720 pixels, so it's better to jump out of the blog to watch the videos in native resolution.
OK, so the video doesn't really show what is going on with the kd-tree search at all 🙂 . It only shows two toolpaths, one coloured in many colours which is calculated without the kd-tree, and another one (offset upwards for clarity) that is calculated, much faster, using the kd-tree.