Placing Polygons on Points


Placing Polygons on Points

A polygon is a two dimensional surface. In Partiview, polygons can be used to pictorially represent different data types, emphasize a particular data attribute, like size or orientation, or even to build three dimensional objects. In this section, we will explore how to place polygons on points and alter their characteristics.

Let's first explore polygons by starting Partiview without any data pre-loaded. Once you have Partiview up, add a data point at the origin and set some parameters for that point, such as:

add 0 0 0
lum const 1
slum 1
color const 1 1 1
censize 0

With the Point of Interest axes off, you can see our lone white point (although it may be quite dim--you might need to move closer to see it). Now, let's turn on the polygons using the Polygon Toggle Button. Nothing happens. Why?

Sizing Polygons using polysize

First check the size of our polygons using the polysize command. Type

polysize
to see that Partiview reports zero. Let's try setting the size to 1:
polysize 1

Has the entire display gone gray? Perhaps this is too large, let's fly out a bit and find the edges of the polygon. (You may need to adjust your clipping planes.) Okay, now we can at least see the edges of the polygons, although it seems awfully large. How does the polygon size relate to our coordinate system?

Let's explore the size ratios to discover the scale for polygon size. First, let's change the number of sides the polygon has. If you issue the polysides command, without its integer argument, you will see that the default is 11. Let's change this to 4,

polysides 4
making it a square. Now, set the Point of Interest size to 1 and see how large the axes become relative to the polygon
censize 1

We see (if we fly away from the origin) that the unit distance is tiny relative to our polygon (recall if we set the center size to 1, the length of each axis from the origin is 1). With the lum const, slum and polysize all being equal to one, something must be creating this large size, or the poly size is just naturally larger than one.

Is the poly size an order of magnitude larger? Try

censize 10

This seems to work, so with the luminosity settings all equal to one, and the polygon size equal to one, the actual size of the polygon in our coordinate system seems to be 10 units of half-length. If our theory is true, we should be able to increase or decrease the lum const, slum, and/or the polysize by an order of magnitude to see if this relationship is true. Let's increase the lum by a factor of 10 and decrease the slum by a factor of 10.

slum 0.1
lum const 10

Does the size of the polygon stay the same relative to our center size? Yes. Also, try setting the lum const up and see if an increased center size matches:

lum const 1
slum 1
lum const 10
censize 100

Similarly, an order of magnitude increase in size with an order of magnitude increase in luminosity via the commands

polysize 0.1
censize 10
also scales properly. So, we now know the size of the polygon relative to the luminosity and luminosity scaling factor and can size the polygon according to this formula. Table 3.6 shows how the various elements affect the size of the polygon.

Table 3.6: Shown is the scaling relationship between lum const, slum, and polysize. In this table, the luminosity and its scaling factor are adjusted to keep polysize equal to 1. Of course, if the value of polysize were 0.1, then the actual size would decrease by a factor of ten and, similarly, if the value of polysize were 10, then the actual size would increase by a factor of ten.
polysize lum const slum Actual Size of Polygon
  1 1 10
  10 1 100
1 1 10 100
  10 10 1000
  1 100 1000

To have small polygons on data that are bright, then you would increase the lum and slum values and set the polysize to be very small. To have large polygons on data that have low lum and slum values, you would want to increase their polysize.

Sizing Polygons According to a Data Variable

In addition to setting the polygon size explicitly using the polysize command, you may also assign a column in your data to represent the polygon size. This is accomplished using the polylumvar command. If you type

polylum

Partiview will report polylumvar point-size, meaning the size of the polygon is being set according to the luminosity of the particles (as we discussed above). However, you can set the size of the polygon to scale from some data variable by specifying the datavar name. So, for example, if you start the Sample Data set and turn the textures off so that you have a view of the square polygons, you can set the size of these polygons based on a column in the data file. Let's get a report of the defined data variables in the file by typing

datavar

Since the coloridx seems like a reasonable range (1-10), we will change the polygon size to scale to these values with the command

polylum coloridx
This increases the size of the polygons, each one sized according the the value of the coloridx data variable. Fly out of the data set to see all of the various sizes that belong to each color (it might help to turn off the textures using the Texture Toggle Button and to increase the slum value). Now the polygon size depends on the color, rather than the distance from each point. So, you may find a large white polygon and a small purple polygon at similar distances, but their polygon size is different. Type
polylum point-size
to return to sizing by distance.

Setting the Properties of the Polygon

Use the polysides command to set the number of sides a polygon is drawn with. The default value is 11, which draws round-ish polygons. However, the most computationally efficient polygon shape to draw textures on is a square; therefore, if you're drawing textures on your polygons, use polysides 4 if appropriate. Values for the number of sides on a polygon range from 3 (triangle) up to 16 (sometimes called a hexadecagon).

The Opaqueness of the Polygon

The opaqueness of the polygon can be set using the alpha command. alpha takes on values between 0 and 1 with a default of 0.5. A value of 0 corresponds to zero opaqueness (complete transparency or invisibility) and a value of 1 corresponds to a polygon that is completely opaque. A value of 0.999 will make the polygon quite bright without making it fully opaque, blocking your view of everything behind it. Try setting alpha to 0.2 to see more transparent polygons.

The polyminpixels Command

The polyminpixels command allows you to set limiting sizes that restrict the size of a polygon or determine when the polygon should be drawn. The minpixels argument sets the minimum size in pixels that a polygon must be before it is drawn. The maxpixels argument sets a clamp on the size of the polygon so that increasing the luminosity beyond this threshold will not increase the size of the polygon.

Setting the Polygon Orientation

By default, polygons face the screen at all times; however, you can fix their orientation in space if that is desired. This is useful when texturing polygons that represent a fixed object.

The polygon orientation is specified in the data file as a series of 6 numbers that describe two orthogonal vectors, $ ec{{u}} $ and $ ec{{v}} $, in the plane of the polygon. The first of these 6 columns is defined in a datavar command and the orientation is set using the polyorivar command. A typical data file might look like:

datavar 0 lumin
datavar 1 color
datavar 2 txnum
datavar 3 orient
texturevar txnum
polyorivar 3
0 0 0 10 2 1 1 2 0 -2 1 0
1 1 1 40 1 1 1 0 1 0 1 0

where the first three columns are x, y, z, the fourth is the luminosity, the fifth is the color index, the sixth is the texture number, and finally columns 7-12 are the 6 numbers that make up the orientation of the polygon. Notice how the datavar and polyorivar commands are used to define the orientation information. Some sample orientations are shown in Table 3.7.

Table 3.7: Examples of the $ ec{{u}} $ and $ ec{{v}} $ vectors that determine the polygon orientation.
ux uy uz vx vy vz Polygon Orientation
1 0 0 0 1 0 xy plane
1 0 0 0 0 1 xz plane
0 1 0 0 0 1 yz plane
0 1 0 0 0 10 yz plane with Rz = 10 x Ry
1 0 1 0 1 0 rotated about y axis by 45o
1 2 0 -2 1 0 rotated square about the z axis
9 9 9 9 9 9 Polygons are always facing the screen

If you wish to have a mixture of screen-facing polygons along with specific orientations within one data set, you may use all 9s to specify that you want a particular polygon to be screen-facing.

You may also toggle between screen-facing and specified orientations using the polyorivar command at the Command Line. If you type

polyorivar -1

this toggles to all polygons facing the viewer. You may go back to your orientations by using the datavar number specified in the data file. Using our example above, you would type:

polyorivar 3

If you specify any number other than -1, Partiview will assume the orientation information begins at that column. For example, if you entered polylumvar 0 the orientation of the polygon will be determined by columns 4-9, whether the data are relevant or not.

© 2002-2005 American Museum of Natural History
Last Modified: 2006-04-28 by Brian Abbott