Have a good look at the tutorial/FAQ and I believe you should be able to
solve your problems
in the following way:

>I have to write a project with Java3D, but there are some unclearly
>things, for ex. I need to add (with the mouse) a new piece ( a new object )
>to a created model ( in position (x,y,z) ).
> - How can the cursor coordinates be asked ? Or are there any other
>   possibilities to solve this problem ?
There are whole set of method to do this:
in the following, I use the code to give the x/y position of my mouse
pointer in a bird eye view of the scene
This should give you some ideas to follow
####################333
>From your mouse event:
 /**
     * Takes the x and y coordinates from the provided mouse event and
     * determines the corresponding point in the virtual world.
     *
     * @param evt  The Mouse Event for which the point is desired
     * @return Point3d  a virtual world point corresponding to the Mouse
Event's
     *                  x and y coordinates on the canvas.
     */
    public Point3d getCanvasPtToVworldPt(MouseEvent e) {
        return getCanvasPtToVworldPt(e.getX(), e.getY());
    }
with
/**
     * determines a corresponding virtual world point given a canvas point.
     *
     * @param Point3d  the point on the canvas
     * @return Point3d  a virtual world point corresponding to the canvas
point
     *                  provided.
     */
    public Point3d getCanvasPtToVworldPt(int x, int y) {

        // convert the canvas point to ImagePlate coords
        getPixelLocationInImagePlate(x, y, VworldPt);
        // transform the point from an imageplate coordinate to a Vworld
        // coordinate
        getImagePlateToVworld(imagePlateToVworld);
        imagePlateToVworld.transform(VworldPt);

        getCenterEyeInImagePlate(centerEyePt);
        imagePlateToVworld.transform(centerEyePt);
        file://Logging.trace(10, "Center eye pt VW " + centerEyePt);
        file://now compute the z=0 value  in the centereye to VworldPt pt
        file://centerEyePt_VworldPt = alpha *centerEyePt_planePt with
planePt.z=0
        double alpha = 0.0;
        if ( VworldPt.z != centerEyePt.z ) {
            alpha = centerEyePt.z /(VworldPt.z - centerEyePt.z);
        }

        Point3d planePt =
            new Point3d(    centerEyePt.x - alpha *(VworldPt.x -
centerEyePt.x),
                            centerEyePt.y - alpha *(VworldPt.y -
centerEyePt.y),
                            0.0);
    return planePt;
    }
###############
Please note that I do not care about the z value here

Another way is to pick the point (see FAQ/archive) and so directly get the
xyz picked upon

>
>I load an object, but I know nothing about it. I want to put this object in
>a smallest possible rectangle (so I want to discover its width, height and
>depth ).
> - How can I do this ?
just get its bounds!!!!
see FAQ/etc about this
Cheers
--
Olivier Fillon    Minestar Project
[EMAIL PROTECTED]  Mincom Limited
Ph.+61-7-3303-3344               61 Wyandra Street
Fax+61-7-3303-3232               Teneriffe Qld. 4005.
Australia
Company home page: http://www.mincom.com/
Personal home page: http://www.home.gil.com.au/~fillon
--

===========================================================================
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