(41) Intersection points between circles
|
11-30-2020, 09:03 PM
Post: #8
|
|||
|
|||
RE: Intersection points between circles
(11-30-2020 05:19 PM)rawi Wrote: Then we compute the angle between line between midpoints and paralell to x-axis (steps31-38): What we wanted is the angle between vector ((x1,y1) to (x2,y2)), and the x-axis. 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 Code: function intersection(p1, r1, p2, r2) lua> I = require'complex'.I lua> p1, r1 = 13+4*I, 6.8 lua> p2, r2 = 6+10*I, 4.0 lua> lua> intersection(p1,r1, p2,r2) 6.510943212258769+6.032767080968563*I 9.998703846564759+10.101821154325552*I lua> intersection(p2,r2, p1,r1) 9.99870384656476+10.101821154325554*I 6.51094321225877+6.032767080968563*I Quote:The difference between your solution and mine is that I use directly the coordinates given. You first transfer it to an easier problem by setting one midpoint to (0;0) and the other to (d;0), but then you have it to transfer back. I am not yet sure which solution is easier. Your code do the polar form side, mine the rectangular side. Both ways are equivalent. circles intersections = p1 + r1 * exp((a±b)*I) = p1 + exp(a*I) * (r1*exp(±b*I)) exp(a*I) = (p2-p1) / d r1*exp(±b*I) = d1 ± h*I |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(41) Intersection points between circles - rawi - 11-25-2020, 03:07 PM
RE: Intersection points between circles - Albert Chan - 11-25-2020, 06:16 PM
RE: Intersection points between circles - rawi - 11-25-2020, 06:48 PM
RE: Intersection points between circles - Albert Chan - 11-26-2020, 12:22 AM
RE: Intersection points between circles - Albert Chan - 11-30-2020, 02:19 PM
RE: Intersection points between circles - rawi - 11-30-2020, 05:19 PM
RE: Intersection points between circles - Albert Chan - 11-30-2020 09:03 PM
RE: Intersection points between circles - Albert Chan - 12-01-2020, 12:17 AM
RE: Intersection points between circles - SlideRule - 11-30-2020, 08:51 PM
RE: Intersection points between circles - rawi - 12-01-2020, 09:25 AM
RE: Intersection points between circles - Albert Chan - 12-01-2020, 11:59 AM
RE: Intersection points between circles - rawi - 12-01-2020, 02:04 PM
RE: Intersection points between circles - Albert Chan - 12-10-2020, 01:34 PM
|
User(s) browsing this thread: 4 Guest(s)