hi harish,
olivier is right, what you need is a truncated cone. you can set up the
points pretty easy by using Math.sin and Math.cos.
here is an example (not tested):
int numberOfSegments = 32;
float height = 1.;
float bottomRadius = .8;
float topRadius = .5;
for (int i=0; i<numberOfSegments; ++i) {
float rad=(Math.PI*2.*i)/numberOfSegments;
Point3f bottomPoint = new Point3f(Math.sin(rad)*bottomRadius,
0.,
-Math.cos(rad)*bottomRadius);
Point3f topPoint = new Point3f(Math.sin(rad)*topRadius,
height,
-Math.cos(rad)*topRadius);
}
this example produces (numberOfSegments*2) points that you can use to create
a TriangleStrip and two TriangleFans which represent the truncated cone
(fans for top and bottom cap, strip for the sides). should be pretty
straightforward. only setting up correct normals for the thing might be a
bit tricky.
good luck,
-- julian
-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of Harish Nachnani
Sent: Tuesday, February 15, 2000 5:51 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Cylinder with different diameters at the two ends -
How To ?
Any suggestions on how to draw a cylinder with different diameters at the
two ends of the cylinder !
Harish
===========================================================================
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".