def test_solid_disc_closest_pt_to_on_axis(self): from lepton.domain import Disc disc = Disc((0, 3, 0), (0, 1, 0), 3) for point, closest, normal in [ ((0, 4, 0), (0, 3, 0), (0, 1, 0)), ((0, 3, 0), (0, 3, 0), (0, 0, 0)), ((0, 2, 0), (0, 3, 0), (0, -1, 0)), ]: p, N = disc.closest_point_to(point) self.assertVector(p, closest) self.assertVector(N, normal)
def test_disc_closest_pt_to(self): from lepton.domain import Disc from lepton.particle_struct import Vec3 disc = Disc((-3, 1, 2), (0, 1, 1), 4, 1) for point, closest, normal in [ ((-2, 1, 2), (-2, 1, 2), (0, 0, 0)), ((-2, 2, 2), (-2, 1.5, 1.5), Vec3(0, 1, 1).normalize()), ((-2, -1, 2), (-2, 0, 3), Vec3(0, -1, -1).normalize()), ((-3, 5, 8), (-3, 0, 3), Vec3(0, 1, 1).normalize()), ((-3, 1, 2), (-3, 1, 2), (0, 0, 0)), ((-3, 3, 4), (-3, 1, 2), (0, 0, 0)), ((-3, 0, 1), (-3, 1, 2), (0, 0, 0)), ]: p, N = disc.closest_point_to(point) self.assertVector(p, closest) self.assertVector(N, normal)