122 const int segments = 4*segments_per_quarter;
129 if (segments_per_quarter == 0)
131 lwerror(
"Need at least one segment per quarter-circle.");
137 lwerror(
"Radius must be positive.");
141 theta = 2*M_PI / segments;
147 radius *= sqrt(1 + pow(tan(theta/2), 2));
149 for (i = 0; i <= segments; i++)
151 pt.
x =
x + radius*sin(i * theta);
152 pt.
y =
y + radius*cos(i * theta);
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
int lwpoly_add_ring(LWPOLY *poly, POINTARRAY *pa)
Add a ring to a polygon.
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE, then a duplicate point will not be added.
#define LW_TRUE
Return types for functions with status returns.
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.