NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Questions related to EJS => Topic started by: lookang on November 09, 2009, 09:54:12 am



Title: How can i transform a 3D cylinder using 2 transformation with dynamic variables
Post by: lookang on November 09, 2009, 09:54:12 am
Hi Prof,

How can i transform a 3D cylinder using
Code:
"z:"+cta
and
Code:
y:90d

each works on its own but i can't figure out how to add both.
for example i tried but it doesn't work
Code:
"y:90d & "z:"+cta"


my reference:
http://www.um.es/fem/EjsWiki/Main/ElementsAboutTransforms

i want a rotating cylinder with both transformation to achieve the look of a cylinder (http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=1293.0;attach=1453;image)

attached in my source xml for(http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=1293.0;attach=1451;image)


Title: Re: How can i transform a 3D cylinder using 2 transformation with dynamic variables
Post by: Fu-Kwun Hwang on November 09, 2009, 05:04:54 pm
If you want to do "z:"+cta then "y:90d",
 you should set the property to "z:"+cta+" & x:90d"
If you want to do "y:90d" then "z:"+cta
 you should set the property to "x:90d & z:"+cta

Because cta is a variable so it need to be outside the string and added to property string with "+" operator.


Title: Re: How can i transform a 3D cylinder using 2 transformation with dynamic variab
Post by: lookang on November 09, 2009, 08:01:49 pm
Fantastic tips. Thx a million!
Will try later

finally understood the logic is additive.

using
Code:
"y:90d & x:"+cta

to achieve the same effect! thx!