Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ratio = radius / (wreck1.radius - radius)
- shiftx = (x - wreck1.x) * ratio
- shifty = (y - wreck1.y) * ratio
- slope = (wreck2.x - wreck1.x) / (wreck1.y - wreck2.y)
- Yfunct = lambda fx: slope * (fx - x) + y
- place = y - wreck1.y - slope * x
- A = 1 + slope ** 2
- B = 2 * slope * place - 2 * wreck1.x
- C = slope ** 2 + wreck1.x ** 2 - wreck1.radius ** 2
- p3x = ( (- B) + (B ** 2 - 4 * A * C) ** (1/2) ) / (2 * A)
- p4x = ( (- B) - (B ** 2 - 4 * A * C) ** (1/2) ) / (2 * A)
- self.p1 = (x - shiftx, y - shifty)
- self.p2 = (x + shiftx, y + shifty)
- self.p3 = (p3x, Yfunct(p3x))
- self.p4 = (p4x, Yfunct(p4x))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement