Arthur, thank you very much.

But, for increasing realism, we dont want to allow user to interactue with
these internal params (front and back clipping planes)

We want to use geometrical methods, based in the scenegraph properties.

Id like to play with fieldOfView, view`s position, scene extend, etc, but
there are some irregulars factor,
like terrain (mountains, etc) which are very difficult to manage.

I havent already invent any algorithm, but any help is welcomed.

Thanks a lot!


----- Original Message -----
From: "Gary L. Graf" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 04, 2001 6:15 PM
Subject: Re: [JAVA3D] method lookAt


> Hi,
>    Seeing as your question follows two others that are similar, I decided
to
> give you a few short code clips.  The methods below are from a program
where I
> needed to periodically move the viewer to a new nearby location.  I did
this by
> keeping track of three parameters; a point where the viewer (camera)is at,
the
> point that the camera is looking towards, and a vector which defines the
up
> direction on the screen (initially new Vector3d(0.0d, 1.0d, 0.0d) ).
Note that
> if I tilt the camera up or down, then the 'up vector' is no longer
perpendicular
> to the direction you are looking.  To correct that I cross the up vector
with
> the look direction which gives me a new left/right vector perpendicular to
the
> other two.  I then reverse the process and cross the left/right vector
with the
> look direction to give a corrected up dirction which is now perpendicular
to the
> view.  Note that there will be subtle differences between each of the
methods
> you implement for the different move/tilt options.
>    Hope this helps some of you newer guys out there, but I suggest you
take a
> look at some of the graphic texts available.  To work in Java 3D you
really need
> to have at least a basic understanding of  coordinate systems, vectors and
> matrix math.
>         - Gary Graf
>
>   /**
>      * This method will change the views position (from point) and rotate
it
>      * about the look at point in such a manner that it appears the viewer
is
>      * moving perpendicularly left with respect to the object and field of
view.
>
>      *
>      * @param stepSize - An integer which is the number of degress of
rotation
>      * about the view point (look at point) that the image will be moved.
>      */
>   public void moveLeft(int stepSize){
>     double rotInRadians = -(stepSize * degreeToRadian);
>
>       file://Translate fromPoint to position relative to center of
rotation (toPoint)
>
>     fromPoint.sub(toPoint);
>
>         file://Move camera in orbit to left
>     AxisAngle4d rotAxis = new AxisAngle4d(upDirection, rotInRadians);
>     Matrix3d rotMatrix = new Matrix3d();
>     rotMatrix.set(rotAxis);
>     rotMatrix.transform(fromPoint);
>     fromPoint.add(toPoint);
>
>     positionCamera();
>   } file://end moveLeft()
>
>
>     /**
>      * This method will change the views position (look at point) and
rotate it
>      * about the viewer's position in such a manner that it appears the
viewer
>      * tilting his head up with respect to the object and field of view.
>      *
>      * @param stepSize - A float which is the number of degrees of
rotation
>      * about the viewer's position that the image will be moved.
>      */
>   public void tiltUp(float stepSize){
>     Vector3d rightDir = new Vector3d();
>     double rotInRadians = -(stepSize * degreeToRadian);
>
>       file://Find original look direction vector
>     Vector3d lookDir = new Vector3d(fromPoint);
>     lookDir.sub(toPoint);
>
>       file://Compute an orthagonal vector to later rebuild the up vector
>     rightDir.cross(lookDir, upDirection);
>     rightDir.normalize();
>
>       file://Translate fromPoint to position relative to center of
rotation (toPoint)
>
>     toPoint.sub(fromPoint);
>
>       file://Rotate the to point to effect the tilt
>     AxisAngle4d rotAxis = new AxisAngle4d(rightDir, rotInRadians);
>     Matrix3d rotMatrix = new Matrix3d();
>     rotMatrix.set(rotAxis);
>     rotMatrix.transform(toPoint);
>     toPoint.add(fromPoint);
>
>       file://Compute new up vector
>     lookDir = new Vector3d(fromPoint);
>     lookDir.sub(toPoint);
>     upDirection.cross(rightDir, lookDir);
>     upDirection.normalize();
>
>     positionCamera();
>   } file://end tiltUp()
>
>     /**
>      * This method moves the viewer's position to the most currently
defined
>      * from point and orients the view towards the targeted look point
>      * (originally the object center).
>      * the upper left corner of the view.
>      */
>   public void positionCamera(){
>       file://Set the camera to the new location
>     Transform3D viewRotTrans = new Transform3D();
>
>     viewRotTrans.lookAt(fromPoint, toPoint, upDirection);
>     viewRotTrans.invert();
>
>        //   Note:  viewTransGrp =
> universe.getViewingPlatform().getViewPlatformTransform();
>     viewTransGrp.setTransform(viewRotTrans);
>   } file://end positionCamera()
>
>
>
> J�rgen Vansteelant wrote:
>
> > Helo,
> >
> > can someone explain me the method lookAt(Point3d eye, Point3d center,
> > Vector3d up)
> > I think I might use it , but I have some problems with the vector
parameter.
> >
> > If anyone has an example that uses this method ,please post it if you
want!
> >
> > Thank you.
> > Jurgen
> >
> > **** DISCLAIMER ****
> > The contents of this e-mail are intended for the named addressee only.
> > It contains information which may be confidential and which may also be
> > privileged. Unless you are the named addressee (or authorised to receive
> > for the addressee) you may not copy or use it, or disclose it to anyone
> > else. If you received it in error please notify us immediately and then
> > destroy it. Further, we make every effort to keep our network free from
> > viruses. However, you do need to verify that this email and any
attachments
> > are free of viruses as we can take no responsibility for any computer
virus
> > which might be transferred by way of this e-mail.
> >
> >
===========================================================================
> > 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".
>
>
===========================================================================
> 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".

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