CindyLab and CindyScriptCindyLab and CindyScriptThe interrelation of CindyLab and CindyScript is very important. CindyScript has full access to all the physical parameters of a system, including positions, velocities, and forces. Using this connection one can use CindyScript either to influence or to analyze a physical scenario. Analysis of a physics simulation may result either in numerical data or in visual enhacements of the pictures that make the parameters directly apparent to the eye. The picture below shows a bridge construction that is under tension from its own weight. CindyScript was used to highlight the compression or tension in the rods. Red corresponds to strong stress by tension, while blue corresponds to strong compression. The color green indicates the absence of compression and tension. The color effect was generated by adding three lines of CindyScript code to the physical experiment: segs=allsegments(); f(x):=hue(max((min((0.5,x+0.3)),0.0))); forall(segs,#.color=f(A.y*#.ldiff)) The first line defines segs to be a list of all line segments in the drawing. The second line defines a function that translates a real number into a reasonable color value. The third line forces the color of each segment to be set in accord with the change in length (from its resting length) of the corresponding spring.
CindyScript also provides special operations for analyzing physical experiments. For instance, the special operator drawcurve(...) can be used as a kind of curve plotter for parameter values in physics simulations. The picture below shows the energy flow in a coupled pendulum of two harmonic springs. One can observe nicely how the energy is transferred back and forth between the two pendulums.
Our last example shows how the colorplot(...) operator can be used together with a specialized operator drawfield to visualize the flux in an electrostatic field. However, it should be mentioned that in this context the use of colorplot will require a powerful computer in order for fluent movement to be exhibited when points are dragged with the mouse.
CindyScript can be used for more than analyzing physical effects. One can also use CindyScript for controlling the physical parameters of a set of objects. In particular, there is a flag "simulate" for every physical object that can be controlled by CindyScript. This flag controls whether a physical property is to be considered in the simulation. Using these features one can readily use Cinderella to simulate machines or games with many functional dependencies.
Contributors to this page: Richter
,
Kortenkamp
,
Kohler
,
Kramer
and
Dietrich
. The content on this page is licensed under the terms of the License. |
Login |