Example #1
0
def test81(leaf=leaf, scene=None):
    global translation, yt, zt
    if scene is None:
        scene = pgl.Scene()
        Viewer.display(scene)

    mesh = fitting.leaf_shape2(leaf, 10, 7, 7, 1)

    scene += pgl.Translated(translation + (0, yt / 3., 0), mesh)

    Viewer.update()
Example #2
0
def test81(leaf, scene = None):
    global translation, yt, zt
    if scene is None:
        scene = pgl.Scene()
        Viewer.display(scene)

    mesh = fitting.leaf_shape2(leaf,10, 7, 7, 1)

    scene += pgl.Translated(translation+(0,yt/3.,0), mesh)
    
    Viewer.update()
Example #3
0
def test1(leaf=leaf, scene=None):
    """
    Fit the leaf, create a mesh and draw it with plantGL.
    """
    global translation
    if scene is None:
        scene = pgl.Scene()
        Viewer.display(scene)

    x, y, s, r = leaf
    spline_leaf, leaf_surface = fitting.fit_leaf(x, y, s, r)
    mesh = fitting.discretize(spline_leaf, 30, 7, 1)

    scene += pgl.Translated(translation, mesh)
    Viewer.update()
Example #4
0
def test1(leaf, scene = None):
    """
    Fit the leaf, create a mesh and draw it with plantGL.
    """
    global translation
    if scene is None:
        scene = pgl.Scene()
        Viewer.display(scene)

    x, y, s, r= leaf
    spline_leaf, leaf_surface = fitting.fit_leaf(x, y, s, r)
    mesh = fitting.discretize(spline_leaf,30, 7, 1) 
    
    scene += pgl.Translated(translation, mesh)
    Viewer.update()
Example #5
0
def test8(leaf=leaf, scene=None):
    global translation, zt
    if scene is None:
        scene = pgl.Scene()
        Viewer.display(scene)

    x, y, s, r = leaf
    leaf_new, leaf_surface = fitting.fit2(x, y, s, r)

    pts, ind = fitting.mesh2(leaf_new, 7, 7, 1)
    #pts2, ind2 = fitting.qslim(13, pts, ind)
    #mesh = fitting.plantgl_shape(pts2, ind2)

    #sc=pgl.SurfComputer(pgl.Discretizer())
    #mesh.apply(sc)
    #scale_z = leaf_surface*7 / (sc.surface)
    #mesh_final = mesh.transform(pgl.Scaling((1,1,scale_z)))
    #mesh_final = mesh
    scene += pgl.Translated(translation, fitting.plantgl_shape(pts, ind))
    #scene += pgl.Translated(translation+(0,yt/3.,0), mesh_final)

    Viewer.update()
Example #6
0
def test8(leaf, scene = None):
    global translation, zt
    if scene is None:
        scene = pgl.Scene()
        Viewer.display(scene)

    x, y, s, r= leaf
    leaf_new, leaf_surface = fitting.fit2(x, y, s, r)

    pts, ind = fitting.mesh2(leaf_new, 7, 7, 1) 
    #pts2, ind2 = fitting.qslim(13, pts, ind)
    #mesh = fitting.plantgl_shape(pts2, ind2)

    #sc=pgl.SurfComputer(pgl.Discretizer())
    #mesh.apply(sc)
    #scale_z = leaf_surface*7 / (sc.surface)
    #mesh_final = mesh.transform(pgl.Scaling((1,1,scale_z)))
    #mesh_final = mesh
    scene += pgl.Translated(translation, fitting.plantgl_shape(pts, ind))
    #scene += pgl.Translated(translation+(0,yt/3.,0), mesh_final)
    
    Viewer.update()
    crsSect3 = CrossSection((0., 0.), (0.5, 0.), (1., 0.))
    crsSect4 = CrossSection((0., 2.), (0.5, 0.), (1., 0.))
    crsSect5 = CrossSection((0., 2.), (0.5, 0.), (0.6, 0.3), (1., 0.))

    tc = InterpolatedProfile()
    tc.add_cross_sections(0.0, crsSect1,
    #0.5, crsSect2,
                          1.0, crsSect2)

    from openalea.vpltk.qt import QtGui
    app=QtGui.QApplication([])

    scene = Scene()
    Viewer.display(scene)


    scene += tc.interpolating_surface
#X     tc.create_control_point(0.25)
#X     scene += tc.interpolating_surface
#X     tc.create_cross_section(0.75)
#X     scene += tc.interpolating_surface
#X 
    Viewer.update()
    # slice_patch(scene, tc, slices = 11)

    #the following will add a new patch to the view, not update the existing one.
    #################################################################################
    # tc.create_control_point(0.25);scene+=tc.interpolating_surface;Viewer.update() #
    # tc.create_cross_section(0.75);scene+=tc.interpolating_surface;Viewer.update() #
    #################################################################################
Example #8
0
    crsSect5 = CrossSection((0., 2.), (0.5, 0.), (0.6, 0.3), (1., 0.))

    tc = InterpolatedProfile()
    tc.add_cross_sections(
        0.0,
        crsSect1,
        #0.5, crsSect2,
        1.0,
        crsSect2)

    from openalea.vpltk.qt import QtGui
    app = QtGui.QApplication([])

    scene = Scene()
    Viewer.display(scene)

    scene += tc.interpolating_surface
    #X     tc.create_control_point(0.25)
    #X     scene += tc.interpolating_surface
    #X     tc.create_cross_section(0.75)
    #X     scene += tc.interpolating_surface
    #X
    Viewer.update()
    # slice_patch(scene, tc, slices = 11)

    #the following will add a new patch to the view, not update the existing one.
    #################################################################################
    # tc.create_control_point(0.25);scene+=tc.interpolating_surface;Viewer.update() #
    # tc.create_cross_section(0.75);scene+=tc.interpolating_surface;Viewer.update() #
    #################################################################################