Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #TODO ===== BEGIN SOLUTION HERE =====
- dirDOTnorm = np.dot(ray.viewDirection, self.normal);
- if (dirDOTnorm != 0): # If it is not parallel.
- t = np.dot((np.array([0.,0.,0.]) - ray.eyePoint), self.normal) / dirDOTnorm;
- if (t > EPS_DISTANCE): # If the t is positive.
- isect.t = t;
- isect.p = ray.eyePoint + t * ray.viewDirection;
- isect.n = self.normal;
- if (self.material2 == None): # If not checkboard.
- isect.material = self.material;
- else: # If checkboard.
- xz = np.ceil(ray.eyePoint + t * ray.viewDirection[0]) + np.ceil(ray.eyePoint + t * ray.viewDirection[2]);
- if (xz % 2 == 0): # If even.
- isect.material = self.material;
- else : # Odd.
- isect.material = self.material2;
- # ===== END SOLUTION HERE =====
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement