next up previous contents index
Next: The Output Attributes Up: GKS-3D Primer Previous: Introduction to GKS-3D

The Drawing Primitives

With one addition, GKS-3D supports the same GKS primitive types as described in chapter on Page gif. Four of the functions are called in a similar way to that for GKS-2D, but with the addition of a third coordinate:

Polyline 3D
CALL GPL3(N, PXA, PYA, PZA)
Polymarker 3D
CALL GPM3(N, PXA, PYA, PZA)
Fill Area 3D
CALL GFA3(N, PXA, PYA, PZA)
GDP 3D
CALL GGDP3(N, PXA, PYA, PZA, PRIMID, IDR, DATREC)

However, the 3D routines for Cell Array (GCA3) and Text (GTX3) have calling sequences which are substantially changed. GCA3 is not described here, and those brave enough to peruse the standards document will see why. Concerning GTX3, it should be emphasized that this function is only required if it is desired to place text on a surface which is not parallel to the X-Y plane, otherwise the 2D text function (GTX) is sufficient. For example, one would need to use GTX3 to write 'MIGROS' on the side of a truck drawn with some random orientation.

The function call for 3D Text is:

CALL GTX3(PX, PY, PZ, TDX, TDY, TDZ, STR)
where the arguments are as follows:
PX, PY, PZ
Reference Point (start point of text string)
TDX/Y/Z(2)
Two Text Direction vectors (three real arrays of length 2).
STR
The character string to be output.
For both GTX and GTX3 the character string, STR, is drawn in a plane. The difference is that in the 3D case this text plane can be oriented in space using two text direction vectors, U and V, specified by TDX(1), TDY(1), TDZ(1), and TDX(2), TDY(2), TDZ(2). The text is drawn in a plane perpendicular to the vector formed from taking the vector product U x V, and the origin of the local coordinate system in which the geometric text attributes are measured is defined by the reference point, P. The X axis of the local text coordinate system is parallel to the first direction vector, U, and the Y axis is perpendicular to this direction. Thus, the system reduces to the 2D case if U and V are defined as (1, 0, 0) and (0, 1, 0). An example program using 3D Text is given in Appendix on Page gif.

The additional primitive, called Fill Area Set (or Fill Area Set 3), generates a set of polygonal areas which may be hollow or filled with a uniform colour, pattern, or hatch style. Thus, it allows the application to specify regions with holes, or disjoint regions which must be treated as a single entity. There are both 2D and 3D versions of Fill Area Set, and the 2D function will be added to the next revision of GKS. Unlike the Fill Area primitive, Fill Area Set and Fill Area Set 3 have separate attributes, described below, to control the edge style of the polygons. The calls are:

CALL GFAS(NPTR, PTR, PX, PY)
 
CALL GFAS3(NPTR, PTR, PX, PY, PZ)
where the arguments are as follows:
NPTR
(integer) Number of fill areas in set
PTR(NPTR)
(integer) Array of pointers to starting elements of lists in PX(N), PY(N), PZ(N). Total number of coordinates is PTR(NPTR)-1.
XA/YA/ZA(*)
(real) List of points for all fill areas of the set.
Thus, all the polygons are packed into the arrays, XA(N), YA(N), ZA(N), and the start point of each polygon is indicated by the pointers in the array PTR(NPTR).

Although they are specified in a 3D space, the primitives Text, Cell Array, Fill Area, and Fill Area Set are all coplanar. It is the responsibility of the application program to ensure that the coordinates supplied fulfil this condition. What happens if they are not coplanar is implementation-dependent!


next up previous contents index
Next: The Output Attributes Up: GKS-3D Primer Previous: Introduction to GKS-3D


Janne Saarela
Mon Apr 3 17:00:12 METDST 1995