def testConstruction(self): points = [UnitVector3d.Z(), UnitVector3d.X(), UnitVector3d.Y()] p1 = ConvexPolygon(points) self.assertEqual(points, p1.getVertices()) p2 = ConvexPolygon.cast(p1.clone()) self.assertEqual(p1, p2) p3 = ConvexPolygon([-UnitVector3d.Z(), UnitVector3d.X(), UnitVector3d.Y()]) self.assertNotEqual(p1, p3)
def testCodec(self): p = ConvexPolygon([UnitVector3d.Z(), UnitVector3d.X(), UnitVector3d.Y()]) s = p.encode() self.assertEqual(ConvexPolygon.decode(s), p) self.assertEqual(ConvexPolygon.cast(Region.decode(s)), p)