Some time ago, when I was investigating about octrees and voxels to create a true CNC simulator, I played a bit with Coin3d, the scene graph render of FreeCAD.
Coin3d is coded in C++, but can be accesed with Python using Pivy.
Coin3d is coded in C++, but can be accesed with Python using Pivy.
While I didn't find anything specially useful, I realized that one could easily plot math equations like this:
...which have a nice look and permit you to take curious snapshots, for example:
The code is:
from pivy import coin sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph() print sg for s in range(5): for n in range(-25,25): for i in range(-25,25): col = coin.SoBaseColor() col.rgb=(i*2,n*2,s*2) trans = coin.SoTranslation() # equation: z = f( i, n ) s is to plot at several heights trans.translation.setValue([i*2.5,n*2.5,(i/2.0)**2+(n/2.0)**2+s*5]) cub = coin.SoSphere() myCustomNode = coin.SoSeparator() myCustomNode.addChild(col) myCustomNode.addChild(trans) myCustomNode.addChild(cub) sg.addChild(myCustomNode)
More info about FreeCAD and Coin3D, here
Bye!