Points in a plane using null space

A plane can be defined using its normal vector n. Points in the plane represented by this vector can be generated by first computing the null space of this vector. This gives the two basis vectors (assuming 3D space) for the plane. These basis vectors can then be scaled as necessary to generate points. For example, to generate a circle of points in a plane:

import numpy as np
import scipy as sp
import scipy.linalg

n = np.array([0,0,1]);
plane_basis = sp.linalg.null_space([n])

numPoints = 4
theta = np.linspace(0, 2*np.pi, numPoints+1)
x = np.cos(theta[:-1])
y = np.sin(theta[:-1])

# points is a 3xnumPoints matrix where each column is a point
points = plane_basis @ np.array([x, y])

An easier/less expensive method can be found at [[202209132014_generating-perpendicular-basis-vectors-in-a-plane]]

Backlinks