Remove unused function and change line calc
Using @pijyoi's suggestion regarding line calculation broadcasting
This commit is contained in:
parent
f60fa3b534
commit
b01e0e0895
@ -29,19 +29,16 @@ gz = gl.GLGridItem()
|
|||||||
gz.translate(0, 0, -10)
|
gz.translate(0, 0, -10)
|
||||||
w.addItem(gz)
|
w.addItem(gz)
|
||||||
|
|
||||||
def fn(x, y):
|
|
||||||
return np.cos(np.hypot(x, y))
|
|
||||||
|
|
||||||
n = 51
|
n = 51
|
||||||
y = np.linspace(-10,10,n)
|
y = np.linspace(-10,10,n)
|
||||||
x = np.linspace(-10,10,100)
|
x = np.linspace(-10,10,100)
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
yi = np.array([y[i]]*100)
|
yi = y[i]
|
||||||
d = np.hypot(x, yi)
|
d = np.hypot(x, yi)
|
||||||
z = 10 * np.cos(d) / (d+1)
|
z = 10 * np.cos(d) / (d+1)
|
||||||
pts = np.vstack([x,yi,z]).transpose()
|
pts = np.column_stack([x, np.full_like(x, yi), z])
|
||||||
plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor((i,n*1.3)), width=(i+1)/10., antialias=True)
|
plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor((i,n*1.3)), width=(i+1)/10., antialias=True)
|
||||||
w.addItem(plt)
|
w.addItem(plt)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
pg.mkQApp().exec_()
|
pg.mkQApp().exec_()
|
||||||
|
Loading…
Reference in New Issue
Block a user