コード例 #1
0
class TestCenterOfFace():

    v_cube, f_cube = wavefront.read_obj('./integration/cube.obj')
    cof = wavefront.center_of_face(v_cube, f_cube)

    def test_size(self):
        np.testing.assert_allclose(self.cof.shape, self.f_cube.shape)
コード例 #2
0
def test_normal_face_plot():
    """Plot the normals to the faces on a mesh and view in Mayavi
    """

    v, f = wavefront.read_obj('./integration/cube.obj')
    normal_face = wavefront.normal_face(v, f)
    cof = wavefront.center_of_face(v, f)

    mfig = graphics.mayavi_figure()
    _ = graphics.mayavi_addMesh(mfig, v, f)

    for p1, u in zip(cof, normal_face):
        graphics.mayavi_addPoint(mfig, p1, radius=0.1, color=(1, 0, 0))
        graphics.mayavi_addLine(mfig, p1, u + p1)

    graphics.mayavi_addTitle(mfig,
                             'Normals to each face',
                             color=(0, 0, 0),
                             size=0.5)
コード例 #3
0
 def test_center_face_function(self):
     cof = wavefront.center_of_face(self.v, self.f)
     np.testing.assert_allclose(cof, self.center_face)