• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util._1函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

    def __init__(self):
        "F(x,y) = (x, y, x + y - 6)"
        #u"""l plano x + y + z - 2.5 = 0"""
        Page.__init__(self, u"Plano<br><br>F(x,y) = (x, y, x + y - 6)")

        plane = lambda x, y: -x - y
        p1 = lambda x, y, t1: (x, y, (1 - t1) * (-x - y) - 2 * t1)
        p2 = lambda x, y, t2: (x, (1 - t2) * y - 2 * t2, -x - y)
        p3 = lambda x, y, t3: ((1 - t3) * x - 2 * t3, y, -x - y)

        r = (-1, 1, 15)
        plano = Plot3D(plane, (-1, 1), (-1, 1))
        plano.setTransparencyType(8)
        plano1 = ParametricPlot3D(p1, r, r)
        plano2 = ParametricPlot3D(p2, r, r)
        plano3 = ParametricPlot3D(p3, r, r)
        planos = [plano1, plano2, plano3]
        for p in planos:
            p.linesVisible = True
            p.meshVisible = False
        plano1.setMeshDiffuseColor((1, 0, 0))
        plano2.setMeshDiffuseColor((0, 1, 0))
        plano3.setMeshDiffuseColor((0, 1, 1))
        plano.diffuseColor = _1(29, 214, 216)
        plano.transparency = 0.5
        plano.setAmbientColor(_1(29, 214 , 216))
        self.setupPlanes((-2, 2, 7))

        self.addChildren([plano, plano1, plano2, plano3])

        ## no controls
        for i, plano in enumerate(planos):
            plano.parameters['t%d' % (i + 1)].hide()

        self.setupAnimations([plano.parameters['t%d' % (i + 1)].asAnimation() for i, plano in enumerate(planos)])
开发者ID:rlerichev,项目名称:geomdif,代码行数:35,代码来源:Superficies1.py


示例2: __init__

    def __init__(self):
        super(Helicoide, self).__init__(u"Isometría local entre una helicoide y una catenoide")
        self.camera_position = (8.2, 8.2, 8.2)
        self.camera_viewAll = False

        def param(u, v, t):
            x = cos(t) * sinh(v) * sin(u) + sin(t) * cosh(v) * cos(u)
            y = -cos(t) * sinh(v) * cos(u) + sin(t) * cosh(v) * sin(u)
            z = u * cos(t) + v * sin(t)
            return x, y, z

        helic1 = ParametricPlot3D(param, (-pi, pi, 60), (-2, 2))
        ht = helic1.getParameter("t")
        ht.timeline.setDuration(3000)
        ht.updateRange((0, pi / 2, 0))
        helic1.setVerticesPerColumn(2)

        helic1.setAmbientColor(_1(202, 78, 70))
        helic1.setDiffuseColor(_1(202, 78, 70))
        helic1.setSpecularColor(_1(202, 78, 70))

        s = Slider(rangep=("z", 2, 60, 2, 59), func=helic1.setVerticesPerColumn, duration=3000, parent=self)
        self.addChild(helic1)

        params = [s, ht]
        ## no queremos los controles
        for p in params:
            p.hide()
        anims = [p.asAnimation() for p in params]
        self.setupAnimations(anims)
开发者ID:rlerichev,项目名称:geomdif,代码行数:30,代码来源:Superficies4.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"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


示例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):
        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


示例8: creaLoxodroma

    def creaLoxodroma(self):
        tmin = -75
        tmax = 60
        pmin = 0
        pmax = 2 * pi
        r = 3
        r2 = r - 0.005
        m = tan(pi / 60)
        t0 = pi / 2

        def sigmoide(t):
            return abs(2.0/(1+exp(-(t/15.0)))-1)

        def func(t):
            t = t * sigmoide(t)
            return r * cos(-t) / cosh(m * (-t - t0)), r * sin(-t) / cosh(m * (-t - t0)), r * tanh(m * (-t - t0))

        def cp(t):
            t = t * sigmoide(t)
            den1 = cosh(m * (-t - t0))
            return Vec3(-r * sin(t) / den1 + r * cos(t) * sinh(m * (-t - t0)) * m / den1 ** 2, -r * cos(t) / den1 - r * sin(t) * sinh(m * (-t - t0)) * m / den1 ** 2, -r * (1 - tanh(m * (-t - t0)) ** 2) * m)

        curve = Curve3D(func, (tmin, tmax, 10), color=(1, 1, 0), width=3, nvertices=1, max_distance = .3, max_angle = .2)
        self.addChild(curve)

        tangent = curve.attachField("tangente", cp).setLengthFactor(1).setWidthFactor(.2).show()
        tangent.setRadius(.04)
        tangent.animation.setDuration(30000)

        matHead = SoMaterial()
        matHead.ambientColor = (.33, .22, .27)
        matHead.diffuseColor = (1, 0, 0)
        matHead.specularColor = (.99, .94, .81)
        matHead.shininess = .28
        self.setupAnimations([ AnimationGroup([curve, tangent], (20000,0,len(curve)-1)) ])

        resf = 2.97
        esf = ParametricPlot3D(lambda t, f: (resf * sin(t) * cos(f), resf * sin(t) * sin(f), resf * cos(t)) , (0, pi, 100), (0, 2 * pi, 120))
        esf.setTransparencyType(SoTransparencyType.SORTED_OBJECT_SORTED_TRIANGLE_BLEND)
        esf.setTransparency(0.4)
        esf.setDiffuseColor(_1(28, 119, 68))
        self.addChild(esf)
        VisibleCheckBox("esfera", esf, True, parent=self)

        ## los meridianos
        sep = SoSeparator()
        mer = Curve3D(lambda t: (0, r2 * cos(t), r2 * sin(t)), (pmin, pmax, 100), color=_1(72, 131, 14))
        for i in range(24):
            sep.addChild(rot(2 * pi / 24))
            sep.addChild(mer.root)

        # highlighted meridians
        r3 = r + 0.005
        mer2 = Curve3D(lambda t: (0, r3 * cos(t), r3 * sin(t)), (pmin, pmax, 100), color=_1(255, 251,0), width=2)
        for i in [-4, -2]:
            sep.addChild(rot(i * 2 * pi / 24))
            sep.addChild(mer2.root)

        self.addChild(sep)
开发者ID:rlerichev,项目名称:geomdif,代码行数:59,代码来源:CurvasEnSuperficies.py


示例9: createEllipsoid

def createEllipsoid(a,b,c):

    par_e = lambda u, v: Vec3(a * sin(v) * cos(u), b * sin(u) * sin(v), c * cos(v))
    e = ParametricPlot3D(par_e, (0, 2*pi, 100), (0, pi, 100))
    e.setTransparencyType(SoTransparencyType.SORTED_OBJECT_SORTED_TRIANGLE_BLEND)
    e.setTransparency(0.5)
    e.setDiffuseColor(_1(40, 200, 120))

    return e
开发者ID:rlerichev,项目名称:geomdif,代码行数:9,代码来源:CurvaturasNormales.py


示例10: createTorus

def createTorus(r1,r2):

    par_t = lambda u, v: Vec3((r1 + r2 * cos(v)) * cos(u), (r1 + r2 * cos(v)) * sin(u), r2 * sin(v))
    tor = ParametricPlot3D(par_t, (-pi, pi, 100), (-pi, pi, 100))
    tor.setTransparencyType(SoTransparencyType.SORTED_OBJECT_SORTED_TRIANGLE_BLEND)
    tor.setTransparency(0.5)
    tor.setDiffuseColor(_1(180, 220, 200))

    return tor
开发者ID:rlerichev,项目名称:geomdif,代码行数:9,代码来源:CurvaturasNormales.py


示例11: createHyperboloid

def createHyperboloid(a,b):

    par_h = lambda u, v: Vec3(u, v, u**2/(a**2)-v**2/(b**2))
    h = ParametricPlot3D(par_h, (-4, 4, 100), (-4, 4, 100))
    h.setTransparencyType(SoTransparencyType.SORTED_OBJECT_SORTED_TRIANGLE_BLEND)
    h.setTransparency(0.5)
    h.setDiffuseColor(_1(220, 200, 80))

    return h
开发者ID:rlerichev,项目名称:geomdif,代码行数:9,代码来源:CurvaturasNormales.py


示例12: __init__

    def __init__(self):
        super(Toro, self).__init__(u"Curvas tóricas")
        tmin, tmax, npuntos = (0, 2 * pi, 3000)

        a = 1
        b = 0.5
        c = 0.505

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

        def toroParam2(u, v):
            return ((a + c * cos(v)) * cos(u), (a + c * cos(v)) * sin(u), c * sin(v))

        def curvaPlana(t):
            return (t, t)

        def curvaToro(t):
            return toroParam2(*curvaPlana(t))

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

        curva = Curve3D(curvaToro, (tmin, tmax, npuntos), color=_1(146, 33, 86), width=3, nvertices=1)

        def recalculaCurva(**kargs):
            """a: vueltas horizontales, b: vueltas verticales"""
            keys = kargs.keys()
            if "a" in keys:
                recalculaCurva.a = kargs["a"]
            if "b" in keys:
                recalculaCurva.b = kargs["b"]

            def curvaPlana(t):
                return (recalculaCurva.a * t, recalculaCurva.b * t)

            def curvaToro(t):
                return toroParam2(*curvaPlana(t))

            curva.updatePoints(curvaToro)

        recalculaCurva.a = 1
        recalculaCurva.b = 1

        sp1 = SpinBox("a", (0, 20, 1), lambda x: recalculaCurva(a=x), parent=self)
        sp2 = SpinBox("b", (0, 20, 1), lambda x: recalculaCurva(b=x), parent=self)

        self.addChild(curva)
        self.addChild(toro)
        curva.animation.setDuration(5000)
        self.setupAnimations([curva])
开发者ID:potatoym,项目名称:geomdif,代码行数:52,代码来源:CurvasEnSuperficies.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python conf.get函数代码示例发布时间:2022-05-27
下一篇:
Python book.Page类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap