![]() |
Python_2
1.0
|
Draws a 3D tetrahedron and allows a user to rotate it (mouse left button and wheel). More...
Functions | |
def | createZeroMat (m, n) |
def | matMul (mat1, mat2) |
def | matTrans (mat) |
def | translate (x, y, dx, dy) |
def | drawTet (tet, col) |
def | init () |
def | cbClicked (event) |
def | cbMottion (event) |
def | wheelUp (event) |
def | wheelDown (event) |
def | wheel (event) |
def | resize (event) |
def | main () |
Draws a 3D tetrahedron and allows a user to rotate it (mouse left button and wheel).
The Tetrahedron is represented by a 3 x 4 matrix. Each column represents a 3D vertex.
note: a m x n matrix is represented by a list of lines: [[l_1] [l_2] .. [l_m]]. m = len(mat), n = len(mat[0]), mat(i,j) = mat[i][j]
def _12_tet.cbClicked | ( | event | ) |
Save current mouse position.
Referenced by cbMottion().
def _12_tet.cbMottion | ( | event | ) |
Map mouse displacements in Y direction to rotations about X axis, and mouse displacements in X direction to rotations about Y axis.
References cbClicked(), drawTet(), _12a_poly.EPS(), matMul(), _12a_poly.ROT_X(), and _12a_poly.ROT_Y().
def _12_tet.createZeroMat | ( | m, | |
n | |||
) |
Return a matrix (m x n) filled with zeros.
Referenced by matMul(), and matTrans().
def _12_tet.drawTet | ( | tet, | |
col | |||
) |
Draw a tetrahedron.
References translate().
Referenced by cbMottion(), main(), resize(), wheel(), wheelDown(), and wheelUp().
def _12_tet.init | ( | ) |
Initialize global variables.
References _12a_poly.EPS(), _12a_poly.eps(), matTrans(), _12a_poly.ROT_X(), _12a_poly.ROT_Y(), and _12a_poly.ROT_Z().
Referenced by main().
def _12_tet.matMul | ( | mat1, | |
mat2 | |||
) |
Return mat1 x mat2 (mat1 multiplied by mat2).
References createZeroMat().
Referenced by cbMottion(), wheel(), wheelDown(), and wheelUp().
def _12_tet.matTrans | ( | mat | ) |
def _12_tet.resize | ( | event | ) |
Redraw the tetrahedron, in case of a window change due to user resizing it.
References drawTet().
def _12_tet.translate | ( | x, | |
y, | |||
dx, | |||
dy | |||
) |
Translate vector(x,y) by (dx,dy).
Referenced by drawTet().
def _12_tet.wheel | ( | event | ) |
Map mouse wheel displacements to rotations about Z axis.
References drawTet(), _12a_poly.EPS(), matMul(), and _12a_poly.ROT_Z().
def _12_tet.wheelDown | ( | event | ) |
Map mouse wheel down displacements to rotations about Z axis.
References drawTet(), _12a_poly.EPS(), matMul(), and _12a_poly.ROT_Z().
def _12_tet.wheelUp | ( | event | ) |
Map mouse wheel up displacements to rotations about Z axis.
References drawTet(), _12a_poly.EPS(), matMul(), and _12a_poly.ROT_Z().