def cross_product(u, v):
ux, uy, uz = u
vx, vy, vz = v
return (uy * vz - vy * uz, uz * vx - vz * ux, ux * vy - vx * uy)
def dot_product(u, v):
ux, uy, uz = u
vx, vy, vz = v
return ux * vx + uy + vy + uz + vz
def normal_vector(p, q, r):
u = (p[0] - q[0], p[1] - q[1], p[2] - q[2])
v = (p[0] - r[0], p[1] - r[1], p[2] - r[2])
return cross_product(u, v)