Daniel Williams (dwilliams++at++sarnoff.com)
Tue, 03 Nov 1998 09:31:47 -0500
Here's my workaround for the problem. I encountered this problem
during the Performer 2.2 alpha and sent SGI this code at that time.
I had to subclass pfChannel for other reasons, so this is a new
method that is like pfChannel::pick but works for off-axis view
frustra. No guarantees, but it's been working for me.
//
// apparently the pfChannel::pick method doesn't work for off-axis
// viewing projections (as of Performer 2.2 alpha), so here is a
// method with the same signature and semantics that works. notice
// that radius is not used.
//
int pfDWChannel::pickOffAxis (int mode, float px, float py, float
radius, pfHit **pickList[])
{
//
// compute point picked on near clip plane
//
pfVec3 near_ll, near_lr, near_ul, near_ur;
getNear (near_ll, near_lr, near_ul, near_ur);
pfVec3 screen_point;
screen_point.combine (px, near_lr - near_ll, py, near_ul - near_ll);
screen_point += near_ll;
//
// make a line segment from the eye to the point picked
//
pfVec3 xyz, hpr;
getView (xyz, hpr);
pfSeg segment;
segment.makePts (xyz, screen_point);
//
// and effectively turn it into a ray
//
segment.length = FLT_MAX;
//
// intersect the segment with the near clipping plane
//
pfPlane near_plane;
near_plane.makePts (near_ll, near_lr, near_ul);
float near_point;
if (near_plane.isect (&segment, &near_point) != PFIS_FALSE)
segment.clip (&segment, near_point, FLT_MAX);
//
// intersect the segment with the far clipping plane
//
pfVec3 far_ll, far_lr, far_ul, far_ur;
getFar (far_ll, far_lr, far_ul, far_ur);
pfPlane far_plane;
far_plane.makePts (far_ll, far_lr, far_ul);
float far_point;
if (far_plane.isect (&segment, &far_point) != PFIS_FALSE)
segment.clip (&segment, 0.0f, far_point);
pfSegSet segset;
segset.mode = mode;
segset.userData = NULL;
segset.activeMask = 1;
segset.isectMask = PFIS_SET_PICK;
segset.bound = NULL;
segset.discFunc = NULL;
segset.segs[0] = segment;
return (isect (getScene (), &segset, pickList, NULL));
}
-- Daniel Williams, Systems & Scientific Software Voice: (215) 885-1573 Email: sass++at++acm.com Independent Consultant to: Sarnoff Corporation Voice: (609) 734-2153 Email: dwilliams++at++sarnoff.com
This archive was generated by hypermail 2.0b2 on Tue Nov 03 1998 - 06:31:52 PST