Zekai Zhang ([email protected]); latest updated on 11/06/2022
The programs run in the Python3
environment; in addition, please ensure that the following modules/libraries have been
properly installed:
pygame
is used as the graphic user interface for displaying 3D models;numpy
is used for ease of performing matrix multiplication and transformations;pyOpenGL
is used for
$ pip3 intall pygame
$ pip3 install numpy
$ pip3 install PyOpenGL
The first program will allow you to inspect the provided 3D model as a wireframe.
In directory ./1_wireframe
you will find executable run_wireframe.py
; kindly navigate to the direactory and
in terminal, run the program in the following format:
$ python3 run_wireframe.py <object_file_name>
For instance, if object.txt
, the text file containing information about the 3D model, is placed witin the parent
directory of the program, you will run command:
$ python3 run_wireframe.py ../object.txt
If you provide 0 or more than 1 filename input, the system will generate an error message. Specific features (e.g. rotating the model, zooming and rotating the camera, and toggling the axes) will be elaborated in Section 2.
Similar to the wireframe viewer, in ./2_rendered
you will find run_rendered.py
; run the program using formate
$ python3 run_rendered.py <object_file_name>
The wireframe viewer comes with the following features:
- Press mouse and drag LEFT/RIGHT to rotate the model around the y-axis
- Press mouse and drag UP/DOWN to rotate the model around the x-axis
- Press mouse and drag diagonally to rotate the model around the z-axis
- Press
w
,a
,s
,d
on keyboard to move camera closer to or further from the object - Press
up
,down
on keyboard to rotate camera vertically - Press
left
,right
on keyboard to rotate camera horizontally - Press and hold
x
on keyboard to display the coordinates: RED, GREEN, and BLUE represent x-, y-, and z-zxes respectively.
The rendered viewer comes with the following features:
- Press mouse and drag LEFT/RIGHT to rotate the model around the y-axis
- Press mouse and drag UP/DOWN to rotate the model around the x-axis
- Press mouse and drag diagonally to rotate the model around the z-axis