IDLgrPolygon

A polygon object represents one or more polygons that share a given set of vertices and rendering attributes. All polygons must be convex--that is, a line connecting any pair of vertices on the polygon cannot fall outside the polygon. Concave polygons can be converted to a set of convex polygons using the IDLgrTessellator object.

An IDLgrPolygon object is an atomic graphic object ; it is one of the basic drawable elements of the IDL Object Graphics system, and it is not a container for other objects.

Superclasses

This class has no superclasses.

Subclasses

This class has no subclasses.

Creation

See IDLgrPolygon::Init

Methods

Intrinsic Methods

This class has the following methods:

 

 

 

 


IDLgrPolygon::Cleanup

The IDLgrPolygon:: Cleanup procedure method performs all cleanup on the object. IDLgrPolygon is described above.

Calling Sequence

OBJ_DESTROY, Obj

or

Obj -> [IDLgrPolygon::] Cleanup                               ( In a subclass' Cleanup method only .)

Arguments

There are no arguments for this method.

Keywords

There are no keywords for this method.


IDLgrPolygon::GetCTM

The IDLgrPolygon:: GetCTM function method returns the 4 x 4 graphics transform matrix from the current object upward through the graphics tree. IDLgrPolygon is described above.

Calling Sequence

Result = Obj -> [IDLgrPolygon::] GetCTM()

Arguments

There are no arguments for this method.

Keywords

DESTINATION

Set this keyword to the object reference of a destination object to specify that the projection matrix for the View object in the current tree be included in the returned transformation matrix. The resulting matrix will transform a point in the data space of the object on which the GetCTM method is called into a normalized coordinate system (-1 to +1 in X, Y, and Z), relative to the View object that contains the polygon object.

TOP

Set this keyword equal to the object reference to an IDLgrModel object to specify that the returned matrix accumulate from the object on which the GetCTM method is called up to and including the specified model object.


IDLgrPolygon::GetProperty

The IDLgrPolygon:: GetProperty procedure method retrieves the value of the property or group of properties for the polygons. IDLgrPolygon is described above.

Calling Sequence

Obj -> [IDLgrPolygon::] GetProperty

Arguments

There are no arguments for this methods.

Keywords

Any keyword to IDLgrPolygon::Init

ALL

Set this keyword to a named variable that will contain an anonymous structure containing the values of all of the properties associated with the state of this object. State information about the object includes things like color, range, tick direction, etc., but not image, vertex, or connectivity data, or user values.

PARENT

Set this keyword equal to a named variable that will contain an object reference to the object that contains this object.

XRANGE

Set this keyword equal to a named variable that will contain a two-element vector of the form [ xmin , xmax ] that specifies the range of x data coordinates covered by the graphic object.

YRANGE

Set this keyword equal to a named variable that will contain a two-element vector of the form [ ymin , ymax ] that specifies the range of y data coordinates covered by the graphic object.

ZRANGE

Set this keyword equal to a named variable that will contain a two-element vector of the form [ zmin , zmax ] that specifies the range of z data coordinates covered by the graphic object.


IDLgrPolygon::Init

The IDLgrPolygon:: Init function method initializes the polygons object. IDLgrPolygon is described above.

Calling Sequence

Obj = OBJ_NEW('IDLgrPolygon' [, X [ , Y[ , Z]]] )

or

Result = Obj -> [IDLgrPolygon::] Init( [X, [Y, [Z]]] )         ( In a subclass' Init method only .)

Arguments

X

A vector argument providing the X coordinates of the vertices. The vector must contain at least three elements. If the Y and Z arguments are not provided, X must be an array of either two or three vectors (i.e., [2,*] or [3,*]), in which case, X [0,*] specifies the X values, X [1,*] specifies the Y values, and X [2,*] specifies the Z values.

Y

A vector providing the Y components of the vertices. The vector must contain at least three elements.

Z

A vector providing the Z components of the vertices. The vector must contain at least three elements.

Keywords

Properties retrievable via IDLgrPolygon::GetProperty

BOTTOM (Get, Set)

Set this keyword to an RGB or Indexed color for drawing the backs of the polygons. (The back of a polygon is the side opposite the normal direction). Setting a bottom color is only supported when the destination device uses RGB color mode.

COLOR (Get, Set)

Set this keyword to an RGB or Indexed color for drawing polygons. The default color is [255, 255, 255] (white). If the TEXTURE_MAP property is used, the final color is modulated by the texture map pixel values. This keyword is ignored if the VERT_COLORS keyword is provided.

DATA (Get, Set)

Set this keyword to a 2 x n or 3 x n array which defines, respectively, the 2D or 3D vertex data. DATA is equivalent to the optional arguments, X , Y , and Z .

FILL_PATTERN (Get, Set)

Set this keyword equal to an object reference to an IDLgrPattern object (or an array of IDLgrPattern objects) to specify the fill pattern to use for filling the polygons. By default, FILL_PATTERN is set to a null object reference, specifying a solid fill.

HIDDEN_LINES

Set this keyword to draw point and wireframe surfaces using hidden line (point) removal. By default, hidden line removal is disabled.

HIDE (Get, Set)

Set this keyword to a boolean value indicating whether this object should be drawn:

LINESTYLE (Get, Set)

Set this keyword to indicate the line style that should be used to draw the polygon. The value can be either an integer value specifying a pre-defined line style, or a two-element vector specifying a stippling pattern.

To use a pre-defined line style, set the LINESTYLE property equal to one of the following integer values:

To define your own stippling pattern, specify a two-element vector [ repeat , bitmask ], where repeat indicates the number of times consecutive runs of 1's or 0's in the bitmask should be repeated. (That is, if three consecutive 0's appear in the bitmask and the value of repeat is 2, then the line that is drawn will have six consecutive bits turned off.) The value of repeat must be in the range 1  £   repeat   £  255.

The bitmask indicates which pixels are drawn and which are not along the length of the line. Bitmask is most conveniently specified as a 16-bit hexadecimal value.

For example, LINESTYLE = [2, 'F0F0'X] describes a dashed line (8 bits on, 8 bits off, 8 bits on, 8 bits off).

NAME (Get, Set)

Set this keyword equal to a string containing the name associated with this object. The default is the null string, ' '.

NORMALS (Get, Set)

Set this keyword to a 3 x n array of unit polygon normals at each vertex. If this keyword is not set, vertex normals are computed by averaging shared polygon normals at each vertex. Normals are computed using the Right Hand Rule; that is, if the polygon is facing the viewer, vertices are taken in counterclockwise order. To remove previously specified normals, set NORMALS to a scalar.

POLYGONS (Get, Set)

Set this keyword to an array of polygon descriptions. A polygon description is an integer or longword array of the form: [ n , i 0 , i 1 , ..., i n-1 ], where n is the number of vertices that define the polygon, and i 0 ..i n -1 are indices into the X , Y , and Z arguments that represent the polygon vertices. To ignore an entry in the POLYGONS array, set the vertex count, n , to 0. To end the drawing list, even if additional array space is available, set n to -1. If this keyword is not specified, a single polygon will be generated.

REJECT (Get, Set)

Set this keyword to an integer value to reject polygons as being hidden depending on the orientation of their normals. Select from one of the following values:

Set this keyword to zero to draw all polygons regardless of the direction of their normals.

RESET_DATA (Set)

Set this keyword to treat the data provided via the DATA property as a new data set unique to this object, rather than overwriting data that is shared by other objects. There is no reason to use this keyword if the object on which the property is being set does not currently share data with another object (that is, if the SHARE_DATA property is not in use). This keyword has no effect if no new data is provided via the DATA property.

SHADE_RANGE (Get, Set)

Set this keyword to a two-element array that specifies the range of pixel values (color indices) to use for shading. The first element is the color index for the darkest pixel. The second element is the color index for the brightest pixel. The default is [0, 255]. This keyword is ignored when the polygons are drawn to a graphics destination that uses the RGB color model.

SHADING (Get, Set)

Set this keyword to an integer representing the type of shading to use:

Gouraud shading may be slower than flat shading, but results in a smoother appearance.

SHARE_DATA (Set)

Set this keyword to an object with which data is to be shared by this polygon(s). Polygons may only share data with another polygons object or a polyline. The SHARE_DATA property is intended for use when data values are not set via an argument to the object's Init method or by setting the object's DATA property.

STYLE (Get, Set)

Set this keyword to specify how the polygon should be drawn:

TEXTURE_COORD (Get, Set)

A 2 x n array containing the texture map coordinates for each of the n polygon vertices. Use this keyword in conjunction with the TEXTURE_MAP keyword to wrap images over 2D and 3D polygons. Default coordinates are not provided.

Texture coordinates are normalized. This means that the m x n image object specified via the TEXTURE_MAP property is mapped into the range [0.0, 0.0] to [1.0, 1.0]. If texture coordinates outside the range [0.0, 0.0] to [1.0, 1.0] are specified, the image object is tiled into the larger range.

For example, suppose the image object specified via TEXTURE_MAP is a 256 x 256 array, and we want to map the image into a square two units on each side. To completely fill the square with a single copy of the image:

TEXTURE_COORD = [[0,0], [1,0], [1,1], [0,1]]

To fill the square with four tiled copies of the image:

TEXTURE_COORD = [[0,0], [2,0], [2,2], [0,2]]

TEXTURE_INTERP (Get, Set)

Set this keyword to indicate that bilinear sampling is to be used for texture mapping an image onto the polygon(s). The default is nearest neighbor sampling.

TEXTURE_MAP (Get, Set)

Set this keyword to the object reference of an IDLgrImage object to be texture mapped onto the polygons. The tiling or mapping of the texture is defined expressly by TEXTURE_COORD. If this keyword is omitted, polygons are filled with the color specified by the COLOR or VERT_COLORS property. If both TEXTURE_MAP and COLORS or VERT_COLORS properties exist, the color of the texture is modulated by the base color of the object. (This means that for the clearest display of the texture image, the COLOR property should be set equal to [255,255,255].) To remove a texture map, set TEXTURE_MAP equal to a null object reference.

THICK (Get, Set)

Set this keyword to an integer value between 1 and 10, specifying the size of the points or the thickness of the lines to be drawn when STYLE is set to either 0 (Points) or 1 (Lines), in pixels. The default is one pixel.

VERT_COLORS (Get, Set)

Set this keyword to a vector of colors to be used to draw at each vertex. Color is interpolated between vertices if SHADING is set to 1 (Gouraud). If there are more vertices than elements in VERT_COLORS, the elements of VERT_COLORS are cyclically repeated. By default, the polygons are all drawn in the single color provided by the COLOR keyword. To remove vertex colors, set VERT_COLORS to a scalar.

XCOORD_CONV (Get, Set)

Set this keyword to a vector, [ s 0 , s 1 ], of scaling factors used to convert X coordinates from data units to normalized units. The formula for the conversion is as follows:

Normalized X = s 0 + s 1 * Data X

Recommended values are:

[(- X min )/( X max - X min ), 1/( X max - X min )]

The default is [0.0, 1.0].

YCOORD_CONV (Get, Set)

Set this keyword to a vector, [ s 0 , s 1 ], of scaling factors used to convert Y coordinates from data units to normalized units. The formula for the conversion is as follows:

Normalized Y = s 0 + s 1 * Data Y

Recommended values are:

[(- Y min )/( Y max - Y min ), 1/( Y max - Y min )]

The default is [0.0, 1.0].

ZCOORD_CONV (Get, Set)

Set this keyword to a vector, [ s 0 , s 1 ], of scaling factors used to convert Z coordinates from data units to normalized units. The formula for the conversion is as follows:

Normalized Z = s 0 + s 1 * Data Z

Recommended values are:

[(- Z min )/( Z max - Z min ), 1/( Z max - Z min )]

The default is [0.0, 1.0].


IDLgrPolygon::SetProperty

The IDLgrPolygon:: SetProperty procedure method sets the value of the property or group of properties for the polygons. IDLgrPolygon is described above.

Calling Sequence

Obj -> [IDLgrPolygon::] SetProperty

Arguments

There are no arguments for this method.

Keywords

Any keyword to IDLgrPolygon::Init