Ellipse Cylinder Primitive? 

Software: Away3D 4.x

bitmapdata, Newbie
Posted: 14 August 2012 05:41 PM   Total Posts: 24

How would one create an ellipse cylinder? Just like a regular cylinder but with an ellipse (oval) instead of a circle?
Any suggestions?

   

bitmapdata, Newbie
Posted: 15 August 2012 12:27 AM   Total Posts: 24   [ # 1 ]

If anyone is interested I figured this out. This is basically a cylinder that can have not just a radius but a width and height as radii. It was pretty simple and it overrides the CylinderGeometry class.  I think it would be a great thing to have in away3d. Let me know if I did this right.
Thanks, Jacob Schatz
I hit the limit for the code tag so here it is

 

File Attachments
EllipseCylinderGeometry.as  (File Size: 11KB - Downloads: 271)
   

Richard Olsson, Administrator
Posted: 15 August 2012 10:43 AM   Total Posts: 1192   [ # 2 ]

Why not just use a cylinder and scale it along one axis? Either using the mesh’s scaleX, scaleY or scaleZ properties (depending on cylinder orientation) or using a transform matrix and the Geometry.applyTransform() method.

 

   

bitmapdata, Newbie
Posted: 15 August 2012 07:03 PM   Total Posts: 24   [ # 3 ]

That is a good idea. My only issue is that I needed to specify the width and length in inches and convert to pixels. That’s probably doable with scaleX but specifying them individually works easier.

 

   

Richard Olsson, Administrator
Posted: 16 August 2012 08:02 AM   Total Posts: 1192   [ # 4 ]

I’m not sure what you mean by “inches” and “pixels” in this case. You should probably read my long comment in this thread: http://away3d.com/forum/viewthread/2959/

However, disregarding the unit names, you can of course scale a mesh to a varying degree in order to end up at any particular dimensions. If you make a cylinder that has a radius of 100 units, and you want it to be 200 units wide and 300 units deep, you should just scale it along the depth (Z) axis by 1.5. The same goes for any other ratio.

Because of this, it is unlikely that we add any more options to the cylinder primitive, or create another cylinder primitive.

 

   

bitmapdata, Newbie
Posted: 16 August 2012 10:22 AM   Total Posts: 24   [ # 5 ]

Right so I guess I could be extremely accurate if I figure out the calculation. 
Thanks for your help,
Jacob

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X