Re: Intersection testing

New Message Reply Date view Thread view Subject view Author view

From: Angus Dorbie (dorbie++at++sgi.com)
Date: 02/20/2001 11:43:18


You need a callback because that's where you can see each intersection
as they happen DURING the traversal.

On the dimensionality of the hits structure, let's see.....

Hits are assigned from a pool allocated by the isect routine. The
question is why the array of pointers to pointers, instead of just an
array of pointers.

To get a pfHit* the man page suggests addressing this like:

hits[i][0]

To get a pfHit* the examples addresses this like:

*hits[0]

Same thing really but the former is perhaps slightly misleading. Infact
I'm not sure it works without braces like (hits[i])[0], since there's no
minor dimension in the declaration. This is a thorny precedence issue
that someone better than me with compilers can answer.

Anyway, it looks to me like it's just a redundant indirection. You were
hoping that the multidimensionality would contain all intersections for
each segment, and that was perhaps the initial intent where hits was an
array of pointers to arrays, with Performer creating those arrays for
each segment, but you'd need an array of numbers of hits (instead of a
single return) and the unbounded nature of the intersection result would
suggest that an array may not be the best structure. All information
suggests that each indirect array in this case has only a single entry.

This feels like this was designed for multiple hits on a single isect,
then redesigned for multiple segments to improve performance and the
accommodation of multiple hits on multiple segments was half intended
then abandoned, leaving the vestigial and confusing **hits[].

Cheers,Angus.

Boris Mansencal wrote:
>
> Angus Dorbie wrote:
> >
> > Looks like I was wrong the hit array is for multiple segments (as you
> > suggest).
> >
> > Looks like you'd need to use callback to get access to all the segments.
>
> I don't really understand your answer. Why would I need to use callback
> ?
>
> With the current behavior, I can access to the 'closest' intersection of
> each segment with the scene. But what I need is all the intersections
> of
> a given segment with the scene.
> I thought that it was possible because we pass a pfHit **[] to isect,
> but
> it seems it is not.
> So I don't understand why we do not pass only a pfHit *[] ?
> Is it for a coming feature ?
> Is the behavior that I expected present in the 2.4 release ?
>
> If not, do you think to a clever way to do this ?
>
> Thanks a lot,
>
> Boris.
>
> >
> > Cheers,ANgus.
> >
> > Boris Mansencal wrote:
> > >
> > > Angus Dorbie wrote:
> > > >
> > > > Boris Mansencal wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > I would like to get all the geometries intersected by a segment.
> > > > > It is not possible with pfNode::isect(pfSegSet *segSet, pfHit **hits[],
> > > > > isn't it ?
> > > > >
> > > >
> > > > It is possible.
> > > >
> > > > > So, why do we need to give a pfHit **[] and not only a pfHit *[] if we
> > > > > get only
> > > > > one intersection point by segment ?
> > > >
> > > > Because it's possible :-)
> > > >
> > >
> > > So, as isect returns n the number of intersections, I will have n pfHit*
> > > from hits[0], right ?
> > > Is it still working with several segments ? How do I know the number of
> > > intersections for a given segment ?
>
> --
> Boris Mansencal
> INRIA Rocquencourt (France) - projet i3D

-- 
For Performer+OpenGL tutorials http://www.dorbie.com/

"In the middle of difficulty lies opportunity." --Albert Einstein


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Feb 20 2001 - 11:43:47 PST

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