当前位置: 首页>>代码示例>>Python>>正文


Python book.Page类代码示例

本文整理汇总了Python中superficie.book.Page的典型用法代码示例。如果您正苦于以下问题:Python Page类的具体用法?Python Page怎么用?Python Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Page类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self):
        """F(x,y)=x^2 + y^2 - z = 0"""
        Page.__init__(self, u"Paraboloide Elíptico<br><br>F(x,y)=(x, y, x<sup>2</sup>/a<sup>2</sup> + y<sup>2</sup>/b<sup>2</sup>)")

        z = 0.5
        par = RevolutionPlot3D(lambda r, t: r ** 2 + z, (0, 1.42), (0, 2 * pi))

        x, y, z2, u, v, cose, sen, t = createVars(['x', 'y', 'z', 'u', 'v', 'cos', 'sen', 't'])

        mesh1 = Plot3D(lambda x, y, h: h * (x ** 2 + y ** 2 + z - .01), (-1, 1), (-1, 1))
        #mesh1.addEqn(x**2+y**2 - z2**2 == 1)
        mesh1.addFunction(lambda x, y, h: h * (x ** 2 + y ** 2 + z + .01))
        mesh1.setLinesVisible(True)
        mesh1.setMeshVisible(False)
        mesh1.setBoundingBox(zrange=(-1, 3.0))
        par.setAmbientColor(_1(145, 61, 74))
        par.setDiffuseColor(_1(145, 61, 74))
        par.setSpecularColor(_1(145, 61, 74))
        baseplane = BasePlane()
        baseplane.setHeight(0)
        baseplane.setRange((-2, 2, 7))

        self.addChild(par)
        self.addChild(mesh1)
        self.addChild(baseplane)
开发者ID:rlerichev,项目名称:geomdif,代码行数:25,代码来源:Superficies1.py

示例2: __init__

    def __init__(self):
        Page.__init__(self, u"Planos osculador, normal y rectificante")

        tmin = -2 * pi
        tmax = 2 * pi
        ## ============================================
        sq2 = 2 ** 0.5
        inv_sq2 = (1. / sq2)

        def helix(s):
            s_times_sq2 = inv_sq2 * s
            return Vec3(cos(s_times_sq2), sin(s_times_sq2), s_times_sq2)

        def tangent(s):
            s_div_sq2 = s / sq2
            return Vec3(-inv_sq2 * sin(s_div_sq2), inv_sq2 * cos(s_div_sq2), inv_sq2)

        def normal(s):
            s_div_sq2 = s / sq2
            return Vec3(-cos(s_div_sq2), -sin(s_div_sq2), 0)

        def bi_normal(s):
            s_div_sq2 = s / sq2
            return Vec3(inv_sq2 * sin(s_div_sq2), -inv_sq2 * cos(s_div_sq2), inv_sq2)

        curve = Curve3D(helix, (tmin, tmax, 100), _1(206, 75, 150), 2)
        self.addChild(curve)

        #=======================================================================
        # Vectors
        #=======================================================================
        field_tangent = curve.attachField("tangent", tangent).show()
        field_normal = curve.attachField("normal", normal).show()
        field_binormal = curve.attachField("binormal", bi_normal).show()
        field_tangent.setDiffuseColor( _1(255, 0, 0) )
        field_normal.setDiffuseColor( _1(255, 255, 0) )
        field_binormal.setDiffuseColor( _1(0, 0, 255) )

        #=======================================================================
        # Planes
        #=======================================================================

        def get_points(v1, v2): return v2.p1, v1.p2, v2.p2

        color = (.5, .5, .5)
        plane_osculating = Plane(color, *get_points(field_tangent, field_normal))
        plane_normal = Plane(color, *get_points(field_normal, field_binormal))
        plane_rectifying = Plane(color, *get_points(field_binormal, field_tangent))
        self.addChildren([plane_osculating, plane_normal, plane_rectifying])

        def update_planes(n):
            plane_osculating.setPoints(*get_points(field_tangent, field_normal))
            plane_normal.setPoints(*get_points(field_normal, field_binormal))
            plane_rectifying.setPoints(*get_points(field_binormal, field_tangent))

        r = (5000, 0, len(curve) - 1)
        animation = Animatable(update_planes, r)
        self.setupAnimations([
            AnimationGroup([field_tangent, field_normal, field_binormal, animation], r)
        ])
开发者ID:rlerichev,项目名称:geomdif,代码行数:60,代码来源:Curvas3.py

示例3: __init__

    def __init__(self):
        Page.__init__(self, u"Hélice circular, curvatura y torsión<br><br>(cos s/&radic;2, sen s/&radic;2, s/&radic;2)")
        self.camera_position = (10, -10, 10)
        self.showAxis(False)
        tmin = -2 * pi
        tmax = 2 * pi
        npuntos = 300
        self.addChild(Cylinder(_1(185, 46, 61), tmax - tmin, 2))
        ## ============================================
        # 1 implica primer derivada, 2 implica segunda derivada
        def param1hc(t):
            return 2*Vec3(cos(t), sin(t), t/3.0)
        def param2hc(t):
            return 2*Vec3(-sin(t), cos(t), 1/3.0)
        def param3hc(t):
            return 2*Vec3(-cos(t), -sin(t), 0)
        def param4hc(t):
            return 2*Vec3(sin(t)/3.0, -cos(t)/3.0, 1.0)

        espiral = Curve3D(param1hc, (tmin*1.5, tmax*1.5, npuntos), color=_1(255, 255, 255))
        tangente = espiral.attachField("tangente", param2hc).setLengthFactor(1).setWidthFactor(.6)
        tangente.setRadius( 0.06 )
        tangente.setDiffuseColor( _1(20,240,20) )
        normal = espiral.attachField("normal", param3hc).setLengthFactor(1).setWidthFactor(.6)
        normal.setRadius( 0.06 )
        normal.setDiffuseColor( _1(240,120,20) )
        binormal = espiral.attachField("binormal", param4hc).setLengthFactor(1).setWidthFactor(.6)
        binormal.setRadius( 0.06 )
        binormal.setDiffuseColor( _1(20,120,240) )
        self.addChild(espiral)
        self.setupAnimations([ AnimationGroup([tangente, normal, binormal], (10000,0,len(espiral)-1)) ])
开发者ID:jpablo,项目名称:geomdif,代码行数:31,代码来源:CurvasAlabeadas.py

示例4: __init__

    def __init__(self):
        Page.__init__(self, u"Otro campo en la esfera con dos singularidades")

        par_esfera = lambda u, v: Vec3(sin(u) * cos(v), sin(u) * sin(v), cos(u))

        def esfera_u(u,v):
            return Vec3(-cos(u)*cos(v)*sin(u), -cos(u)*sin(u)*sin(v), 1-cos(u)**2)

        parab = ParametricPlot3D(par_esfera, (0,pi,150),(0,2*pi,100))
        parab.setTransparency(0.4)
        parab.setTransparencyType(SoTransparencyType.SORTED_OBJECT_SORTED_TRIANGLE_BLEND)
        parab.setDiffuseColor(_1(68, 28, 119))
        self.addChild(parab)

        def make_curva(c):
            return lambda t: par_esfera(t,c)

        def make_tang(c):
            return lambda t: esfera_u(t,c)

        tangentes = []
        curves = []
        ncurves = 70
        for c in range(0,ncurves+1):
            ## -1 < ct < 1
            ct = c/float(ncurves) * 2*pi
            curve = Curve3D(make_curva(ct),(-(pi-.02),-.02,100), width=1)
            tangent = curve.attachField("tangente", make_tang(ct)).setLengthFactor(.4).setWidthFactor(.1).show()
            tangentes.append(tangent)
            curves.append(curve)
        self.addChildren(curves)
        self.setupAnimations([AnimationGroup(tangentes, (6000, 0, 99))])
开发者ID:jpablo,项目名称:geomdif,代码行数:32,代码来源:CamposVectoriales.py

示例5: __init__

    def __init__(self):
        Page.__init__(self, u"Campo con un ciclo límite en el plano")

        par_plano = lambda u, v: Vec3(u,v,0)

        def plano_u(u,v):
            return Vec3(1,0,0)

        def plano_v(u,v):
            return Vec3(0,1,0)

        parab = ParametricPlot3D(par_plano, (-3,3,20),(-3,3,20))
        parab.setTransparency(0.4)
        parab.setTransparencyType(SoTransparencyType.SORTED_OBJECT_SORTED_TRIANGLE_BLEND)
        parab.setDiffuseColor(_1(68, 28, 119))
        self.addChild(parab)

        # Esta familia de curvas NO es solucion de un sistema de ecuaciones
        # diferenciales de orden 1 (se intersectan)...
        # pero se parece a la solucion del sistema presentado
        def make_curva(c):
            return lambda t: Vec3( e**(-(c*t+c))*cos(t), e**(-(c*t+c))*sin(t), 0.02 )

        def make_tang(c):
            return lambda t: Vec3( -c*e**(-(c*t+c))*cos(t) - e**(-(c*t+c))*sin(t),
              -c*e**(-(c*t+c))*sin(t) + e**(-(c*t+c))*cos(t), 0.02 )

        tangentes = []
        ncurves = 7
        steps = 80

        for c in range(0,ncurves):
            ## -1 < ct < 1
            ct = c/20.0 - float(ncurves-1)/40.0
            curva = Curve3D(make_curva(ct),(0,2*pi,steps), width=1)
            if ct == 0:
                curva = Curve3D(make_curva(ct),(0,2*pi,steps), width=1, color=_1(20, 240, 40))
            curva.attachField("tangente", make_tang(ct)).setLengthFactor(.5).setWidthFactor(.25).add_tail(0.025)
            curva.fields['tangente'].show()
            tangentes.append(curva.fields['tangente'])
            self.addChild(curva)


        def animaTangentes(n):
            for tang in tangentes:
                tang.animateArrow(n)

        a1 = Animation(animaTangentes, (6000, 0, steps-1))
        self.setupAnimations([a1])

        critic = Sphere( center=Vec3(0,0,0), radius=0.025, color=_1(240,10,20) )
        self.addChild(critic)
开发者ID:rlerichev,项目名称:geomdif,代码行数:52,代码来源:CamposVectoriales.py

示例6: __init__

 def __init__(self):
     Page.__init__(self, u"Elipsoide")
     param = lambda u,v: (cos(u)*cos(v), 1.5*cos(v)*sin(u), 2*sin(v))
     elipsoide = ParametricPlot3D(param, (-pi, pi), (-pi/2,pi/2))
     col = _1(84,129,121)
     elipsoide.setAmbientColor(col).setDiffuseColor(col).setSpecularColor(col)
     par1 = lambda u,v: Vec3(-sin(u)*cos(v), 1.5*cos(u)*cos(v), 0)
     par2 = lambda u,v: Vec3(-cos(u)*sin(v), -1.5*sin(u)*sin(v), 2*cos(v))
     tp = TangentPlane2(param,par1,par2,(0,0),_1(252,250,225))
     self.addChild(elipsoide)
     self.addChild(tp)
     Slider(rangep=('u', -pi,pi,0,20),func=tp.setU, parent=self)
     Slider(rangep=('v', -pi/2,pi/2,0,20),func=tp.setV,parent=self)
开发者ID:jpablo,项目名称:geomdif,代码行数:13,代码来源:Superficies3.py

示例7: __init__

    def __init__(self, parent=None):
        Page.__init__(self, u"Paralelos y círculos máximos de la esfera")
        self.showAxis(False)

        pmin = 0
        pmax = 2 * pi
        r2 = 3.
        l = -1

        def puntos2(t):
            return Vec3(-cos(t), -sin(t), 0)

        def make_circulo(t):
            return partial(par_esfera, t)

        par_esfera = lambda t, f: Vec3(sin(t) * cos(f), sin(t) * sin(f), cos(t))
        par_circulo = lambda f: Vec3(sin(t) * cos(f), sin(t) * sin(f), cos(t))
        par_circulo_der = lambda f: Vec3(-cos(f) * sin(t), -sin(t) * sin(f), 0)
        par_circulo_maximo = make_circulo(pi / 2)

        esf = ParametricPlot3D(par_esfera, (0, pi, 100), (0, 2 * pi, 120))
        esf.setTransparencyType(SoTransparencyType.SORTED_OBJECT_SORTED_TRIANGLE_BLEND)
        esf.setTransparency(0.3).setDiffuseColor(_1(68, 28, 119)).setSpecularColor(_1(99, 136, 63))
        VisibleCheckBox("esfera", esf, True, parent=self)
        self.addChild(esf)

        cm = Curve3D(par_circulo_maximo, (pmin, pmax, 200), color=_1(255, 255, 255))
        self.addChild(cm)
        aceleracion_cm = cm.attachField("aceleracion", puntos2).show().setLengthFactor(.98).setWidthFactor(.3)

        tini=1.0472
        par_circulo.func_globals['t'] = tini

        par = Curve3D(par_circulo, (pmin, pmax, 200), color=_1(255, 221, 0))
        self.addChild(par)
        aceleracion_par = par.attachField("aceleracion", par_circulo_der).show().setLengthFactor(1).setWidthFactor(.3)

        circle_2 = SimpleSphere(Vec3(0, 0, cos(tini)), radius=.02)
        circle_2_tr = circle_2.getByName("Translation")

        self.addChild(circle_2)
        self.addChild(SimpleSphere(Vec3(0, 0, 0), radius=.02))

        ## los meridianos
        sep = SoSeparator()
        mer = Curve3D(lambda t: (0, .99 * cos(t), .99 * sin(t)), (pmin, pmax, 100), color=_1(18, 78, 169))
        for i in range(24):
            sep.addChild(rot(2 * pi / 24))
            sep.addChild(mer.root)
        self.addChild(sep)

        # the sphere rotation axis
        self.addChild(Line([(0, 0, -1.2), (0, 0, 1.2)], width=2))

        def test(t):
            par_circulo.func_globals['t'] = t
            par.updatePoints()
            circle_2_tr.translation = (0, 0, cos(t))

        Slider(('t', 0.1, pi-.1, tini, 100), test, duration=4000, parent=self)
        self.setupAnimations([aceleracion_cm, aceleracion_par])
开发者ID:rlerichev,项目名称:geomdif,代码行数:61,代码来源:CurvasEnSuperficies.py

示例8: __init__

    def __init__(self):
        Page.__init__(self, u"Toro<br><br>x<sup>4</sup> + y<sup>4</sup> + z<sup>4</sup><br> + 2x<sup>2</sup>y<sup>2</sup> + 2y<sup>2</sup>z<sup>2</sup> + 2z<sup>2</sup>x<sup>2</sup><br> - 10x<sup>2</sup> - 10y<sup>2</sup> + 6z<sup>2</sup> + 9 = 0")
        a = 1
        b = 0.5

        def toroParam1(u, v):
            return (a + b * cos(v)) * cos(u), (a + b * cos(v)) * sin(u), b * sin(v)

        toro = ParametricPlot3D(toroParam1, (0, 2 * pi, 150), (0, 2 * pi, 100))
        toro.setTransparencyType(SoTransparencyType.SORTED_OBJECT_SORTED_TRIANGLE_BLEND)
        toro.setTransparency(.4)

        #        delta = 0
        #        p_eli = Sphere((.9571067805, .9571067805, .35+delta),0.02,visible=True)
        #        p_eli.setColor( _1(194,38,69))
        #        p_eli.setShininess(1)
        #
        #        p_par = Sphere ((-0.7071067810, 0.7071067810, 0.5+delta),0.02,visible=True)
        #        p_par.setColor( _1(240,108,21))
        #        p_par.setShininess(1)
        #
        #        p_hyp = Sphere ((0, -0.6464466095, .3535+delta),0.02,visible=True)
        #        p_hyp.setColor( _1(78,186,69))
        #        p_hyp.setShininess(1)

        def toro_u(u, v):
            return Vec3(-(a + b * cos(v)) * sin(u), (a + b * cos(v)) * cos(u), 0)

        def toro_v(u, v):
            return Vec3(-b * sin(v) * cos(u), -b * sin(v) * sin(u), b * cos(v))

        ## plano parabólico
        ptopar = (0, pi / 2)
        b2 = b - .00025
        ## trick: the tangent plane is located in a torus of diameter slightly smaller than the torus; so the
        ## intersection is visible to the naked eye
        def toroParam_delta(u, v):
            return (a + b2 * cos(v)) * cos(u), (a + b2 * cos(v)) * sin(u), b2 * sin(v)
        plane_par = TangentPlane2(toroParam_delta, toro_u, toro_v, ptopar, _1(252, 250, 225))
        plane_par.baseplane.setTransparency(0)
        plane_par.setRange((-.5, .5, 7))

        self.addChild(toro)
        self.addChild(plane_par)

        def animaCurva1(n):
            def curva(t): return (t * 2 * pi, pi / 2)

            plane_par.setLocalOrigin(curva(n / 100.))

        def animaCurva2(n):
            def curva(t): return (0, pi / 2 - t * (2 * pi + pi / 2))

            plane_par.setLocalOrigin(curva(n / 100.))

        def animaCurva3(n):
            def curva(t): return (t * 2 * pi, 0)

            plane_par.setLocalOrigin(curva(n / 100.))

        a1 = Animation(animaCurva1, (6000, 0, 100))
        a2 = Animation(animaCurva2, (6000, 0, 100))
        a3 = Animation(animaCurva3, (6000, 0, 100))

        self.setupAnimations([a1, a2, a3])
开发者ID:rlerichev,项目名称:geomdif,代码行数:65,代码来源:Superficies2.py

示例9: __init__

 def __init__(self, name):
     Page.__init__(self, name)
     self.camera_position = (0, 0, 13)
     self.camera_point_at = [SbVec3f(0, 0, 0), SbVec3f(0, 1, 0)]
     self.showAxis(True)
     self.axis_z.setVisible(False)
开发者ID:rlerichev,项目名称:geomdif,代码行数:6,代码来源:Curvas1.py


注:本文中的superficie.book.Page类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。