PDA

View Full Version : oops!! stumbled in a pool of 3d points... pls help!!



vijaykiran
12-06-2002, 06:46 AM
Hi guys,
Have you guys encountered the following situation and solved it? I am really desperate to know how to come out of the problem i am stuck in. I need help from you guys...
I have so many points in a 3D space, and I need to grab a particular point from those points in a XYZ space and drag it to a specified place using the mouse. I feel this is a common problem an opengl programmer encounters, but I wonder how is this mystery solved. Does any one have a solution to my problem? A block of code would be soooooo helpful to me if anyone has it, and i appreciate any kind of help.

Thanks,
Vijay.

SirKnight
12-06-2002, 06:49 AM
Picking! -> http://www.lighthouse3d.com/opengl/picking/

-SirKnight

Coriolis
12-06-2002, 11:52 AM
I prefer to create a ray through the mouse click position and the camera position and see what objects it gets reasonably close to. This is a lot more versatile because it is not directly tied into the actually displayed pixels, but you could argue that it is in some ways less precise for the same reason.

A couple examples of how this is more versatile: you can just click within a couple of pixels of an object to select it, rather than having to click on the object itself, or you can click on an object ignoring another object that partially covers it (such as text, highlight, icon, etc).

rgpc
12-09-2002, 03:30 PM
Originally posted by Coriolis:
I prefer to create a ray through the mouse click position and the camera position and see what objects it gets reasonably close to. This is a lot more versatile because it is not directly tied into the actually displayed pixels, but you could argue that it is in some ways less precise for the same reason.


Plus you can add "picking effects" like the old Magnet selector etc and you can select the nearest point to the cursor rather than having to click exactly on the point. Etc. Etc.