Spheres and Ellipsoids
Spheres and Ellipsoids
Spheres and, more generally, ellipsoids, can be used in Partiview to represent structural elements, coordinate systems, and even planes and lines (we'll explain). The ellipsoid data command is somewhat complicated for two reasons: one is the fact that the parameters to define an ellipsoid are complex, another is that there exists both a Data and Control version of the command. However, we expect that by the end of this section, you will have a good knowledge of the ellipsoid command.
Data Command versus Control Command
As you might expect, the ellipsoid Data Command defines the parameters of the ellipsoid while the ellipsoid Control Command controls whether it is drawn or not. These two commands take these forms in the Partiview Command Line:
control command: ellipsoid [on|off](In a data file, the control command would be prefaced by the eval command and the data command would appear without the add preface.)
data command: add xcen ycen zcen ellipsoid -r xrad[,yrad,zrad] [-c colorindex] [-s style] [-n numlong,numlat] [transformation data]
The Control Command is fairly self-explanatory. If an ellipsoid has been defined for a particular data group, using ellipsoid on or ellipsoid off will turn the object on or off (assuming the data group for which it is defined is the active data group). As for defining the parameters of an ellipsoid, you'll use the Data Command for that.
Drawing an Ellipsoid
An ellipsoid is defined by its center point and its radii in the x, y, z directions. Start up the Test Data and define a new data group
g2=ellipsoid
Now, let's draw a simple ellipsoid centered on (0, 0, 0) with radii of (xrad, yrad, zrad )= (5, 10, 15).
add 0 0 0 ellipsoid -r 5,10,15
This has caused the screen to go gray. If you pull away from the data, you will see that a white, solid ellipsoid has been drawn (increase the center size to see the proper perspective). This is not really what we want though. The default style is solid, we want to change that to wire so that we can see the entire ellipsoid. Also, let's change a few other attributes.
Define another group and let's set ellipsoid colorindex to 5, its style to wire, and the number of latitude and longitude lines to 30. The command looks like:
add 0 0 0 ellipsoid -r 5,10,15 -c 5 -s wire -n 30This results in a somewhat odd looking object, but we now see the wire-frame ellipsoid.
The style argument can either be solid, plane, wire, or point. Define another group and issue the above ellipsoid command trying these styles. (Just define a new group in the Command Line, then hit the up arrow key to scroll up to the ellipsoid command, where you can use the arrow keys to edit the line.)
If you try these other styles (plane, point), you will find that plane draws three ellipses in the x = 0, y = 0, and z = 0 planes. The point style draws points at each vertex. These can often be difficult to see though. You should change the alpha value to 1 and choose a color that will stand out, like yellow. If you've already defined your ellipsoid using the colorindex of 5, simply change the color for that colorindex using the cment command. cment 5 1 1 0 will change it to yellow. It also helps to have a lot of vertices, so numlat and numlong should be large.
Drawing a Sphere
To draw a sphere, you simply want the three radii for the ellipsoid to be equal. If you supply only one radius, the other two will be set equal to it. For example
add 0 0 0 ellipsoid -r 10 -c 5 -s wire -n 30will draw a sphere of radius 10. If we want to use a sphere for mapping coordinates, then it's useful to draw lines of latitude and longitude at intervals that make sense. To draw lines at 10o intervals, the number of longitude lines would be 36, while the number of latitude lines would be 19. You probably were expecting 36 for a 360o, but where does 19 come from? For the lines of latitude, you must take into account the two poles. If you wanted lines every 15 degrees, then you would use the option -n 24,13.
Drawing a 2-D plane
Using the ellipsoid command, you can actually draw a circular, two-dimensional plane. This can be done by setting one of the radii to zero. For example, re-start Partiview with the Test Data. Now, let's draw an ellipse in the xy plane out to 1 unit of distance. Turn off the labels, then run this command
add 0 0 0 ellipsoid -r 1,1,0 -c 16 -s wire -n 36
You may want to adjust the alpha level so that the plane is more subtle. Unfortunately, the grid lines are not as useful as they would be if they were evenly spaced. However, this can be useful for demonstration purposes.
Drawing a Line
Finally, if we set two radii to zero, we get a line. Turn off the plane by typing
ellipsoid offin the Command Line. Now, let's draw lines from point to point. First, try to draw a line from (x, y, z) = (1, 1, 1) to (1, 1, 0). This would put the center at (x, y, z) = (1, 1, 0.5) and the zrad at 0.5 (halfway between 0 and 1). Let's try it.
add 1 1 0.5 ellipsoid -r 0,0,0.5 -c 10 -s wire -n 30
The unfortunate thing is that lines cannot be drawn off plane. They can, however, be drawn then transformed using the tfm command. However, this is not a viable solution for line drawing in Partiview. It makes more sense to draw lines using the mesh command which we discuss later in this chapter.
© 2002-2005 American Museum of Natural History
Last Modified: 2006-04-28 by Brian Abbott
