【问题标题】:Create a single face in VPython?在 VPython 中创建一个人脸?
【发布时间】:2012-06-02 05:41:44
【问题描述】:

在浏览了一些 VPython 文档之后,我还没有找到一种简单的方法来从三点做一个脸,但我想我可能会遗漏一些东西。我在想象这样的事情:

f = face(pts=[(x,y,z), (x,y,z), (x,y,z)], color=red... etc)

也许我应该只使用不同的库。

【问题讨论】:

    标签: python rendering vpython


    【解决方案1】:

    这是一个简单的例子:

    from visual import *
    
    scene.title = "Faces example"
    scene.width = 600
    scene.height = 400
    
    f = frame()
    tri = faces(
        pos = [
            [0.,0.,0.], [1.,0.,0.], [0.,1.,0.],   # first tri - vertices
            [0.,0.,0.], [-1.,0.,0.], [0.,-1.,0.]  # second tri - vertices
        ],
        color = [
            [1.,0.,0.], [0.5,0.5,0.], [0.,1.,0.], # first tri - colors
            [0.,0.,1.], [0.,0.5,0.5], [0.,1.,0.]  # second tri - colors
        ],
        frame = f
    )
    
    tri.make_normals()
    tri.make_twosided()
    
    while True:
        rate(100)
        f.rotate(angle=0.01)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-19
      • 2020-07-29
      • 2019-10-11
      • 2018-06-14
      • 2018-11-13
      • 1970-01-01
      • 2014-01-23
      • 2019-08-11
      相关资源
      最近更新 更多