Post Reply 
(41) Intersection points between circles
12-01-2020, 11:59 AM
Post: #11
RE: Intersection points between circles
(12-01-2020 09:25 AM)rawi Wrote:  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.
...
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.

Try it again, but remove the ABS applied to alpha.
It is this extra ABS that made the program complicated, requiring sg2 correction to undo.

Quote:Perhaps by limiting alpha from 0 to pi/2 and doing the correction both for sx and sy I get correct results?

Yes, it does. Here is the proof that sg2 correction undo ABS.

If y2-y1 ≥ 0, ABS does nothing to alpha, and we had already shown it work in previous post.

If y2-y1 < 0, we have 2 possibilities:

x2-x1 ≥ 0: calculated alpha should really be -alpha:
cos(-alpha ± beta) = cos(alpha pi ∓ beta) * 1
sin(-alpha ± beta) = sin(alpha pi ∓ beta) * -1

x2-x1 < 0: calculated alpha should really be -(pi - alpha):
cos(-(pi - alpha) ± beta) = cos(pi - (alpha ± beta)) = cos(alpha ± beta) * -1
sin(-(pi - alpha) ± beta) = -sin(pi - (alpha ± beta)) = sin(alpha ± beta) * -1
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Intersection points between circles - Albert Chan - 12-01-2020 11:59 AM



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