Program: 3DPLOT
Purpose: View Set, subset in perspective
Category: PLOTTING
File: 3dplot.c
Author: M. Vogelaar
Keywords:
INSET= Give set (, subsets) to plot:
Maximum number of subsets is 2048.
BOX= Frame for input subsets. [entire subset]
GRDEVICE= Plot device: [List of devices]
Destination of plot, Screen or Hardcopy.
MOSAIC= View surface subdivisions x,y: [1,1]
View surface can contain a number of plot pages in
in X and Y direction (mosaic). Default is 1 plot in
both X and Y direction.
** PAPER= Give width(cm), aspect ratio: [0.0,1.0]
Aspect ratio is height/width.
** LINEWIDTH= Give line width (121): [1]
For a hardcopy, the default is 2.
DISTANCE= Distance of the eye from the screen: [calculated]
Control amount of perspective with this
unitless number.
RHO= Distance between viewpoint and origin. [calculated]
THETA= Angle between view vector and positive xaxis wrt.
the positive xaxis (degrees): [30]
xaxis is equivalent to the first subset axis.
PHI= Angle between view vector and positive zaxis wrt.
the positive zaxis (degrees): [60]
PHI= ranges from 0 to 180 deg.
zaxis is equivalent to the image value axis.
** SCALE= Give scale for image data: [calculated]
Scale image data so that the range in zvalues are
in range of x and yvalues.
DECIM= Give decimation factors x, y: [calculated]
Two integer values that decimates the number of
pixels in x and y. Decimation must be used if too many
positions are required.
PLOTOPT= Plot option: [0]
0: Plot surface in both directions
1: Plot in Xdirection only
2: Plot in Ydirection only
OPTION= Min, max from: 1)User 2)Calculation 3)Header [3]
MINMAX= Give data min, max: [header values]
or, if OPTION=2
Give data min, max: [calculated]
This keyword specifies the unscaled range in data
values.
CONTINUE= Continue? [Y}/N
Replot same subset with new values for DISTANCE=
RHO=, PHI=, THETA=, SCALE=, PLOTOPT=, OPTION=
and MINMAX=
Description: In order to draw data in perspective there are two
transformations to perform. First a viewpoint has to be
specified (RHO=, THETA=, PHI= & DISTANCE=). The 'viewpoint'
transformation converts the coordinates in world coordinates
(i.e. pixel positions and image values) into
'eye' coordinates expressed in a coordinate system
centered at the viewpoint. The perspective transfor
mation produces the actual 2dim. 'screen' coordinates.
The perspective transformation has a single vanishing
point and the screen axes are parallel to the 'eye'
coordinates. The keywords related to perspective are
DISTANCE= and RHO=
The viewing transformation:
Point in the world coordinate system: (xw,yw,zw,1)
Point in the eye coordinate system: (xe,ye,ze,1)
theta = th, phi = ph.
(xe,ye,ze,1) = (xw,yw,zw,1)V
where V is matrix:
 v11 v12 v13 v14 
 v21 v22 v23 v24  =
 v31 v32 v33 v34 
 v41 v42 v43 v44 
sin(th) cos(th)*cos(ph) cos(th)*sin(ph) 0.0 
 cos(th) sin(th)*cos(ph) sin(th)*sin(ph) 0.0 
 0.0 sin(ph) cos(ph) 0.0 
 0.0 0.0 rho 1.0 
Then:
xe = v11*xw + v21*yw
ye = v12*xw + v22*yw + v32*zw
ze = v13*xw + v23*yw + v33*zw + v43
The perspective transformation:
If d is the distance of the eye to the screen and xs, ys
are screen coordinates, then
xs = d * xe / ze
ys = d * ye / ze

  ye
 ys 
< d >  
>
eye < ze >
Example: Hint: If you want a plot with the same orientation
like 'VIEW' use THETA=80. PHI=20
Updates: Jul 14, 1994: MV, Document created.