File size: 775 Bytes
d49f7bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) Meta Platforms, Inc. and affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from animated_drawings.model.transform import Transform
from animated_drawings.model.vectors import Vectors
from typing import Union, List


class Camera(Transform):

    def __init__(
        self,
        pos: Union[Vectors, List[Union[float, int]]] = Vectors([0.0, 0.0, 0.0]),
        fwd: Union[Vectors, List[Union[float, int]]] = Vectors([0.0, 0.0, 1.0])
    ):
        super().__init__()

        if not isinstance(pos, Vectors):
            pos = Vectors(pos)
        self.set_position(pos)

        if not isinstance(fwd, Vectors):
            fwd = Vectors(fwd)
        self.look_at(fwd)