Ejemplo n.º 1
0
    def __init__(self, origin: Vec3, focal_length: float, view_dir: Vec3,
                 l: int, r: int, b: int, t: int):
        self.origin = origin
        self.focal_length = focal_length
        self.view_dir = view_dir.normalize()
        self.l = l
        self.r = r
        self.b = b
        self.t = t
        # Construct coordienate frame for camera (2.4.7)
        self.w = self.view_dir.scale(-1)

        up_vector = Vec3(0, 0, 1)
        self.u = up_vector.cross(self.w)
        self.u = self.u.normalize()

        self.v = self.w.cross(self.u)
Ejemplo n.º 2
0
 def __init__(self, origin: Vec3, dir: Vec3):
     self.origin = origin
     self.dir = dir.normalize()