The canvas is cutted into grid structure, with vReso grids along vertical (Row) direction and hReso horizontal grids along horizontal(Col) direction. Each rectangular grid is called a pixel, or picture element, and is specified by its lower-left (row, col) position. The coordinate system has the lower-left corner of the canvas as its origin, with Row going up and Col going right. The lower-left corner pixel has a coordinate of (0,0), and the upper-right one of (hReso - 1, vReso - 1).
A (x, y) pair means col = x+hReso/2, and row = y+vReso/2.
To each piexel (row, col) on the Canvas, a RGB color value is associated, which can be accessed via index operator [row][col].
WritePPM() writes the Canvas to an image file of PPM format.
Point structure and perspectiveProjection(Point const&) added. Now the Canvas is actually a virutal camera in the simplest setting: the Canvas plane is centered at z=0 with x-size of hReso, and y-size of vReso, Eye at eye_at (>0) and looking along positive z direction. eye_at defaults to hReso / 2.
Now the triangle primitives are updated so the given points are in 3D space. The other primitives are not updated though, and actually can be deleted from Canvas class, since for 3D graphics, everything is usually tesselated by triangles.
Definition in file Canvas.h.
Go to the source code of this file.
Namespaces | |
| namespace | columbia |
1.3.6