i have been able to make a polygon to be drawn be using this method

// dcangle is to spilt the angle between cta and ctas into parts

dcangle = (Math.atan2(y,x)-Math.atan2(ys,xs))/(n-2);// modify to draw from black line sing dx and dy as inputs

// px[0] and px[0] define the centre of polygon

px[0]=x0; // for drawing angle polygon

py[0]=y0; //

// if statement to draw polygon angle

for(int i = 1;i

c=Math.atan2(y,x)-(i-1)*dcangle;

// if(c>pi)c-=2*pi; // to overcome pi to -pi problem ?? didnt work for me ;D

px[ i ]=x0+d*Math.cos(c); //

py[ i ]=y0+d*Math.sin(c); //

}

xdeltatheta= px[17] ; // x coordinate for text angle delta theta

ydeltatheta =py[17] ; // y coordinate for text angle delta theta

this method is remixed from http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=634.0 so i learn from changing it.

[b]is there any elegant way to do this? how would an expert do this?[/b]

i want to make delta theta always acute angle 0 < 90 degree

the 'problem' occurs when in 2 situations:

1 (xs,ys) is in the 2nd quadrant (top right corner) and (x,y) is in 3rd quadrant (bottom left corner)

2 (x,y) is in the 2nd quadrant (top right corner) and (xs,ys) is in 3rd quadrant (bottom left corner)

the problem is captured here [img]http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=1874.0;attach=3154;image[/img]

usually is work well thanks to all your source codes i was able to refer to them! :) [img]http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=1874.0;attach=3156;image[/img]

Thx!