Determining vector direction thru channel

New Message Reply Date view Thread view Subject view Author view

Kent Watsen (watsen++at++netcom.com)
Sat, 31 Dec 1994 08:29:47 -0800 (PST)


Hello,

I sometimes have the need to calculate the direction of a
vector through any pixel on the screen. The target pixel
may be identified via mouse or touchscreen input. The
direction of the vector is to be used to perform intersection
tests in the otw scene graph.

Given : There may be multiple channels per viewport
        All channels assumed to be unit normal -1 to 1
        The left, right, bottom, and top of each channel
        The horizontal and vertical fov (usually the same)
        The hpr of each channel

Assume : Z up, Y forward, X right

First, assume a target pixel is found. That pixel can
be tested against the boundaries of each channel and the
channel it in in determined. Furthermore, the pixel's
reletive position within the unit noraml channel can be
calculated as dx, dy. (-1.0 <= dx,dy <= 1.0).

Using the euler angle matrix (321 direction cosine matrix
with hpr) transform X, Y, Z to X^, Y^, Z^. Note that Y^
is the direction of the vector in world coordinates for
the pixel in the center of a channel.

But our pixel my not at the center of the channel. However,
we do know how far away it is (dx,dy) and we know the width,
height, horizontal fov, and vertical fov. Therefore, one
can calculate the horizontal and vertical delta angle for
dx and dy (DangleX, DangleY).

The final vector R = Y^ + X^*DangleX + Z^*DangleY

This should work (as it did for the raytracer I wrote for
my thesis), but I made the assumption that there was a
linear mapping between pixels and delta-angles. Is this
true for Performer?

Kent Watsen
DCS Corporation
Simulation Branch
703.683.8430 x369


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:46 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.