I'm trying to teach myself about 3D graphics, but I'm having trouble visualizing the 3D vectors involved.
Is there any good software that I can use to visualize 3D vectors?
For example, right now I'm learning about camera transformations, and it would be nice if I could easily plot the right/up/look/eye vectors.
I've tried Grapher.app and gnuplot, but it's very difficult to enter points into Grapher.app and gnuplot doesn't seem to be able to lock the aspect ratio.
解决方案
Visual Python is a super easy library for 3D visualization.
For example, to show a sphere and arrow:
import time, math, visual
ball = visual.sphere(pos=(0,2,0), radius=1, color=visual.color.red)
vect = visual.arrow(pos=(2,0,0), axis=(2 ,2,-2))
visual.scene.forward = (.1, -.3, -1) # controls the camera view angle
This window now also has all of the normal mouse interactivity, such as zooming and camera (i.e. viewing angle) rotation.
VPython is also easy to animate. For example, the following will rotate the arrow:
da = 2*math.pi/100
for timestep in range(100):
angle = timestep*da
vect.axis = (2+2*math.sin(angle), 2*math.cos(angle), -2)
time.sleep(.1)