**Note**: This form is for filling out answers for the 15-462/662 Fall 2020 midterm exam. _You must put all your answers in this form, and submit it via Autolab_. We will not accept photos/scans of written material, files sent via email, etc. The formatting of this file must be preserved (e.g., do not change lines starting with hashmarks, or remove lines consisting of three backticks). All code should be written in the provided (empty) functions. Please also write your AndrewID below. AndrewID: ## 1 (20 points) Getting Warmed Up ### 1a (6 points) ### 1b (7 points) ### 1c (7 points) ## 2 (40 points) Cubing the Sphere ### 2a (5 points) ``` Matrix4x4 bboxTransform( Vec3 c, // sphere center double r ) // sphere radius { } ``` ### 2b (6 points) ``` Vec3 interpolateWorldPosition( Vec3 p0, Vec3 p1, Vec3 p2, // vertex world coordinates Vec3 b ) // barycentric coordinates of sample point { } ``` ### 2c (5 points) ``` double intersectSphere( Vec3 c, // center double r, // radius Vec3 o, // ray origin Vec3 d ) // ray direction (unit) { } ``` ### 2d (6 points) ``` void drawBBoxTriangle( Vec3 x0, Vec3 x1, Vec3 x2, // world coordinates Vec2 u0, Vec2 u1, Vec2 u2, // projected coordinates Vec3 c, double r, // sphere center/radius double sphereColor, double* depth, double* color, // buffers int w, int h ) // buffer width/height { } ``` ### 2e (6 points) ### 2f (6 points) ### 2g (6 points) ## 3 (40 points) Step Into the Shadow ### 3a (5 points) ### 3b (5 points) ### 3c (5 points) ``` bool onContour( Edge e, // edge to be tested Vec3 x // location of point light ) { } ``` ### 3d (5 points) ``` void shadowPolygon( Edge e, // contour edge Vec3 x, // light position Vec4& pi, Vec4& pj, // endpoints along edge Vec4& qi, Vec4& qj ) // endpoints at infinity { } ``` ### 3e (5 points) ### 3f (5 points) ### 3g (5 points) ### 3h (5 points) ``` void drawShadowPolygon( Vec3 P0, Vec3 P1, Vec3 Q0, Vec3 Q1, // polygon vertices double* depth, double* stencil, double* color, // buffers int w, int h ) // buffer width/height { } ```