Hi Marina,

most probably you can simply use one of the PickXXX classes for your
problem.

If you really want to manually transform mouse coordinates, you should take
a look at the following Canvas3D methods:

(taken from API docs)
>>
>> void getPixelLocationInImagePlate(int x, int y, Point3d imagePlatePoint)
>>    Computes the position of the specified AWT pixel value in image-plate
coordinates and
>>    copies that value into the object provided.
>>
>> void getImagePlateToVworld(Transform3D t)
>>    Retrieves the current ImagePlate coordinates to Virtual World
coordinates transform
>>    and places it into the specified object.
>>
>> void getCenterEyeInImagePlate(Point3d position)
>>    Retrieves the actual position of the center eye in image-plate
coordinates and copies
>>    that value into the object provided.
>>

roughly, it should work like this (not compiled and not tested):


public void mousePressed(MouseEvent evt) {

        Point3d imagePlatePoint=new Point3d();

canvas3d.getPixelLocationInImagePlate(evt.getX(),evt.getY(),imagePlatePoint)
;

        Transform3d imagePlateToVworld=new Transform3d();
        canvas3d.getImagePlateToVworld(imagePlateToVworld);

        imagePlateToVworld.transform(imagePlatePoint);

        // imagePlatePoint now contains world coordinate of mouse click. you may
need
        // to create a vector through this point and the eye point which you can
then
        // use to test intersection with various objects.

        // you can calculate the eye point world coordinates similar to the above,
        // but using canvas3d.getCenterEyeInImagePlate() instead of getPixelLoc().
}

-- Julian


-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of Marina Santana
Sent: Wednesday, February 09, 2000 1:37 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Point Coordinates


Hi,

I want to get the coordinates of the mouse pointer when I click it.
How I can do this?

Thanks,

Marina Santana

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to