Ejemplo n.º 1
0
    def __init__(
        self,
        scale=1.0,
        translation=None,
        rotation=None,
        ):

        self.things = []
        self.subframes = []

        if not isinstance(scale, scalar_types):
            raise TypeError, scale
        self.s = scale

        # Translation.
        if isinstance(translation, Vector):
            self.T = translation

        elif translation is not None:

            translation = tuple(translation)

            if not (
                len(translation) == 3
                and all(isinstance(t, scalar_types) for t in translation)
                ):
                raise TypeError, translation

            self.T = Vector(*translation)

        else:
            self.T = Vector()

        # Rotation.
        if isinstance(rotation, Matrix):
            self.RM = rotation

        elif rotation is not None:

            rotation = tuple(rotation)

            if not (
                len(rotation) == 3
                and all(isinstance(a, scalar_types) for a in rotation)
                ):
                raise TypeError, rotation

            ax, ay, az = rotation
            self.RM = rotx(ax) * roty(ay) * rotz(az)

        else:
            self.RM = rotx(0) * roty(0) * rotz(0)
Ejemplo n.º 2
0
    def __init__(
        self,
        scale=1.0,
        translation=None,
        rotation=None,
    ):

        self.things = []
        self.subframes = []

        if not isinstance(scale, scalar_types):
            #raise TypeError, scale
            raise TypeError
        self.s = scale

        # Translation.
        if isinstance(translation, Vector):
            self.T = translation

        elif translation is not None:

            translation = tuple(translation)

            if not (len(translation) == 3
                    and all(isinstance(t, scalar_types) for t in translation)):
                #raise TypeError, translation
                raise TypeError

            self.T = Vector(*translation)

        else:
            self.T = Vector()

        # Rotation.
        if isinstance(rotation, Matrix):
            self.RM = rotation

        elif rotation is not None:

            rotation = tuple(rotation)

            if not (len(rotation) == 3
                    and all(isinstance(a, scalar_types) for a in rotation)):
                #raise TypeError, rotation
                raise TypeError

            ax, ay, az = rotation
            self.RM = rotx(ax) * roty(ay) * rotz(az)

        else:
            self.RM = rotx(0) * roty(0) * rotz(0)
Ejemplo n.º 3
0
    def __init__(
        self,
        width=320,
        height=240,
        x_arc=73.0,
        y_arc=73.0,
        focal_distance=2.2,
        depth=5000.0,
    ):

        self.w, self.h = width, height
        self.xarc, self.yarc = x_arc, y_arc
        self.FD = focal_distance
        self.depth = depth

        self.T = Vector()
        self.RM = rotx(0) * roty(0) * rotz(0)

        # Create a list of eight "blank" new Vectors. These will be the
        # corners of the frustum, used to determine the planes beyond
        # which a given point is outside the viewable space.
        self._frustum = [Vector() for _ in range(8)]

        self._reset()
        self._getFrustumPlanes()
Ejemplo n.º 4
0
    def __init__(
        self,
        width=320,
        height=240,
        x_arc=73.0,
        y_arc=73.0,
        focal_distance=2.2,
        depth=5000.0,
        ):

        self.w, self.h = width, height
        self.xarc, self.yarc = x_arc, y_arc
        self.FD = focal_distance
        self.depth = depth

        self.T = Vector()
        self.RM = rotx(0) * roty(0) * rotz(0)

        # Create a list of eight "blank" new Vectors. These will be the
        # corners of the frustum, used to determine the planes beyond
        # which a given point is outside the viewable space.
        self._frustum = [Vector() for _ in range(8)]

        self._reset()
        self._getFrustumPlanes()