You are viewing a single comment's thread. Return to all comments →
def solve(points): # | x - x1 y - y1 z - z1 | # | x2 - x1 y2 - y1 z2 - z1 | = 0 # | x3 - x1 y3 - y1 z3 - z1 |
def solve(points):
# | x - x1 y - y1 z - z1 | # | x2 - x1 y2 - y1 z2 - z1 | = 0 # | x3 - x1 y3 - y1 z3 - z1 |
x1, y1, z1 = points[0][0], points[0][1], points[0][2] x2, y2, z2 = points[1][0], points[1][1], points[1][2] x3, y3, z3 = points[2][0], points[2][1], points[2][2] a = ((y2-y1) * (z3-z1)) - ((z2-z1) * (y3-y1)) b = ((x2-x1) * (z3-z1)) - ((z2-z1) * (x3-x1)) c = ((x2-x1) * (y3-y1)) - ((x3-x1) * (y2-y1)) for x, y, z in points[3:]: val = a*(x-x1) - b*(y-y1) - c*(z-z1) if val != 0: return "NO" return "YES"
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Planes
You are viewing a single comment's thread. Return to all comments →