From b623f5953691b2a0614e6f1f4def86bdbb9a4113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Aug 2020 11:53:00 +0200 Subject: New upstream version 5.2.0Beta2.1 --- app/bin/utility.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) (limited to 'app/bin/utility.c') diff --git a/app/bin/utility.c b/app/bin/utility.c index d1f798c..93f9979 100644 --- a/app/bin/utility.c +++ b/app/bin/utility.c @@ -217,6 +217,115 @@ void FindPos( coOrd * res, double * beyond, coOrd pos, coOrd orig, double angle, } +/* Find Arc Intersection + * Given two circles described by centers and radius (C1, R1) (C2, R2) Find the zero, one or two intersection points + * + */ +BOOL_T FindArcIntersections ( coOrd *Pc, coOrd *Pc2, coOrd center1, DIST_T radius1, coOrd center2, DIST_T radius2) { + double d,a,h; + + d = sqrt((center2.x-center1.x)*(center2.x-center1.x)+(center2.y-center1.y)*(center2.y-center1.y)); + if (d >(radius1+radius2)) return FALSE; //Too far apart + if (d 180) + a1 -= 360; + a0 = NormalizeAngle( a0 + (90.0-a1) ); + Translate( pos, p0, a0, radius ); + return a1*2.0; +} + + #ifdef LATER BOOL_T ClipArc( double a0, double a1, coOrd pos, double radius, coOrd orig, double angle, double size ) { -- cgit v1.2.3