[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Single Page

Top Document: SGI graphics Frequently Asked Questions (FAQ)
Previous Document: -55- How can I translate screen (x,y) coords into world (x,y,z) coords?
Next Document: -57- Why does nothing happen when I call mapcolor(index, R, G, B)?


-56- How can I translate world (x,y,z) coords into screen (x,y) coords?


Date: 07 May 1993 00:00:01 EST

  There are two methods.  The first method is detailed in
  ~4Dgifts/examples/grafix/world2scrn.c, which is part of the
  dev.dev_sw.giftsfull package.  It multiplies the (x,y,z) vector into
  the current modeling and projection matrixes, and uses the result to
  interpolate based on the window size and position.

  The second method uses the current cursor position as a trick and is
  much simpler.  Use cmov() to set the cursor position to the point of
  interest in world space, then call getcpos() to return the cursor
  position in screen coordinates.  Note that if your entire viewport is
  off-screen, the results are undefined and you'll have to use the
  first method.

      float x,y,z;
      short x1, y1;

      cmov (x,y,z);
      getcpos (&x1, &y1);



Top Document: SGI graphics Frequently Asked Questions (FAQ)
Previous Document: -55- How can I translate screen (x,y) coords into world (x,y,z) coords?
Next Document: -57- Why does nothing happen when I call mapcolor(index, R, G, B)?

Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
sgi-faq@viz.tamu.edu (The SGI FAQ group)

Last Update October 22 2009 @ 05:34 AM

Some parts © 2009 Advameg, Inc.