歌者文明清理员 发表于 2023-7-7 13:16:10

VPython 0 4 | 3D Objects #2: arrow 箭头

本帖最后由 歌者文明清理员 于 2023-7-7 13:16 编辑



官方文档

正文

arrow (箭头)的两端分别是一个立方体,和一个从一面看像三角形的图形。以下代码会创建一个 arrow,并且与 x 轴平行:

from vpython import *
pointer = arrow(pos=vector(0, 2, 1), axis=vector(5, 0, 0), shaftwidth=1)
while True:
    rate(100)


arrow 有以下属性:pos (0, 0, 0), axis (1, 0, 0), length (1), color (1, 1, 1) (color.white), red (1), blue (1), green (1), opacity (1), shininess (0.6), emissive (False), texture, 和 up。

通用于所有 VPython 3D 对象的属性说明请访问 -> cylinder

和 box 一样,up 属性对于箭头很重要,因为 arrow 默认为方角,它具有方形横截面。

https://www.glowscript.org/docs/VPythonDocs/VisualRef-2.gif

round 属性图:

https://i.imgtg.com/2023/07/05/Oxn9Xc.png

这些是 arrow 独有的属性:

round 用于设置是否以圆角效果展示箭头。默认为 False,为方角效果。
shaftwith = length / 10
headwith = 2 * shaftwith = length / 5
headlength = 3 * shaftwith = length / 3

不二如是 发表于 2023-7-7 14:12:05

加油更新{:10_256:}

liuhongrun2022 发表于 2023-7-7 14:16:16

支持
页: [1]
查看完整版本: VPython 0 4 | 3D Objects #2: arrow 箭头