Function:ss2qc

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 01:25, 30 October 2007
S2plot admin (Talk | contribs)

← Previous diff
Current revision
S2plot admin (Talk | contribs)

Line 6: Line 6:
<code><pre> <code><pre>
-void ss2qcm(XYZ *position, XYZ *up, XYZ *vdir, int worldcoords);+void ss2qc(XYZ *position, XYZ *up, XYZ *vdir, int worldcoords);
</pre></code> </pre></code>

Current revision

ss2qc

Query the camera position, up vector and view direction.

Prototype

void ss2qc(XYZ *position, XYZ *up, XYZ *vdir, int worldcoords);

Description

Query the camera position, up vector and view direction (vdir). If worldcoords > 0 then return world coordinates, otherwise return viewport-relative coordinates.

Please note that this function returns camera position of LAST update. Calling it immediately after ss2sc without allowing a refresh or redraw will not return identical arguments as given to ss2sc. The return value can be checked for this possibility: if non-zero, then programmed changes to the camera are still pending.

See Also

ss2sc Set the camera position, up vector and view direction.
ss2sas Start/Stop the camera rotation.
ss2tc Enable/disable (1,0) camera translation.


Code Example

#include <stdio.h>
#include <stdlib.h>
#include "s2plot.h"

void cb(double *t, int *kc)
{
   char string[32];
   int wc = 1;					/* Use world coordinates */
   XYZ pos, up, view;				/* Camera parameters */
 
   ss2qc(&pos, &up, &view, wc);			/* Get camera parameters */

   sprintf(string,"Camera @ %5.2f %5.2f %5.2f",pos.x,pos.y,pos.z);
   s2textxy(-1.0,0.0,0.0, string);
						
}


int main(int argc, char *argv[])
{
   s2opend("/?",argc, argv);			/* Open the display */
   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */
   
   cs2scb(&cb);					/* Install a dynamic callback */

   s2show(1);					/* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.


Personal tools