Raffi's suggestion of transforming the sphere is very slick!
General comments:
An ellipsoid can be defined by the equation
    (x/a)^2  +  (y/b)^2  +  (z/c)^2 = 1
The constants a, b, c give the half-widths of the ellipsoid along the
principal directions.
In the special case where a = b = c, this reduces to the limiting case
of a sphere.
When a, b and c are all different, it's called a triaxial ellipsoid.
It's more common to encounter the special case where two of the 3
half-widths are the
same and the third is different. For example,
    (x/a)^2  +  (y/b)^2  +  (z/b)^2 = 1
These are called ellipsoids of revolution.
The idea is that you obtain them by taking an ellipse, and rotating it
about one of the principal
axes. If you rotate it about the longer axis of the ellipse, you get
what's called a prolate
ellipsoid of revolution. (In the above equation, this is the case a > b.
If a is much bigger than b,
the ellipsoid becomes a sort of long cigar shape.)
If you rotate about the minor axis of the original ellipse, you get
what's called an oblate
ellipsoid of revolution. (This is the case a < b. In the limit of b much
larger than a, you get a sort
of pancake shape.) As I recall, the ellipsoids of revolution are
sometimes refered to as
oblate or prolate spheroids.

Implementing in Java3D might look roughly like...

import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
.....
Sphere sphere = new Sphere(radius);
Matrix3f  m  = new Matrix3f(1.0f, 0.0f, 0.0f, 0.0f, b, 0.0f, 0.0f, 0.0f, c);
// Make b and c unequal to 1.0 to get triaxial ellipsoids.
// Make b and c the same (but unequal to 1) to get ellipsoids of revolution.
// Vary "radius" to adjust the overall scale of the ellipsoid.
Transform3D trans = new Transform3D(m, new Vector3f(), 1.0f);
TransformGroup tg = new TransformGroup(trans);
tg.addChild(sphere);
myBranchGroup.addChild(tg);
......

The above approach just produces ellipsoids of various shapes centered
about the origin,
and with principal axes alligned along the x, y and z axes. You can
rotate the ellipsoid and
translate it around the scene by applying appropriate additional
transformations.
- Jim Robertson

Zak Nixon wrote:

>Can you explain that process....?
>
>Zak
>
>-----Original Message-----
>From: Kasparian, Raffi J. [mailto:[EMAIL PROTECTED]]
>Sent: Saturday, February 23, 2002 8:03 PM
>To: 'Zak Nixon '; '[EMAIL PROTECTED] '
>Subject: RE: [JAVA3D] 3d ellipsoids
>
>
>How about taking a sphere and transforming it with a non-uniform scale
>matrix? You could either use a TransformGroup or just take the geometry
>points and transform them by the matrix.
>
>
>-----Original Message-----
>From: Zak Nixon
>To: [EMAIL PROTECTED]
>Sent: 2/25/2002 2:44 PM
>Subject: [JAVA3D] 3d ellipsoids
>
>Group-
>
>        Does anyone have a prebuilt class for building 3d ellipsoids?
>
>Thanks,
>Zak
>
>========================================================================
>===
>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