Tests that a plane offset from the origin works ok too
(self)
| 91 | ) |
| 92 | |
| 93 | def testOffsetPlanes(self): |
| 94 | "Tests that a plane offset from the origin works ok too" |
| 95 | p = Plane.XY(origin=(10.0, 10.0, 0)) |
| 96 | |
| 97 | self.assertTupleAlmostEquals( |
| 98 | (11.0, 11.0, 0.0), p.toWorldCoords((1.0, 1.0)).toTuple(), 2 |
| 99 | ) |
| 100 | self.assertTupleAlmostEquals( |
| 101 | (2.0, 2.0), p.toLocalCoords(Vector(12.0, 12.0, 0)).toTuple(), 2 |
| 102 | ) |
| 103 | |
| 104 | # TODO test these offsets in the other dimensions too |
| 105 | p = Plane.YZ(origin=(0, 2, 2)) |
| 106 | self.assertTupleAlmostEquals( |
| 107 | (0.0, 5.0, 5.0), p.toWorldCoords((3.0, 3.0)).toTuple(), 2 |
| 108 | ) |
| 109 | self.assertTupleAlmostEquals( |
| 110 | (10, 10.0, 0.0), p.toLocalCoords(Vector(0.0, 12.0, 12.0)).toTuple(), 2 |
| 111 | ) |
| 112 | |
| 113 | p = Plane.XZ(origin=(2, 0, 2)) |
| 114 | r = p.toWorldCoords((1.0, 1.0)).toTuple() |
| 115 | self.assertTupleAlmostEquals((3.0, 0.0, 3.0), r, 2) |
| 116 | self.assertTupleAlmostEquals( |
| 117 | (10.0, 10.0), p.toLocalCoords(Vector(12.0, 0.0, 12.0)).toTuple(), 2 |
| 118 | ) |
| 119 | |
| 120 | def testXYPlaneBasics(self): |
| 121 | p = Plane.named("XY") |
nothing calls this directly
no test coverage detected