Painless way to do 3D visualization

P

Peter Beattie

Hey folks,

I need to do the following relatively simple 3D programming:

I want to convert data from four-item tuples into 3D co-ordinates in a
regular tetrahedron. Co-ordinates come in sequences of 10 to 20, and the
individual dots in the tetrahedron need to be connected into
discontinuous lines. A single tetrahedron should contain at least two,
possibly more, such lines. I would like to show certain similarities in
the sequences/lines, eg by changing color, thickness, or maybe attaching
indeces to certain points in a particular sequence.

I'd welcome suggestions as to what might be the most painless way to
achieve this in Python. So far, I've only tinkered a little with
VPython, but the lack of any decent documentation has proved to be a
major turn-off.

TIA!
 
R

Ron Adam

Peter said:
Hey folks,

I need to do the following relatively simple 3D programming:

I want to convert data from four-item tuples into 3D co-ordinates in a
regular tetrahedron. Co-ordinates come in sequences of 10 to 20, and the
individual dots in the tetrahedron need to be connected into
discontinuous lines. A single tetrahedron should contain at least two,
possibly more, such lines. I would like to show certain similarities in
the sequences/lines, eg by changing color, thickness, or maybe attaching
indeces to certain points in a particular sequence.

I'd welcome suggestions as to what might be the most painless way to
achieve this in Python. So far, I've only tinkered a little with
VPython, but the lack of any decent documentation has proved to be a
major turn-off.

TIA!

What exactly are the four-items in the tuples?


I think this is what you need along with an example...


http://www.vpython.org/webdoc/visual/curve.html




from visual import *

# a simple polygon

points = [(0,0,0),(0,1,0),(1,1,0),(1,0,0),(0,0,0)]
curve(pos=points, color=color.red)


# a polygon as separate segments grouped together in a frame.

square2 = frame()
points = [(0,0,1),(0,1,1),(1,1,1),(1,0,1),(0,0,1)]
for i in xrange(len(points)-1):
curve(frame=square2, pos=[points,points[i+1]], color=color.blue)
square2.objects[2].color = color.green # change a line segments color
square2.objects[2].radius = .02 # change a line segments thickness


# looking at objects after they are made.
print square2
print dir(square2)
print square2.objects
print dir(square2.objects[0])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top