\documentclass[letterpaper,10pt]{article} %\topmargin -1in %\textheight 10in %\oddsidemargin -0.25in %\evensidemargin 0in %\textwidth 6.5in \setlength{\parindent}{0pt} \setlength{\parskip}{1em} \pagestyle{empty} \usepackage{geometry} \geometry{papersize={216mm,279mm},total={176mm,239mm}} \title{CSC418 Assignment \#1} \author{Aly Merchant [991579083]} \begin{document} \maketitle \section{Design} The code is separated into two parts: functions which handle the object hierarchy and functions which render the objects. The object hierarchy is hardcoded in but it still has some resemblence to object oriented code. Each object is responsible for attaching itself to its parent with a joint, scaling and translating from the joint to the center of the object. If the object has children it is responsible for translating to the point where a joint is located and then calling the appropriate function. \section{Part descriptions} Most of the parts are rendered using {\tt GL\_POLYGON}, circular objects (the joints and the tail) are rendered using {\tt GL\_LINE\_LOOP} and are approximated by a 100-sided polygon. For the head I was able to use a single polygon by traversing the verticies in a certain order. Each part is drawn within a unit square which is later scaled to the correct dimensions making it easy to reuse the simple functions like square and circle. All animation is handled by the joint\_rot variable and shifting the rotation or translation from the parent object to the joint. \section{Transformations} Three transformations were used in this assignment: {\tt glTranslate, glRotate, glScale}. Rotations are used at joints to orient the child object with respect to the parent. Translation is used to position joints, center objects for rendering and orient children connected by a sliding joint. Since all objects are rendered within a unit square scaling is used to resize the objects and to switch to relative scale. For example: it is easy to work with a transform like {\tt glTranslate(0,-0.5,0)} and know that it will center the object instead of dealing with constants like {\tt BODY\_LENGTH/2}. \end{document}