The only problem with this is that you have a fixed sampling rate. You
would really like to have less sample points along the more "linear"
parts of the scene, and more sample points (and thus more polys) on
parts of the graph that change more, giving a better curve fit. In math
terms, more sample points where the 2nd derivative (acceleration) is
greater. The process can be called "triangulation", and there are
several algorithms out there to do this. Or, you can write your own...
;)
-Lee
J. Lee Dixon
Software Engineer
SAIC - Celebration, FL
[EMAIL PROTECTED]
-----Original Message-----
From: Carl Smotricz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 20, 2000 4:13 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Drawing a 3D Mathematical Function
Hello Scott,
At 02:30 20.09.00 , you wrote:
>For extra credit, I'd like to build a GUI that will draw the 3D graph
and
>(if possible) show the genetic algorithm's attempts to locate the
maximum
>(i.e., dynamically "flash" points produced by the genetic algorithm as
>possible maximums).
>
>I'm new to Java 3D, so I'm wondering - can the mathematical function
>described above be implemented (relatively painlessly!) with Java 3D?
If
>so, what would be a good place to start?
I don't have any experience at what you're doing, but from what I know
I'm
sure it's quite feasible. Here is the approach I would take:
Construct a SimpleUniverse, and inside that place a scene graph with
just
two nodes: A PointLightSource (so your graph will be illuminated with
different intensities at different angles, and thus appear nicely solid)
and a Shape3D, which will be your graph. The Shape3D will have Geometry
attached to it which will be a 'net' of triangles connecting vertices
whose
positions represent points on your graph. You could lay out x1 as x
(going
right and left) and x2 as z (coming out of/going into the screen) and
f(x1,x2) as y (going up and down). Sample x1 and x2 at 100 points each
and
you get 10,000 vertices, that should make for a nicely detailed
landscape.
Once you have the graph done, things like flashing points will seem
simple.
I'd use little Spheres, that way you can control the size of the
'points'
so they'll be nicely visible. Each time your search finds a "better"
point,
add a "glowing" Sphere to your scene graph.
To implement this, you will want to have the latest Java2 JDK on your
machine. It's available from http://www.javasoft.com/j2se/1.3/ .
You will need the Java3D JRE and JDK, available from
http://www.javasoft.com/products/java-media/3D/download.html .
Many people have trouble with installing and running J3D. You will want
to
look at the J3D.ORG's page at http://www.j3d.org/ (where else?),
especially
the "installing Java3D" and "FAQ" pages. For best results, look at these
BEFORE you start tinkering.
Then, you'll need to learn how to use the Java3D API. A good
introductory
treatment is the Java3D tutorial on this page:
http://www.javasoft.com/products/java-media/3D/collateral/ . You'll need
Chapters 1, 2, 3 and 6.
If you have further questions, you'll find the group at this list
friendly
and helpful.
Hope this helps,
-Carl-
========================================================================
===
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".