← 返回题库
初级

验证z=2平面上的变换

未完成
初级参考 完整示例代码供参考,建议自己理解后重新输入
# Same code as above except for the 2 in this line
dino_3d = [(x,y,2) for x,y in dino_vectors]
######################

draw3d(
    Points3D(*dino_3d, color='blue'),
    *polygon_segments_3d(dino_3d, color='C0')
)

translated = [multiply_matrix_vector(magic_matrix, v) for v in dino_3d]

draw3d(
    Points3D(*dino_3d, color='C0'),
    *polygon_segments_3d(dino_3d,color='C0'),
    Points3D(*translated,color='C3'),
    *polygon_segments_3d(translated,color='C3')
)

translated_2d = [(x,y) for (x,y,z) in translated]

draw(
    Points(*dino_vectors, color='C0'),
    Polygon(*dino_vectors, color='C0'),
    Points(*translated_2d, color='C3'),
    Polygon(*translated_2d, color='C3'),
    save_as='figures/ex_5.26_dino.svg'
)
    plt.show()
Python 代码 🔒 登录后使用
🔒

登录后即可练习

注册免费账号,在浏览器中直接运行 Python 代码