Find the intersection of two lines: Difference between revisions

Line 1,298:
PVector lineInstersect(float Ax1, float Ay1, float Ax2, float Ay2,
float Bx1, float By1, float Bx2, float By2) {
// returns null if there is no intersection
float uA, uB;
float d = ((By2 - By1) * (Ax2 - Ax1) - (Bx2 - Bx1) * (Ay2 - Ay1));
Line 1,334 ⟶ 1,335:
def line_instersect(Ax1, Ay1, Ax2, Ay2,
Bx1, By1, Bx2, By2):
""" returns a (x, y) tuple or None if there is no intersection """
try:
uA = ((Bx2 - Bx1) * (Ay1 - By1) - (By2 - By1) * (Ax1 - Bx1)) / \
Anonymous user