def testReadPlyCube(ply_name, expected_number_of_faces, expected_number_of_points):
    expected_cube_points = np.loadtxt(getTestFile("expected_" + ply_name + "_points.txt"))
    polyhedron = readPly(getTestFile(ply_name + ".ply"))

    assert len(polyhedron.getFaces()) == expected_number_of_faces
    assert len(polyhedron.getPoints()) == expected_number_of_points
    assert np.allclose(polyhedron.getPoints(), expected_cube_points)
def testMovePolyhedron():
    expected_points = np.loadtxt(getTestFile("expected_moved_points.txt"))
    polyhedron = readPly(getTestFile('small_sphere.ply'))
    polyhedron.move(np.array([1.0, 2.0, 3.0]))
    assert np.allclose(polyhedron.getPoints(), expected_points)
def testRotatePolyhedron():
    expected_points = np.loadtxt(getTestFile("expected_rotated_points.txt"))
    polyhedron = readPly(getTestFile('cube.ply'))
    polyhedron.rotate(np.array([45.0, 45.0, 45.0]))
    assert np.allclose(polyhedron.getPoints(), expected_points)
Beispiel #4
0
def createParticle(mass, color):
    particle = Particle(mass)
    particle.setGeometry(readPly('../objects/sphere.ply'))
    particle.geometry.scale(np.repeat(mass / 2.0, 3))
    particle.geometry.setColor(color)
    return particle