Post Reply 
(41) Intersection points between circles
12-01-2020, 09:25 AM
Post: #10
RE: Intersection points between circles
Hi Albert,

You wrote:
Quote:We should have: -pi ≤ alpha ≤ +pi

Using arcsin, we have -pi/2 ≤ alpha ≤ pi/2. sg1/sg2 correction will not fix this.
Correction should be:

      alpha = arcsin((y2-y1)/z); if x2 < x1 then alpha = pi - alpha end

Or, alpha = arccos((x2-x1)/z); if y2 < y1 then alpha = -alpha end

I forgot to mention that I take the absolute figure for computing alpha. I compute
alpha = abs(arcsin((y2-y1)/z)) (see line 37 of program listing). So I limit it to the interval from 0 to pi/2.

You wrote:
Quote:sy does not require correction.

The results tell me that the correction is needed.
Take the following example:
x1 = -1, y1= -3, r1 = 4; x2 = 6, y2 = 2, r2 = 5
If computed it with correction I get:
sx1 = 1,3106; sy1=0.2651; sx2= 2,8380; sy2 = -1.8732 which is correct
If I keep the circles, but use the former circle 2 as circle 1 and vice versa I get:
sx1 = 2,8380; sy1= -1.8732; sx2 = 1.3106; sy2 = 0.2651
So the numbers of the intersection points are exchanged, but they still are correct.

If I compute without correction of sy (I delete lines 83, 84, 61, 62 of the program) I get:
For x1=-1, y1=-3, r1 = 4, x2 = 6, y2 = 2, r2 = 5 the same results as before.
But if I change the number of circles, i.e.
x1=6, y1=2, r1=5, x2=-1, y2=-3, r2=4
I get
x1 = 2.8380, y1=5.8380, x2=1,3106, y2=3,7349 which is not correct for the y-coordinates.

Perhaps by limiting alpha from 0 to pi/2 and doing the correction both for sx and sy I get correct results? I tested the program with numerous examples and it always delivered correct results.

Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Intersection points between circles - rawi - 12-01-2020 09:25 AM

User(s) browsing this thread: 1 Guest(s)