Example #1
0
def _not_sequence_modeling(ray: Ray, surfaces: List[Surface]):
    min_p = 100000000000000
    # index of nearest surface and intersection point
    index = -1
    for i in range(len(surfaces)):
        t = surfaces[i].ray_surface_intersection(ray.dir, ray.start)
        if len(t) != 0:
            t = t[0]
        else:
            continue
        if t < min_p:
            min_p = t
            index = i
    if index != -1:
        return index, ray.calc_point_of_ray(min_p)
    else:
        return index, None
Example #2
0
 def find_intersection_with_surface(self, ray: Ray) -> list:
     positive_t = Ellipse.ray_surface_intersection(self, ray.dir, ray.start)
     if len(positive_t) > 0:
         ray.t0 = [positive_t[0], self]
         return [ray.calc_point_of_ray(t) for t in positive_t]
     return []