1TDINIT(3NCARG) NCAR GRAPHICS TDINIT(3NCARG)
2
3
4
6 TDINIT - Initialization routine for TDPACK, called to define the
7 position of the eye, the position of the point looked at, which way is
8 up, and whether or not a stereo view is to be done.
9
11 CALL TDINIT (UMID, VMID, WMID, UORI, VORI, WORI, UTHI, VTHI, WTHI,
12 OTEP)
13
15 #include <ncarg/ncargC.h>
16
17 void c_tdinit(float umid, float vmid, float wmid, float uori, float
18 vori, float wori, float uthi, float vthi, float wthi, float otep)
19
21 This initialization routine is called to define the position of the
22 eye, the position of the point looked at, which way is up, and whether
23 or not a stereo view is to be done. TDINIT precomputes some quantities
24 in TDPACK common blocks that will subsequently be used in projecting
25 points from 3-space (U, V, and W coordinates) to 2-space (X and Y
26 coordinates).
27
28 By default (that is to say, if the internal parameter 'SET' has its
29 default value), TDINIT also calls the SPPS routine SET to define the
30 mapping from the "user" coordinate system (the X/Y system) to the
31 "fractional" coordinate system (in GKS terms, NDC space). This is done
32 in such a way as to show in the projection plane a field of view of
33 'FOV' degrees. The viewport to be used in the fractional coordinate
34 system is that defined by the values of the internal parameters 'VPL',
35 'VPR', 'VPB', and 'VPT'. In some situations, it may be desirable, after
36 calling TDINIT, to call the SPPS routine GETSET to retrieve the
37 arguments with which TDINIT called SET and then recall SET with a
38 different set of arguments.
39
40 Normally, the creation of an image with TDPACK starts with a call to
41 TDINIT (perhaps preceded by calls to TDSETI, TDSETR, and/or TDSTRS to
42 reset internal parameters of the package) and continues with calls to
43 draw objects. (Of course, if all of the arguments in a call to TDINIT
44 have the same values as in the last call and the SET call that was done
45 as a result is still in effect, then it's not necessary to repeat the
46 call to TDINIT.)
47
48 For stereo views, one calls TDINIT with a negative OTEP, executes the
49 object-drawing calls, calls TDINIT again with a positive OTEP, and then
50 repeats all of the object-drawing calls. The exact way in which stereo
51 views are drawn is also affected (slightly) by the value of the
52 internal parameter 'STE'.
53
54 The arguments of TDINIT are as follows:
55
56 UMID, VMID, and WMID
57 (input expressions of type REAL) - the coordinates of a point,
58 E, at the eye position (if a single view is being drawn), or of
59 a point midway between the two eyes (if a stereo view is being
60 drawn).
61
62 UORI, VORI, and WORI
63 (input expressions of type REAL) - the coordinates of a point,
64 O, that the eye is looking at. That point defines the origin
65 of the XY projection plane. The line of sight is the line from
66 E to O. The projection plane passes through O and is
67 perpendicular to the line of sight.
68
69 UTHI, VTHI, and WTHI
70 (input expressions of type REAL) - the coordinates of a third
71 point, T, needed to completely specify the orientation of the X
72 and Y axes in the projection plane. The Y axis of the
73 projection plane is its intersection with the plane passing
74 though the points E, O, and T. The X axis of the projection
75 plane passes through the point O and is perpendicular to the Y
76 axis.
77
78 OTEP (an input expression of type REAL) - set non-zero if and only
79 if a stereo view is to be drawn. Make the value negative to
80 draw a left-eye view, positive to draw a right-eye view. The
81 magnitude of OTEP is the distance from either eye to the point
82 midway between the eyes; if R represents the approximate
83 distance from the eye to the objects being drawn, then OTEP may
84 be set using a statement like
85
86 OTEP = (+ or -) R *
87 TAN(.017453292519943*ANGD/2.)
88
89 where the constant (.01745...) is just pi/180 and ANGD is the
90 desired difference in the angle between the two views, in
91 degrees; use a value of about 1 or 2 degrees for ANGD.
92
93 Note that, if the origin is approximately in the middle of the
94 objects being viewed, then it's probably appropriate to use a
95 value of R computed as follows:
96
97 R = SQRT((UMID-UORI)**2
98 (VMID-VORI)**2+
99 (WMID-WORI)**2)
100
102 The C-binding argument descriptions are the same as the FORTRAN
103 argument descriptions.
104
106 To use TDINIT or c_tdinit, load the NCAR Graphics libraries ncarg,
107 ncarg_gks, and ncarg_c, preferably in that order.
108
110 Online: tdclrs, tdctri, tddtri, tdgeti, tdgetr, tdgrds, tdgrid, tdgtrs,
111 tditri, tdlbla, tdlbls, tdline, tdlnpa, tdmtri, tdotri, tdpack,
112 tdpack_params, tdpara, tdplch, tdprpa, tdprpi, tdprpt, tdseti, tdsetr,
113 tdsort, tdstri, tdstrs
114
116 Copyright (C) 1987-2009
117 University Corporation for Atmospheric Research
118 The use of this Software is governed by a License Agreement.
119
120
121
122UNIX July 1997 TDINIT(3NCARG)