Differentiated projected plane origin and global origin for creating workplanes

Added ProjectedGlobalOrigin as centerOption for worplane constructor to differentiate between projecting the global origin and the current plane origin when creating new workplanes. Also updated projectToPlane method of Vector to only accept plane objects and it no longer does in inplace modification. Updated test converage for ProjectedOrigin and ProjectedGlobalOrigin options.
This commit is contained in:
Michael Greminger
2019-06-01 18:54:56 -05:00
parent 37611308ff
commit ae65dc3579
4 changed files with 35 additions and 40 deletions

View File

@ -161,24 +161,11 @@ class TestCadObjects(BaseTest):
base = Vector(5, 7, 9)
x_dir = Vector(1, 0, 0)
# test passing plane defined by base and normal
point = Vector(10, 11, 12).projectToPlane(base, normal)
self.assertTupleAlmostEquals(point.toTuple(), (59/7, 55/7, 51/7),
decimal_places)
point = Vector(10, 11, 12).projectToPlane(base, normal.normalized())
self.assertTupleAlmostEquals(point.toTuple(), (59/7, 55/7, 51/7),
decimal_places)
# test passing Plane object
point = Vector(10, 11, 12).projectToPlane(Plane(base, x_dir, normal))
self.assertTupleAlmostEquals(point.toTuple(), (59/7, 55/7, 51/7),
decimal_places)
# test wrong number of input arguments
with self.assertRaises(TypeError):
Vector(10,11.12).projectToPlane(1,1,1)
def testMatrixCreationAndAccess(self):
def matrix_vals(m):
return [[m[r,c] for c in range(4)] for r in range(4)]