Polygon is a GUI element for drawing any shape in drawingPanel/PlottingPanel/DrawingPanel3D.
Basically, you define number of points, and all the coordinates for x[n],y[n](,z[n] for 3D).
And Ejs will draw connected lines between those points.
For half of a circle, I will do the following
double R=10,c;// radius and angle
And, initialize it with the following code:
for(int i=0;i c=i*dc;
And assign x,y to X,Y propertie of polygon
And you will get a half circle drawing.
There is another GUI elements called AnalyticCurve.
You can set up properties as following
If you set [Java Syntax] to false (default is true)
You can set
And you will get the same result. (You need to define R first)
Basically, EJS will use the above information to set up polygon elements for you.
You can find out the examples for most of the GUI elements under the _example directory.
I have an online course for [url=http://enjoy.phy.ntnu.edu.tw/course/view.php?id=246]EJS workshop[/url] (However, it is in Chinese) at another web site.
You will find step by step tutorial in flash SWF format to show you how to create simulations with EJS.
It also contains all the related information for basic java programming.
You need to register for the web site to view all the contents.