Skip to main content

how to draw a polygon cylinder using java3d

11 replies [Last post]
hrliuhai88
Offline
Joined: 2004-08-20

Hi,everyone.
I'm a new comer here. I want to draw a polygon cylinder using java3d. the cylinder can interactively rotate aroud x-axis,y-axis,or z-axis.Any opion will be appreciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
geoff
Offline
Joined: 2004-03-04

yo. its not done.
you have created a triangle cylinder. not a polygon cylinder.
ten lashes . you give up too easily. go back and
make a real polygon cylinder out of quad arrays strips
indexeded or otherwise.
geoff.

hrliuhai88
Offline
Joined: 2004-08-20

What I do is : 1. construct polygon cyliner side face using IndexedTriangleStripArray. Though I think I can use IndexedQuadArray ,there is a weakness because u cannot reuse vertex.There is not "IndexedQuadStripArray" here.2.construct polygon cylinder top and down face using IndexedTriangleStripArray.Also I can use IndexedTriangleArray or IndexedQuadArray,but vertex is much more.
do u still think my way is triangle cyliner? If so,tell me ur way.Thanks.

geoff
Offline
Joined: 2004-03-04

yo.
i reckon that if all you want to do is create a cylinder. then the utils cylinder should do it. all the animation
is up to you. you can do it with alpha classes
i reckon that the default geometry creates a plygon cylinder but i asm not sure

geoff

Message was edited by: geoff

Message was edited by: geoff

hrliuhai88
Offline
Joined: 2004-08-20

I found a weakness in my way.when the polygon is concave(not protruding),the top and down triangle face will be error.
Using alpha and cylinder class can produce polygon cylinder? I dont know how to do.could u provide me some code?
Thanks again.
ps: My problem is :know the polygon coordinates ,and extrude the polygon to a polygon cylinder.dont need animation ,just interactively rotate and scale.

Mike Pilone

Sorry, most of the folks here are busy with their own projects and cannot
provide code to everyone that asks.

If you are just looking to create a cylinder, there is a Cylinder utility
class in the Java3D utilities. If you need to create a custom shape, take a
look at the code, it is available.

As for the rotating and scaling, place two transform groups above the shape
in the scenegraph and modify the transform matrix on these groups. You can
also use the mouse behaviors that come with Java3D for a quick start.

If you are still confused as how to generate the cylinder geometry, I
recommend searching the web for opengl or basic geometry examples. Java3D is
just a scenegraph, you need your own algorithms to create the geometry you
want in 3D coordinates.

Hope that helps,
-mike

-----Original Message-----
From: java3d-interest@javadesktop.org
[mailto:java3d-interest@javadesktop.org]
Sent: Wednesday, August 25, 2004 4:25 AM
To: interest@java3d.dev.java.net
Subject: [JAVA3D-INTEREST] Re: how to draw a polygon cylinder using java3d

I found a weakness in my way.when the polygon is concave(not protruding),the
top and down triangle face will be error.
Using alpha and cylinder class can produce polygon cylinder? I dont know how
to do.could u provide me some code?
Thanks again.
ps: My problem is :know the polygon coordinates ,and extrude the polygon to
a polygon cylinder.dont need animation ,just interactively rotate and scale.
---
[Message sent by forum member 'hrliuhai88' (hrliuhai88)]

http://www.javadesktop.org/forums/thread.jspa?messageID=24656&#24656

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

hrliuhai88
Offline
Joined: 2004-08-20

Yes,you are right.I solving the problem using class GeometryInfo and Triangulator . thanks again.

geoff
Offline
Joined: 2004-03-04

yo.
sorry to confuse you witht he alpha nonsense. i got it in my head that you wanted to animate this cylinder.
for interactive manipulation i reckon that you look at
com.sunj3d.utils.mouse. these are pretty good and can cater for most maipulation. in fact i think they are brilliante. mouse rotate and mouse translate seem to be all i need. i can get a good scan of any object just using those two.
let me know what you think??

geoff
Offline
Joined: 2004-03-04

yo matey.
copy this into top of file..
import com.sun.j3d.utils.behaviors.mouse.*;
import com.sun.j3d.utils.behaviors.keyboard.*;

copy this after all structure of enviroment. like all grafics config..

KeyNavigatorBehavior keyNavBeh = new KeyNavigatorBehavior(TG);
keyNavBeh.setSchedulingBounds(new BoundingSphere(new Point3d(),1000.0));

BoundingSphere behaviorBounds = new BoundingSphere(new Point3d(),
Double.MAX_VALUE);
MouseRotate mr = new MouseRotate();
mr.setTransformGroup(myTG);
mr.setSchedulingBounds(behaviorBounds);

MouseTranslate mt = new MouseTranslate();
mt.setTransformGroup(myTG);
mt.setSchedulingBounds(behaviorBounds);

MouseZoom mz = new MouseZoom();
mz.setTransformGroup(myTG);// replace TG
mz.setSchedulingBounds(behaviorBounds);

then add to the tranform you want to manipulate.

myTG.addChild(mz);
myTG.addChild(mt);
myTG.addChild(mr);
myTg.addChild(keyNavBeh);
that shoulf give you loads of object maniptulation. if that isnt enough you are on yuor own. its enough for me.
geoff

geoff
Offline
Joined: 2004-03-04

hi there.
i would go to url below and have a look at the tutorials there.

http://www.j3d.org/faq/index.html

geoff.

hrliuhai88
Offline
Joined: 2004-08-20

Thanks.I created a geometry using IndexedTriangleStripArray class.It's done.

hrliuhai88
Offline
Joined: 2004-08-20

also ,www.j3d.org is good site for java3d