163{
164 uint32_t i;
167
168 LWDEBUG(2,
"pointArray_svg_arc called.");
169
170 for (i = 2; i < pa->
npoints; i+=2)
171 {
172 LWDEBUGF(3,
"assvg_circstring: arc ending at point %d", i);
173 int largeArcFlag, sweepFlag, clockwise;
175 double a1, a3;
176 double radius;
177 double total_angle;
182 int p2_side = 0;
187 if ( t1->
x == t3->
x && t1->
y == t3->
y ){
189 }
191 if ( p2_side == -1 )
193 else
195
196 a1 = atan2(t1->
y - center.
y, t1->
x - center.
x)*180/M_PI;
197
198 a3 = atan2(t3->
y - center.
y, t3->
x - center.
x)*180/M_PI;
199
200 LWDEBUGF(2,
" center is POINT(%.15g %.15g) - radius:%g", center.
x, center.
y, radius);
201
202 total_angle = clockwise ? a1 - a3 : a3 - a1;
203 if (total_angle < 0 ){
204 total_angle += 360;
205 }
206
207
208
210 largeArcFlag = (total_angle <= 180)? 0 : 1;
211
212
213 sweepFlag = (p2_side == -1) ? 1 : 0;
214 if ( (i == 2) && !is_circle ){
219 }
221 if ( (i == 2) && is_circle){
226 }
230 if (is_circle){
231
235 }
236 else {
237
238 if (relative){
240 }
241 else {
243 }
246
248 }
249 }
250}
#define LW_TRUE
Return types for functions with status returns.
double lw_arc_center(const POINT2D *p1, const POINT2D *p2, const POINT2D *p3, POINT2D *result)
Determines the center of the circle defined by the three given points.
#define OUT_DOUBLE_BUFFER_SIZE
int lw_segment_side(const POINT2D *p1, const POINT2D *p2, const POINT2D *q)
lw_segment_side()
int lwprint_double(double d, int maxdd, char *buf)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.