Skip to content

Tag Archives: vtk

Cutting down the octree

If you number the octants in an octree using a 1982 scheme called Gargantini-code, and store the codes for only the black nodes in the tree in a list then that's called a linear octree. For quadtrees, there is a 1985 paper by Bauer with an algorithm for computing set-operations (intersection, union, difference) between two [...]

Octree in python

Recursion and 'divide-and-conquer' must be two of the greatest ideas ever in computer science. Threw together some code in python today for building an octree, given a function isInside() which the tree-builder evaluates to see if a node is inside or outside of the object. Nodes completely outside the interesting volume(here a sphere, for simplicity) [...]

Offset ellipse, part 2

More on the offset-ellipse calculation, which is related to contacting toroidal cutters against edges(lines). An ellipse aligned with the x- and y-axes, with axes a and b can be given in parametric form asĀ (a*cos(theta) , b*sin(theta) ). The ellipse is shown as the dotted oval, in four different colours. Now the sin() and cos() are [...]

Kd-tree visualization

When vimeo has had time to process the video, this will show a visualization of the kd-tree search: http://vimeo.com/10241672 the code is probably still a bit buggy...

Drop-cutter again

This is about my third rewrite of this fairly simple cam-algorithm where the cutter is dropped from above until it touches a triangle. It's now in C++ with Boost-python bindings and with visualization using vtk. The cutter-location points are calculated by bringing the cutter into contact with the vertices of the triangle (green cl-points), the [...]

VTK test

Tried to make the code from last time a bit clearer by splitting it into two files: vtkscreen.py and test2.py conversion to video again by first converting PNG to JPEG: mogrify -format jpg -quality 97 *.png And then encoding JPEGs into a movie: mencoder mf://*.jpg -mf fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -ac copy -o output.avi [...]

Learning VTK

I'm trying to learn how to render and animate things using VTK. This is the result of a python-script which outputs a series of PNG-frames. These are then converted to jpegs by this command: mogrify -format jpg -quality 97 *.png mogrify -format jpg -quality 97 *.png and converted to a DIVX movie like this: mencoder [...]