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

int np=20;

double dc=Math.PInp;

double x[n],y[n];

double R=10,c;// radius and angle

And, initialize it with the following code:

for(int i=0;i

x[i]=R*Math.cos(c);

y[i]=R*Math.sin(c);

}

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

Points: 20

Minimum: 0

Maximun: Math.PI

Variable: c

X(): R*Math.cos(c)

Y(): R*Math.sin(c)

If you set [Java Syntax] to false (default is true)

You can set

X(): R*cos(c)

Y(): R*sin(c)

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.