大家好。我在使用ggui画图时,发现显示区域只能是[0,1]*[0,1],在之外的图像都显示不出来。例如下面这个代码想画出一个矩形:
import taichi as ti
import numpy as np
ti.init(arch=ti.cpu)
point = ti.Vector.field(3,dtype=ti.f32,shape=4)
point[0] = ti.Vector([-0.2,-0.3,0.0])
point[1] = ti.Vector([0.2,-0.3,0.0])
point[2] = ti.Vector([0.2,0.3,0.0])
point[3] = ti.Vector([-0.2,0.3,0.0])
edge = ti.Vector.field(2,dtype=ti.i32,shape=4)
edge[0] = ti.Vector([0,1])
edge[1] = ti.Vector([1,2])
edge[2] = ti.Vector([2,3])
edge[3] = ti.Vector([3,0])
window = ti.ui.Window('square',(800,600))
while window.running:
canvas = window.get_canvas()
canvas.circles(point,radius=0.01,color = (1.0,0.0,0.0))
canvas.lines(point,0.01,edge,color = (1.0,1.0,0.0))
window.show()
最后显示出的图像是这样:
只显示出了在[0,1]*[0,1]区域的部分。请问有没有什么办法可以改变显示范围,让这个矩形正常显示出来呢?