Fastian

04-11-2001, 02:49 AM

Hi,

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

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

View Full Version : Is using selection buffer for selection or picking slow?

Fastian

04-11-2001, 02:49 AM

Hi,

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

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

Michael Steinberg

04-11-2001, 02:52 AM

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

KurtCob

04-11-2001, 03:15 AM

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

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

Fastian

04-11-2001, 03:19 AM

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

Michael Steinberg

04-11-2001, 03:49 AM

Let a line and a plane intersect.

There are different attempts doing that.

Here's one way (dunno):

int LinePlaneIntersect( CVector& a, CVector& b, CPlane& plane, CVector& 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).]

There are different attempts doing that.

Here's one way (dunno):

int LinePlaneIntersect( CVector& a, CVector& b, CPlane& plane, CVector& 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).]

Fastian

04-11-2001, 03:56 AM

Thnx man

Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.