# Thread: Is using selection buffer for selection or picking slow?

1. ## Is using selection buffer for selection or picking slow?

Hi,

I was wondering is using selection buffer slow and if so, what are the alternatives?

2. ## Re: Is using selection buffer for selection or picking slow?

AFAIK nvidia cards switch to software mode when using these rendering modes. The fastes probably is that you do your own ray intersection test.

3. ## Re: Is using selection buffer for selection or picking slow?

Hi Michael,

The people always said that the best mode is the ray intersection, but I always asked how to do this, and they never answered, could you explain me how to do this ?

Tnks
Best RGDS

Kurt

4. ## Re: Is using selection buffer for selection or picking slow?

Well i think I agree with kurt, can you explain a bit?

5. ## Re: Is using selection buffer for selection or picking slow?

Let a line and a plane intersect.
There are different attempts doing that.

Here's one way (dunno):

Code :
```int LinePlaneIntersect( CVector&amp; a, CVector&amp; b, CPlane&amp; plane, CVector&amp; result )
{
double quot, t;
plane.normal.Normalize();

t    = (plane.place-a)*plane.normal;
quot = b*plane.normal;

if( DOUBLE_EQ( quot, 0.0 ) ) {
printf("\n    quotient is zero!");
if( DOUBLE_EQ( t, 0.0 ) ) return LPI_INSIDE;
else return LPI_PARALLEL;
}

printf( "\n    t is %f", t );

t    = t/quot;

result = a+b*t;

return LPI_CUT;
}```
On the other hand you'd have to test wether the intersection lies on the poly. Either test wether the line lies inside the convex hull of the pyramid built from a point on the line and the polygon edges, or use a different approach.

The plane:
vx = va + r*vb + t*vc

where va is a vector to a point on the plane (it's place vector), vb and vc are the span-vectors which actually build the plane.

The line:

vx = vd + u*ve

Now say

vd + u*ve = va + r*vb + t*vc

and solve the resulting equation system.

if r+t <= 1 and both are positive you've got an intersection inside the triangle with the egdes vb, vc and vc-vb displaced about va. Well you probably know what I mean.

[This message has been edited by Michael Steinberg (edited 04-11-2001).]

6. ## Re: Is using selection buffer for selection or picking slow?

Thnx man

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•