From 12a44dc133cf2c0426664f1ffaef7ded92f6c2f3 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Thu, 16 May 2002 08:25:24 +0000 Subject: Correction de la fonction GetCirclePoints qu prend d�sormais un angle_extent � la place du end_angle. Le start_angle et le angle_extent peuvent �tre n�gatifs. Ils sont exprim�s en radians. --- generic/Geo.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/generic/Geo.c b/generic/Geo.c index b1ec972..48471d3 100644 --- a/generic/Geo.c +++ b/generic/Geo.c @@ -2065,7 +2065,7 @@ ZnPoint * GetCirclePoints(int type, int quality, ZnReal start_angle, - ZnReal end_angle, + ZnReal angle_extent, int *num_points, ZnList point_list) { @@ -2219,7 +2219,7 @@ GetCirclePoints(int type, ZnPoint *p, *p_from; ZnPoint center_p = { 0.0, 0.0 }; ZnPoint start_p, wp; - ZnReal iangle; + ZnReal iangle, end_angle; switch (quality) { case ZN_CIRCLE_COARSE: @@ -2239,8 +2239,18 @@ GetCirclePoints(int type, num_p = sizeof(genarc_fine)/sizeof(ZnPoint); p = p_from = genarc_fine; } - + + /*printf("start: %g, extent: %g\n", start_angle, angle_extent);*/ + if (angle_extent == 2*M_PI) { + type = 3; + } if (type != 3) { + end_angle = start_angle+angle_extent; + if (angle_extent < 0) { + iangle = start_angle; + start_angle = end_angle; + end_angle = iangle; + } /* * normalize start_angle and end_angle. */ @@ -2250,15 +2260,10 @@ GetCirclePoints(int type, if (end_angle < 0.0) { end_angle += 2.0*M_PI; } - if (start_angle == end_angle) { - type = 3; - } - if (start_angle > end_angle) { - iangle = start_angle; - start_angle = end_angle; - end_angle = iangle; + if (end_angle < start_angle) { + end_angle += 2.0*M_PI; } - start_angle = fmod(start_angle, 2.0*M_PI); + /*printf("---start: %g, end: %g\n", start_angle, end_angle);*/ } /* -- cgit v1.1