Exemplo n.º 1
0
 def checkInter(self, objlist):
     min_length = 1.0e8
     min_object = face(vector3(0.0,0.0,0.0), vector3(0.0,0.0,0.0), 0)
     for element in objlist:
         dest = self.intersection(element)
         if vector3.norm(dest) < min_length :
             min_length = vector3.norm(dest)
             min_object = element
     i_point = vector3.add_vec(self.point, vector3.mul_vec(self.direction, min_length))
     return i_point, min_object
Exemplo n.º 2
0
 def checkShadow(self, start, light, objlist):
     occluded = 0
     o2light = vector3.nrm_vec(vector3.sub_vec(light.point, start))
     min_length = vector3.norm(o2light)
     if min_length > 1.0e6 : print "a"; return 0
     ray2light = ray(vector3.sub_vec(start,vector3.mul_vec(o2light, -1.0e-8)), o2light)
     for element in objlist:
         dest = ray2light.intersection(element)
         if vector3.norm(dest) < min_length :
             occluded = 1
     return occluded