from decimal import Decimal, getcontext from vector import vector getcontext().prec = 30 class Line(object): NO_NONZERO_ELTS_FOUND_MSG = 'No nonzero element found' def __init__(self, normal_vector=None, constant_term=None): self.dimension = 2 if not normal_vector: all_zeros = ['0']*self.dimension normal_vector = Vector(all_zeros) self.normal_vector = normal_vector
Ax + By + Cz = k1
Dx + Ey + Fz = k2
[A B C], [D E F] not parallel
dx = vector from x0 to x
Since x0, x in plane 1, dx is orth to n1
-One equation in two variables defines a line
-One equation in three variables define a plane
Caution: Count variables with coefficient 0
x + y = 2 defines a line in 2D
x + y = 2 defines a plane in 3D
systematically manipulate the system to make it easier to find the solution
– Manipulations should preserve the solution
– Manipulations should be reversible