python三维可视化软件_3D图形:软件可视化三维向量?

I'm trying to teach myself about 3D graphics, but I'm having trouble visualizing the 3D vectors involved.

Is there any good software that I can use to visualize 3D vectors?

For example, right now I'm learning about camera transformations, and it would be nice if I could easily plot the right/up/look/eye vectors.

I've tried Grapher.app and gnuplot, but it's very difficult to enter points into Grapher.app and gnuplot doesn't seem to be able to lock the aspect ratio.

解决方案

Visual Python is a super easy library for 3D visualization.

For example, to show a sphere and arrow:

import time, math, visual

ball = visual.sphere(pos=(0,2,0), radius=1, color=visual.color.red)

vect = visual.arrow(pos=(2,0,0), axis=(2 ,2,-2))

visual.scene.forward = (.1, -.3, -1) # controls the camera view angle

This window now also has all of the normal mouse interactivity, such as zooming and camera (i.e. viewing angle) rotation.

VPython is also easy to animate. For example, the following will rotate the arrow:

da = 2*math.pi/100

for timestep in range(100):

angle = timestep*da

vect.axis = (2+2*math.sin(angle), 2*math.cos(angle), -2)

time.sleep(.1)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值