Tag Archives: python

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 [...]

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 [...]

More pystones with shedskin

As I’m very much an amateur programmer with not too much time to learn new stuff I’ve decided my CAM-algorithms are going to be written in Python (don’t hold your breath, they’ll be online when they’ll be online…). The benefits of rapid development will more than outweigh the performance issues of Python at this stage. [...]

multiprocessing pystone benchmark

A simple pystone benchmark using the python multiprocessing package. Seems to scale quite well – guess how many cores my machine has! ” Simple multiprocessing test.pystones benchmark ” ” Anders Wallin 2008Jun15 anders.e.e.wallin (at) gmail.com ” from test import pystone import processing import time STONES_PER_PROCESS= 10*pystone.LOOPS def f(q): t=pystone.pystones(STONES_PER_PROCESS) q.put(t,block=True) if __name__ == ‘__main__’: print [...]