def testCrossProd(self): p1 = Point(1, 0, 0).Normalize() p2 = Point(0, 1, 0).Normalize() p1_cross_p2 = p1.CrossProd(p2) self.assertApproxEq(p1_cross_p2.x, 0) self.assertApproxEq(p1_cross_p2.y, 0) self.assertApproxEq(p1_cross_p2.z, 1)
def testRobustCrossProd(self): p1 = Point(1, 0, 0) p2 = Point(1, 0, 0) self.assertPointApproxEq(Point(0, 0, 0), p1.CrossProd(p2)) # only needs to be an arbitrary vector perpendicular to (1, 0, 0) self.assertPointApproxEq( Point(0.000000000000000, -0.998598452020993, 0.052925717957113), p1.RobustCrossProd(p2))