At third sight changing the viewport won't work of course as it will just

shrink the whole scene !!!

I gave this a try and it seems something like this would work :

- unproject x,y,1

- unproject x,y,0

- unproject x,y+height,1

It gives 3 points that are defining the left clip plane.

Use Device.SetClipPlane to define this user clip plane and enable it using

the appropriate rendertstate (D3DRS_CLIPPLANEENABLE).

Use ProcessVertices on the bouding volume and read the ClipStatus to know if

all or at least one vertex is clipped by this plane.

Of course do this at once for all planes (this was just for a quick test).

You can always optimize later if possible with a mathematical method but it

should allow to have quickly a first implementation to start with....

Patrice

Quote:

> At second sight, I'm not sure what is taken into account when using

> ProcessVertices. Changing the viewport may be enough but in the worst case

> you would have to change the projection matrix.

> Patrice

> > It should be very simular to view frustum testing.

> > The 2D rectangle defines a volume. You can then test rendered objects or

> > groups to see if their bounding volume is outside this volume. If not

> > outside you may want to conduct further testing for more precise results

> (in

> > case the bouding volume would be partially inside this volume but not

the

> > actual object).

> > Before using a more analytical way to do things, using ProcessVertices

and

> > ClipStatus should allow to implement a first version of these principles

> > quite easily.

> > For DX9, I'm working on a series that should illustrate most of these

> > principles with simplicity in mind. I'll probably add this 2D selection

> > stuff...

> > Patrice

> > > How can I use a 2D rectangle to do a pick in a 3D World.

> > > Example - Scattergraph demo in SDK

> > > When the mouse is over a sphere the program uses the

> > > intersect fucntion to determine the intersect between a

> > > mesh and a ray from the mouse/user's point of view.

> > > How do you do that with an area instead of a single point.

> > > The idea is for the user to draw a 2D rectangle

> > > and "select" everithing within that rectangle, in the 3D

> > > world.

> > > I have code to do that in OpenGL, but I don't now how to

> > > do that in DX.