How fast (easy to script) 3D vectors / lines preview?
I am in the process of reading 3D models of buildings with a tool and thus creating a bunch of objects Line(p1, p2)
, each with two objects Point(x, y, z)
. I would like to show these things in a simple 3D viewer like SVG (which I understand only supports 2D).
Reading is done in Python, IronPython in particular. I could use the .NET viewer library, or write out the text / xml / whatnot file with the data to be displayed by manually opening the result in the appropriate program.
What format / tool did you use to view the data?
(For now, this is for debugging purposes only, so it doesn't have to be top-notch. Only a wired frame will do!)
I checked the mathplot library, but it only looks like functions ...
EDIT: I ended up going down the X3D path and wrote a small blog post on how to do it.Here is an example X3D wireframe file for a 1x1x1 cube:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN"
"http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile="Immersive" >
<Scene>
<Transform>
<Shape>
<LineSet vertexCount="5">
<Coordinate point="1 0 0
1 1 0
0 1 0
0 0 0
1 0 0"
/>
</LineSet>
</Shape>
<Shape>
<LineSet vertexCount="5">
<Coordinate point="1 0 1
1 1 1
0 1 1
0 0 1
1 0 1"
/>
</LineSet>
</Shape>
<Shape>
<LineSet vertexCount="5">
<Coordinate point="0 0 1
1 0 1
1 0 0
0 0 0
0 0 1"
/>
</LineSet>
</Shape>
<Shape>
<LineSet vertexCount="5">
<Coordinate point="0 1 1
1 1 1
1 1 0
0 1 0
0 1 1"
/>
</LineSet>
</Shape>
</Transform>
</Scene>
</X3D>
source to share
For the write-to-file approach, you can examine X3D , which is the successor to VRML. Also see this list of vector graphics markup languages
source to share
You can try PyQwt3D . If that doesn't work, here's a list of other python packages that might be helpful.
source to share
You can take a look at POV-Ray. These are rays that have their own textual language for describing the scene. IIRC, there is a python module that will generate scene files, if not, then it will not be difficult to do it manually. Displaying low-resolution line segments should be fairly fast.
Check it here: http://code.activestate.com/recipes/205451/
Also, python is a scripting language for Blender.
source to share