Recent Changes - Search:

Information

Installation

Documentation

 

About transforms

The view element property described below has been superseded by a new way to specify rotations that was introduced in EJS 4.3. (The features described below are retained in EJS for backwards compatibility.)   

 

 

Fixed angles

 

 

The image to the right shows a dialog box for generating strings that specify various transformations. For example: enter the number “45” in the cell next to the button “Rotation around Z by”, and press the button. The line on the bottom will then read: z:45d  That is entirely a string. To create the specified transform EJS processes that string.

 

A subsequent rotation can be added by adding another number and pressing the adjacent button. For example 30 in the cell next to “Rotation around X by” and pressing the button. The line on the bottom will then read z:45d & x:30d.

 

 

 

Dynamic angles

 

To enter a variable as input the string concatenation operator “+” must be used. Let’s say a variable ‘pitchAngleRad’ has been declared on the Variables Panel (The name ends with ‘Rad’ to indicate that it’s intended for an angle in Radians.) The “+” sign indicates to the compiler that non-string parts must be converted to strings, so that the string parts can be concatenated. Enter the following:

 

"z:" + pitchAngleRad

 

The variable ‘pitchAngleRad’ is resolved to a number, and then converted to a string, so that the whole can be concatenated. The back and forth conversions are cumbersome, of course, but to make different parts of the program communicate reliably the exchange itself must be according to specific forms.
To combine two dynamic rotations (‘pitchAngleRad’ and ‘rollAngleRad’):

 

"y:" + pitchAngleRad + "& x:" + rollAngleRad

 

Again, variables are resolved to numbers, the numbers are converted to strings, the strings are concatenated.

 

 

 

Open source physics Java Class

 

Advanced users can build more complex transforms with the JAVA class org.opensourcephysics.numerics.Transformation.


Edit - History - Print - Recent Changes - Search
Page last modified on September 11, 2010, at 09:25 PM