Project 5 A Bug's Life

 

 

This project implements a fix to as many bugs as possible in the shortest amount of time. The first drawing shows my object, an ellipsoid. I drew 4 star shapes each out of three ellipses.  I was able to test my shape by setting rx ry and rz all to be equal and comparing it to a sphere.  I fixed the sphere code to  handle the intersection properly.  I added the code for refraction and fixed the reflection code so that it wouldn't infinitely trace within spheres etc.  I fixed the bug that kt wasn't being multiplied by 1/255.  There were so many bugs that I couldnt count.  I think my refraction code is right for computing the ray, but I think I am having problems with pruning the tree.  Please look at my algorithm for the refraction, and not the image.  I didn't want to take any shortcuts, so I didn't do the hack of not computing reflection inside of objects.  I wanted this to be right.  Even though it didn't work for refraction in all cases, the math is right.  The ellipsoid takes parameters rx,ry,rz, the radii, cx,cy,cz, the center point, ax, ay, az, the axis of rotation, and the angle of rotation.  I then can arbitrarily place the ellipsoid in space at any orientation.  I also used matrix3d to move the ray direction and origin to the local coordinate system of the ellipsoid and back again.  This works as you can see in the ellipsoid flakes.  I have used the associated files that matrix3d uses just so it compiles , eg. raster.
 
 
Matrix3D
Point3D
Raster
RayTrace
Vertex3D