SMIL 1.1.1
Loading...
Searching...
No Matches
example-bresenham.py
1
2import smilPython as sp
3
4# first and last points in a 3D image
5pi = sp.IntPoint(0, 0, 0)
6pf = sp.IntPoint(60, 50, 10)
7
8line = sp.Bresenham(pi, pf)
9
10# grab each point and print it
11for i in range(0, line.nbPoints()):
12 pt = line.getPoint(i)
13 print(" {:2d} - {:3d} {:3d} {:3d}".format(i, pt.x, pt.y, pt.z))
14
15# get a vector of points and set them in an image
16im = sp.Image(64, 64, 12)
17pts = line.getPoints()
18for i in range(0, len(pts)):
19 im.setPixel(pts[i].x, pts[i].y, pts[i].z, 255)
20im.show()
21