To find a normal to a plane, We need
- at least three points on the plane, or
- two vectors
Here are the steps:
- if you have three points p1, p2, p3, you need to obtain two vectors from these points
- find the corss product from these two vectors
Explain using code
import numpy as np
# numpy is a python package that allows you do matrix operation
# we can use array([x, y, z]) to define some points
p1 = np.array([0,0,1])
p2 = np.array([2,2,3])
p3 = np.array([0,3,1])
# by subtracting point from another point, we can calculate
# the vector in the plane
v1 = p2 - p1
v2 = p3 - p1
# Now, if we take the cross product of v1 and v2, we get a
# vector v3 that is normal to these two vector, and that is
# the vector normal to the plane of v1 and v2.
v3 = np.cross(v1, v2)
print(v3)