Martin Reddy (mxr++at++dcs.ed.ac.uk)
6/6/96 2:43 PM
I will need to do the same thing soon (making a track box for an object in world
space). My approach will probably be something like this:
pfVec3 screen_pos, world_pos;
(get world position)
pfMatrix view_mat, temp_mat;
pfCoord chan_offsets;
pfGetChanViewMat(chan, mat);
pfGetChanViewOffsets(chan, chan_offsets.xyz, chan_offsets.hpr);
pfMakeCoordMat(temp_mat, &chan_offsets);
pfPreMultMat(view_mat, temp_mat); // postmultiply instead? can't
// remember offhand
pfXformVec3(screen_pos, world_pos, view_mat);
I think that the x,y values in screen_pos will then be the (normalized?) screen
coordinates of the world point. I may have missed a few steps, as I haven't
actually tried this. Anybody else have suggestions/comments? It definitely
would be nice to have a project_point function in Performer, perhaps as part of
the pfChannel API.
Don Tidrow
Visual Simulation Developer
US Army TACOM
______________________________ Reply Separator _________________________________
Subject: Re: certainly already asked
Author: Martin Reddy <mxr++at++dcs.ed.ac.uk> at TWLAN-SMTP
Date: 6/6/96 2:43 PM
> Does anybody have, or does this exist in Performer, a function that
> computes from 3D coordinates to 2D screen coords ?
This is something that I am interested in too. I have seen a few posts
asking this in the past, but never any answers. For myself I need to be
able to compute the size (e.g. projected bounding sphere diameter) and
position of objects in (2D) screen coordinates.
I gather that this is not possible in Performer? (but I'd love to be
proved wrong). As a result I am considering re-inventing the wheel and
manually performing perspective projections on each of my objects. In
order to ensure that I'm doing the same calculations that Performer is
doing to display the object, can anyone on the Performer Team direct me
towards a source (or better yet, source code) which Performer uses to
implement its perspective projection (is it just your standard algorithm
ala Foley & van Dam?).
As a future feature suggestion, I would think that being able to access or
compute the 2D projected coords for objects would be a fairly useful API
feature?? Just my opinion :-)
Cheers,
Martin.
+============================================================================+
| Martin Reddy Dept. of Computer Science |
| University of Edinburgh |
| e-mail : mxr++at++dcs.ed.ac.uk Mayfield Road, EH9 3JZ |
| http://www.dcs.ed.ac.uk/home/mxr/ Tel : (0131) 650 5164 |
+============================================================================+
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer.html
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:59 PDT