def test_intersect_with_plane(self): plane1 = PlaneEquation.from_coordinate_plane('XY') plane2 = PlaneEquation.from_coordinate_plane('XZ') line = plane1.intersect_with_plane(plane2) self.assert_sverchok_data_equal(tuple(line.direction.normalized()), (1, 0, 0)) self.assert_sverchok_data_equal(tuple(line.point), (0, 0, 0))
def test_projection_3(self): plane = PlaneEquation.from_coordinate_plane('XY') point1 = (1, 2, 3) point2 = (4, 5, 6) point3 = (7, 8, 9) point4 = (2, 5, 9) result = plane.projection_of_points([point1, point2, point3, point4]) expected = np.array([[1, 2, 0], [4, 5, 0], [7, 8, 0], [2, 5, 0]]) self.assert_numpy_arrays_equal(result, expected)
def test_intersect_with_line(self): plane = PlaneEquation.from_coordinate_plane('XY') line = LineEquation.from_direction_and_point((1, 1, 1), (1, 1, 1)) point = plane.intersect_with_line(line) self.assert_sverchok_data_equal(tuple(point), (0, 0, 0))
def test_distance_to_points(self): plane = PlaneEquation.from_coordinate_plane('XY') points = [(1, 2, 3), (4, 5, 6)] distances = plane.distance_to_points(points) self.assert_numpy_arrays_equal(distances, np.array([3, 6]))
def test_projection_1(self): plane = PlaneEquation.from_coordinate_plane('XY') point = (1, 2, 3) result = plane.projection_of_point(point) self.assert_sverchok_data_equal(tuple(result), (1, 2, 0))
def test_distance_to_point(self): plane = PlaneEquation.from_coordinate_plane('XY') point = (1, 2, 3) distance = plane.distance_to_point(point) self.assertEquals(distance, 3)
def test_check_no(self): plane = PlaneEquation.from_coordinate_plane('XY') p = (7, 8, 1) self.assertFalse(plane.check(p))
def test_check_yes(self): plane = PlaneEquation.from_coordinate_plane('XY') p = (7, 8, 0) self.assertTrue(plane.check(p))