def test_add(self):

        point1 = geometry.Point2D(1, 2)
        point2 = geometry.Point2D(1, 2)
        point3 = point1 + point2
        self.assertEqual(point3.x, 2)
        self.assertEqual(point3.y, 4)
Beispiel #2
0
    def test_fits_true(self):
        """
        tests where rectangles do fit inside a dummy aerofoil class
        """
        rectangle = layout.Rectangle(0.3, 0.3)
        rectangle.location = layout.Point2D(0.5, 0.1)
        self.assertTrue(self.aerofoil.check_fits(rectangle))

        rectangle = layout.Rectangle(0.5, 0.5)
        rectangle.location = layout.Point2D(0.75, 0.25)
        self.assertTrue(self.aerofoil.check_fits(rectangle))
Beispiel #3
0
    def test_fits_false_outrange(self):
        """
        tests function returns false when the rectangle is not within the x
        range of the aerofoil
        """
        rectangle = layout.Rectangle(0.5, 0.5)
        rectangle.location = layout.Point2D(1, 0)
        self.assertFalse(self.aerofoil.check_fits(rectangle))

        rectangle = layout.Rectangle(0.5, 0.5)
        rectangle.location = layout.Point2D(2, 0)
        self.assertFalse(self.aerofoil.check_fits(rectangle))
    def test_corner_points(self):
        """
        test that the corner point properties are correct
        """
        self.assertEqual(self.rectangle.top_left_point,
                         geometry.Point2D(0, 10))
        self.assertEqual(self.rectangle.top_right_point,
                         geometry.Point2D(5, 10))

        self.assertEqual(self.rectangle.bottom_left_point,
                         geometry.Point2D(0, 0))
        self.assertEqual(self.rectangle.bottom_right_point,
                         geometry.Point2D(5, 0))
Beispiel #5
0
    def test_fits_false(self):
        """
        tests that the rectangle does not fit inside the aerofoil
        """
        rectangle = layout.Rectangle(1, 1)
        self.assertFalse(self.aerofoil.check_fits(rectangle))

        rectangle = layout.Rectangle(0.5, 0.5)
        rectangle.location = layout.Point2D(0.5, 0.5)
        self.assertFalse(self.aerofoil.check_fits(rectangle))

        rectangle = layout.Rectangle(0.5, 0.5)
        rectangle.location = layout.Point2D(0.75, 0)
        self.assertFalse(self.aerofoil.check_fits(rectangle))
    def test_corner_points_shifted(self):
        """
        test the corner points are obtained when the objects location is not
        the default value
        """
        self.rectangle.location = geometry.Point2D(10, 0)

        self.assertEqual(self.rectangle.top_left_point,
                         geometry.Point2D(10, 10))
        self.assertEqual(self.rectangle.top_right_point,
                         geometry.Point2D(15, 10))

        self.assertEqual(self.rectangle.bottom_left_point,
                         geometry.Point2D(10, 0))
        self.assertEqual(self.rectangle.bottom_right_point,
                         geometry.Point2D(15, 0))
Beispiel #7
0
 def test_fits_true_real_aerofoil(self):
     """
     test rectangle fits into an actual aerofoil shape
     """
     aero = aerofoil.Aerofoil.develop_aerofoil(0.2, -0.2, 0.2, 0.2, 0.2)
     rectangle = layout.Rectangle(0.1, 0.1)
     rectangle.location = layout.Point2D(0.1, 0.05)
     self.assertTrue(aero.check_fits(rectangle))
    def test_get_xy_projection(self):
        self.cuboid.location = self.location

        self.assertEqual(self.cuboid.project_xy.x_size, 2)
        self.assertEqual(self.cuboid.project_xy.y_size, 3)

        xy_location = geometry.Point2D(self.location.x, self.location.y)
        self.assertEqual(self.cuboid.project_xy.location, xy_location)
    def test_get_xz_projection(self):
        self.cuboid.location = self.location

        self.assertEqual(self.cuboid.project_xz.x_size, 2)
        self.assertEqual(self.cuboid.project_xz.y_size, 4)

        xz_location = geometry.Point2D(self.location.x, self.location.z)
        self.assertEqual(self.cuboid.project_xz.location, xz_location)
 def test_reflect_y(self):
     point1 = geometry.Point2D(1, 2)
     self.assertEqual(point1.reflect_y(), geometry.Point2D(1, -2))
    def test_equals(self):

        point1 = geometry.Point2D(1, 2)
        point2 = geometry.Point2D(1, 2)
        self.assertEqual(point1, point2)
 def test_centroid_negative(self):
     """
     get centroid when the x value is negative
     """
     self.rectangle = geometry.Rectangle(-5, 10)
     self.assertEqual(self.rectangle.centroid, geometry.Point2D(-2.5, 5))
 def test_centroid(self):
     self.assertEqual(self.rectangle.centroid, geometry.Point2D(2.5, 5))