Defining the Point of ViewThe position and orientation of the viewer within 3D world space is called the point of view or POV. By default, the POV is at the world space origin, looking straight down the positive z axis, but we can change this with fg_3Dlookat(), fg_3Dmove(), or fg_3Dpov(). These three functions define the viewer's position the same way, but they differ in how they define the viewer's orientation. All (x,y,z) coordinates passed to these functions are assumed to be 3D world space values. For fg_3Dlookat(), the first three parameters are the x, y, and z coordinates of the viewer's position, and the last three parameters are the x, y, and z coordinates of the point the viewer is looking at. For fg_3Dpov(), the first three parameters are also the x, y, and z coordinates of the viewer's position, but the last three parameters specify the viewer's orientation about the world space x, y, and z coordinate axes (in that order). The orientation angles are integer values expressed in tenths of degrees, measured counterclockwise around the respective world space axes. Suppose we want to place the POV at the world space coordinates (0,10,50) with the viewer looking to the left (that is, rotated 90º counterclockwise about the y axis). You can use either the fg_3Dlookat() or fg_3Dpov() calls shown here to define the POV as desired:
C/C++ and Delphi:
Visual Basic:
In this case, we passed fg_3Dlookat() a target x coordinate of -1.0. We would get the same POV by passing any negative value for the target x because both y coordinates and both z coordinates are equal. That is, from the viewer's position (0,10,50), looking at (-1,10,50) results in the same orientation as looking at, say, (-25,10,50) or (-500,10,50). We can reset Fastgraph's default POV by passing all zero parameters to fg_3Dpov(). We can also do this by passing fg_3Dlookat() a positive value for the target z parameter and zero for all other parameters. The fg_3Dgetpov() function returns the current POV information. It expects six floating point parameters, all passed by reference. The first three receive the 3D world space (x,y,z) coordinates of the viewer's position, and the last three receive the (x,y,z) components of the ViewOut vector. The ViewOut vector is a unit vector in the direction the viewer is facing. In other words, the POV returned by
C/C++:
Delphi:
Visual Basic:
is equivalent to the POV defined by
C/C++ and Delphi:
Visual Basic:
|
 
copyright 2001 Ted Gruber Software, Inc.