Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- P0 = {
- X = 5,
- Y = -15,
- R = 5
- }
- P1 = {
- X = 6,
- Y = -13,
- R = 5
- }
- Distance = math.sqrt((P1.X-P0.X)^2+(P1.Y-P0.Y)^2);
- A = (P0.R^2 - P1.R^2 + Distance^2)/(2*Distance);
- B = Distance-A;
- H = math.sqrt(P0.R^2-A^2);
- dirToP1X = (P1.X-P0.X)/Distance;
- dirToP1Y = (P1.Y-P0.Y)/Distance;
- P2 = {
- X = P0.X+(A*dirToP1X);
- Y = P0.Y+(A*dirToP1Y);
- }
- dirToP3X = (P1.Y-P0.Y)/Distance;
- dirToP3Y = -1*(P1.X-P0.X)/Distance;
- P3 = {
- X = P2.X+H*dirToP3X;
- Y = P2.Y+H*dirToP3Y;
- }
- P4 = {
- X = P2.X-H*dirToP3X;
- Y = P2.Y-H*dirToP3Y;
- }
- print(P4.X.." , "..P4.Y);
- print(P3.X.." , "..P3.Y);
Advertisement
Add Comment
Please, Sign In to add comment