Esempio n. 1
0
def test_area_triangle(triangle, R):
    assert close(area_polygon(triangle.points), 0.5)
    assert close(area_polygon_xy(triangle.points), 0.5)
    assert close(area_triangle(triangle.points), 0.5)
    assert close(area_triangle_xy(triangle.points), 0.5)
    assert close(triangle.area, 0.5)
    triangle.transform(R)
    assert close(area_polygon(triangle.points), 0.5)
    assert close(area_polygon_xy(triangle.points), 0.0)
    assert close(area_triangle(triangle.points), 0.5)
    assert close(area_triangle_xy(triangle.points), 0.0)
    assert close(triangle.area, 0.5)
Esempio n. 2
0
def test_volume_polyhedron(polyhedron, volume):
    if volume is None:
        L = length_vector(
            subtract_vectors(polyhedron.vertices[0], polyhedron.vertices[1]))
        volume = L * L * L
    V = volume_polyhedron(polyhedron)
    assert close(V, volume)
Esempio n. 3
0
def test_area_square(square, R):
    assert close(area_polygon(square.points), 1)
    assert close(area_polygon_xy(square.points), 1)
    assert close(square.area, 1)
    square.transform(R)
    assert close(area_polygon(square.points), 1)
    assert close(area_polygon_xy(square.points), 0)
    assert close(square.area, 1)
Esempio n. 4
0
def test_angle_vectors(u, v, angle):
    assert close(angle_vectors(u, v), angle)
Esempio n. 5
0
def test_angle_planes(a, b, angle):
    assert close(angle_planes(a, b), angle)