Re: pfSphereIsectSeg question

New Message Reply Date view Thread view Subject view Author view

Michael T. Jones (mtj++at++babar.asd.sgi.com)
Tue, 13 Aug 1996 14:59:28 -0700


On Aug 13, 2:15pm, Catherine E. Blanco wrote:
> Subject: pfSphereIsectSeg question
> I've been reading the man page for this function (which apparently
> appeared in Performer 2.0), and I can't understand what the return
> values mean. Just what are d1 and d2? I was hoping this function
> would return intersection points (pfVec3), but d1 and d2 appear to
> be scalars, and I don't know what they represent. Thanks...

A line segment can intersect a sphere in 0, 1, or 2 points. These
cases are indicated by the return value of pfSphereIsectSeg() which
is either 0, 1, or 2 as appropriate. When the value is 1 or 2, then
the values referenced as d1 and d2 are updated to the distances
along the segment where the intersection(s) exist.

num = pfSphereIsectSeg(...)

if (num == 0)
  no intersection
else
if (num == 1)
  only intersection: s.pos + d1*s.dir
else
if (num == 2)
  first intersection: s.pos + d1*s.dir
  second intersection: s.pos + d2*s.dir

note that the intersection routine is smart, so if the segment
starts inside the sphere or ends inside it, you still get the
proper number of intersections.

michael

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


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:53:21 PDT

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