示例#1
0
def test_polyline_get_Iz():
    pl = PolyLine([(0, 3), (10, 3), (10, 0), (0, 0)], copy_data=True)
    for angle in np.random.uniform(-180, 180, 1000):
        pl1 = pl.add_vec(Vec2(10, 20))
        plt = pl1.transform(Mat2.from_angle(angle, True))
        cm = plt.get_center_mass()
        assert plt.get_Iz(cm) == approx((10**2 + 3**2) / 12)
示例#2
0
def test_polyline_area4():
    pl = PolyLine([(1, 2), (11, 2), (10, 0), (0, 0)], copy_data=True)
    for angle in np.random.uniform(-180, 180, 1000):
        pl1 = pl.add_vec(Vec2(10, 20))
        plt = pl1.transform(Mat2.from_angle(angle, True))
        assert plt.get_area() == approx(20)