コード例 #1
0
    def test_can_get_describe(self):
        p1 = Point3D(1, -2, 0)
        p2 = Point3D(2, 0, -1)
        p3 = Point3D(0, -1, 2)
        plane = Plane(p1, p2, p3)

        describe = plane.get_describe()

        self.assertEqual(describe, (5, -1, 3, -7))
コード例 #2
0
    def _get_plane(self) -> Plane:
        plane_point_values = self._get_corrected_values(
            self.plane_point_values_dict)
        point_1 = Point3D(plane_point_values[0])
        point_2 = Point3D(plane_point_values[1])
        point_3 = Point3D(plane_point_values[2])
        plane = Plane(point_1, point_2, point_3)
        plane.abcd = self._get_int_list(self.abcd)

        return plane
コード例 #3
0
    def test_correct_canonical_view(self):
        p1 = Point3D(1, -2, 0)
        p2 = Point3D(2, 0, -1)
        p3 = Point3D(0, -1, 2)

        plane = Plane(p1, p2, p3)

        self.assertEqual(plane.abcd, (5, -1, 3, -7))
コード例 #4
0
    def test_can_create_plane(self):
        p1 = Point3D(0, 0, 0)
        p2 = Point3D(1, 1, 1)
        p3 = Point3D(1, 0, 1)

        plane = Plane(p1, p2, p3)

        self.assertEqual([plane.p1, plane.p2, plane.p3], [p1, p2, p3])
コード例 #5
0
    def test_can_change_source_data(self):
        p1 = Point3D(0, 0, 0)
        p2 = Point3D(1, 1, 1)
        p3 = Point3D(1, 0, 1)
        plane = Plane(p1, p2, p3)

        p1.x = 99999

        self.assertNotEqual([plane.p1, plane.p2, plane.p3], [p1, p2, p3])
コード例 #6
0
 def test_point_on_plane_one(self):
     p1 = Point3D(1, -2, 0)
     p2 = Point3D(2, 0, -1)
     p3 = Point3D(0, -1, 2)
     plane = Plane(p1, p2, p3)
     self.assertTrue(plane.point_on_plane(Point3D(1, -2, 0)))
コード例 #7
0
 def test_intersection_three(self):
     line = Line(Point3D(1, 5, -1), Point3D(4, 3, 3))
     plane = Plane(Point3D(1, 12, 1), Point3D(1, 1, 1), Point3D(1, 13, 1))
     plane.abcd = (2, -3, -3, 12)  # dirty hack i know
     self.assertFalse(Intersection.have_intersection(line, plane))
コード例 #8
0
 def test_intersection_two(self):
     line = Line(Point3D(-2, 3, -1), Point3D(-1, 6, 1))
     plane = Plane(Point3D(1, 12, 1), Point3D(1, 1, 1), Point3D(1, 13, 1))
     plane.abcd = (0, 2, -1, -11)  # dirty hack i know
     self.assertTrue(Intersection.have_intersection(line, plane))
コード例 #9
0
 def test_point_on_plane_two(self):
     p1 = Point3D(1, -2, 0)
     p2 = Point3D(2, 0, -1)
     p3 = Point3D(0, -1, 2)
     plane = Plane(p1, p2, p3)
     self.assertFalse(plane.point_on_plane(Point3D(1, -2, 99999)))