Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

3D Graphics: software for visualizing 3D vectors?

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.

like image 749
David Wolever Avatar asked Sep 03 '10 22:09

David Wolever


2 Answers

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

alt text

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)
like image 66
tom10 Avatar answered Oct 18 '22 03:10

tom10


I don't know if this would be easier than Grapher.app or gnuplot, but you could write your own 3D graphics program that just plots the vectors.

Here's an example in OpenGL that draws the X, Y, and Z axis vectors.

Update: Here's a Java applet specifically focused on helping you visualize the vectors in camera transformations. Note the installation instructions: you have to install Java 3D.

Description: The Perspective Camera Parameters applet aims to familiarize students with the various parameter associated with a synthetic, perspective-projection camera. Users can adjust any of the following parameters: field-of-view width, field-of-view height, near clipping plane distance, far clipping plane distance, up vector, and look vector. The viewing frustum is visualized in a window, allowing students to understand how the parameters relate to the shape of the viewing frustum.

The same site has many components, such as axes, that you can use to set up a simple applet showing just the vectors you want.

like image 29
LarsH Avatar answered Oct 18 '22 03:10

LarsH