def testCrossProduct(self): self.assertAlmostEqual(cross(Vector(1.0, 0.0), Vector(0.0, 1.0)), 1.0, geom_places) self.assertAlmostEqual(cross(Vector(0.0, 1.0), Vector(1.0, 0.0)), -1.0, geom_places)
def point_in_fov(self, p): if length(p - self.pos) > self.visibility_radius: return False d = p - self.pos ang = atan2(cross(self.real_dir, d), dot(self.real_dir, d)) return -0.5 * self.visibility_fov < ang < 0.5 * self.visibility_fov