MySQL Forums
Forum List  »  GIS

Re: Why there is no Circle in a geographic feature
Posted by: lee light
Date: May 14, 2007 07:14AM

You can turn a cirle to a polygon, this is my java code, you can use the coordinate string for further using.


// num is at least 4, 16 will be similar to a circle
public String getCircle(double X, double Y, double R, int num) {
String circle = "";
if (num < 4)
num = 4;
double x[] = new double[num];
double y[] = new double[num];
double unit = 2*Math.PI / num;
for (int i = 0; i < num; i++) {
x = X + R * Math.sin(unit * i);
y = Y + R * Math.cos(unit * i);
if (i != num - 1)
circle = circle + x + " " + y + ",";
else
circle = circle + x + " " + y;
}

return circle;
}

Options: ReplyQuote


Subject
Views
Written By
Posted
10310
April 11, 2007 03:39AM
5458
May 08, 2007 12:32AM
Re: Why there is no Circle in a geographic feature
5020
May 14, 2007 07:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.