Re: intersection at polygon vertices

New Message Reply Date view Thread view Subject view Author view

Mario Veraart (rioj7++at++fel.tno.nl)
Fri, 5 Dec 1997 18:56:21 +0100 (MET)


On Fri, 5 Dec 1997, Steve Baker wrote:
>
> On Fri, 5 Dec 1997, Mario Veraart wrote:
>
> > > > I have found a small misfunctioning for the pfNode::isect() method.
> > > > If I create a simple database consisting of 4 quads at z=0.
>
> > > > I want to try to intersect with the following segment
> > > > origin = (40,0,-100)
> > > > direction = (0,0,-1)
> > > > length = 200
> > >
> > > OK, so the segment starts at Z=-100 and ends at Z=-100+200*(-1)=-300.
> >
> > Sorry a small typo from my side.
> > In the code the direction was set to (0,0,1)
>
> Ah! It makes more sense now!
>
> > > > My question:
> > > > Is there a possibility that intersection at an xy coordinate that matches a
> > > > vertex coordinate is missed for some of the vertices in a quad or
> > > > triangle? (It does not happen along the edge of a primitive)
> > >
> > > I suppose a teeny-tiny roundoff error could result in a miss - it's not
> > > totally unreasonable.
> >
> > If this is the case than I have to try and find a way round this
> > problem. That is because I have to intersect at vertex coordinates of
> > some primitives that are part of the database.
>
> I'd say that relying on an infinitely thin segment hitting an
> infinitely small point is inviting roundoff problems. You
> might get away with it when everything is nicely aligned along
> the axes - but as soon as you get into arbitary orientations,
> you should certainly not expect it to work.

The database I build to test is not a typical one used for the real
thing. Only to get a simple version. The real terrain is 60x60km, tiled.
In the real database all orientations and cooridinates are possible.
It might be possible that for some polygon I have to do the test that
all vertices are alligned with ground vertices and that the test will
fail.

>
> However, in the case you show here....
>
> > > > The database is a Multigen Flight file.
> > > >
> > > > Y=
> > > > 40------------------- Z=0
> > > > | | |
> > > > | | |
> > > > | | |
> > > > | | |
> > > > 0|--------|--------|
> > > > | | |
> > > > | | |
> > > > | | |
> > > > | | |
> > > > -40-------------------
> > > > 0 40 80 X=
>
> ...when you fire a ray at the exact center of the diagram,
> (starting at a point that is cleanly on one side of it and
> ending at a point that is cleanly on the other side of it) then
> I think it is reasonable to expect Performer to guarantee
> that you do hit at least ONE of the four quadrilaterals -
> although I think it is reasonable that it would not guarantee
> to generate hits on all four polygons (as you seem to imagine
> it would) - or to guarantee *which* of the four it would hit.
>
> IMHO, it would be nice if Performer simply guaranteed to hit
> exactly one of the polygons in this case.
>
> However, if Performer were to miss all four polygons (which is
> what you seem to be saying) then that would be a DISASTEROUS
> situation for many applications - and should be regarded as a
> serious bug.

If the database is modelled with a continuous ground plane it doesn't
care for witch of the primitives there is a hit. They will all result
in the same hit point (the common vertex).
In this simple model I suspected to get a hit, for one of the quads.
It misses the ground plane primitives but intersects with one above the
ground plane, with a vertex matching the segments XY coordinate.
But if I test the intersection along an edge of the quads I get a hit.
And a vertex is part of the edge, isn't it?

> Having said that, I don't think I have ever seen that situation
> happen in practice in my applications.

For most terrain following and collision detection applications it
won't happen often that the segments will cross at exact vertex
coordinates. So you won't see this 'bug' appear.
In my application I test with segments that have coordinates for x and
y that exact match those of a vertex of a primitive.

> If your segment were to start or end *exactly* on the plane,
> then I think Performer would also be behaving reasonably if
> it didn't define whether you would get a hit or a miss in that
> situation. Once again, roundoff error would make that hard to
> guarantee.

That I can live with.
But my segments are 5000 units long and start
-2500 units below the terrain, and point upwards.

> Steve Baker 817-619-8776 (Vox/Vox-Mail)

Mario Veraart
--------------------
SIGNATURE DESTROYED BY THE BROTHERHOOD OF NOD
=======================================================================
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:56:20 PDT

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