Fanning Software Consulting

Selecting Cursor Location in 3D Space

QUESTION: I've been looking at the IDL iContour demo and I've seen an interesting feature. In the demo, there is a 3D scene and at the bottom of the window containing the scene the 3D location of the cursor is printed out. I've been searching the Help files and I haven't seen anything that tells me about this. It seems Widget_Draw returns only the motion events of the mouse on the screen. So how can this be done?

Can you drop me a rope in this matter?

ANSWER: I've been reading about the problems with traveling in the Antarctic recently. Lot's of falling into crevasses, lots of rope needed. So I am sensitive to your problem.

This functionality is coming from the IDLgrWindow object that the scene is displayed in. If you pass the XY coordinates of the cursor location, which is what you get in your draw widget when you have motion events turned on, to the IDLgrWindow object through its PickData method, it will interrogate the depth buffer of the window and report back its 3D location. (The IDLgrWindow object can be obtained as the value of the draw widget.) This is what is being printed out in the status bar window of the demo.

Web Coyote's Guide to IDL Programming