如何通过给出高度,宽度和深度以编程方式(python)绘制矩形(倾斜投影视图)。
答案 0 :(得分:1)
查看Python的turtle
模块https://developer.wordpress.org/reference/functions/get_filesystem_method/。在高度,宽度和深度之上,您需要考虑投影的角度 - 我认为这通常是30/45度。
让你开始...... here is the v3.3 documentation。
import turtle
w = 100
h = 50
d = 20
angle = 30
def drawRectangle(width, height):
turtle.right(90)
turtle.forward(height)
turtle.right(90)
turtle.forward(width)
turtle.right(90)
turtle.forward(height)
turtle.right(90)
turtle.forward(width)
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
drawRectangle(w, h)
turtle.left(angle)
turtle.forward(d)
turtle.right(angle)
drawRectangle(w, h)