# Path: vulk/math/vector.py
# class Vector3(Vector, XMixin, YMixin, ZMixin):
#     '''Vector3 class represents a Vector in 3D space.
#     It has three components `x`, `y` and `z`.
#     '''
#     X = None
#     Y = None
#     Z = None
#     Zero = None
# 
#     def __init__(self, values=None):
#         '''
#         *Parameters:*
# 
#         - `values`: `list` of 3 `float`
#         '''
#         if not values:
#             super().__init__([0, 0, 0])
#         elif len(values) == 3:
#             super().__init__(values)
#         else:
#             raise ValueError("Vector3 needs 3 components")
# 
#         # tmp properties used during computation
#         self.tmp_v4 = Vector4()
# 
#     def mul(self, vector):
#         '''Multiply this vector by `vector`.
# 
#         *Parameters:*
# 
#         - `vector`: `Vector3`
#         '''
#         # TODO: To test and valid
#         self._values *= vector.values
# 
#     def mul2(self, matrix):
#         '''Multiply this vector by a `Matrix4`
# 
#         *Parameters:*
# 
#         - `matrix`: `Matrix4`
#         '''
#         self.tmp_v4.set2(self).mul2(matrix)
#         self._values[:] = self.tmp_v4.values[0:3]
#         return self
# 
#     def prj(self, matrix):
#         '''
#         Project this vector to the `matrix` parameter.
#         It's just a multiplication followed by a division by w.
# 
# 
# 
#         *Parameters:*
# 
#         - `matrix`: `Matrix4`
#         '''
#         self.tmp_v4.set2(self).mul2(matrix).norw()
#         self._values[:] = self.tmp_v4.values[0:3]
# 
#     def set(self, x, y, z):
#         '''Set values of this vector
# 
#         *Parameters:*
# 
#         - `x`, `y`, `z`: `float`
#         '''
#         self._values[0] = x
#         self._values[1] = y
#         self._values[2] = z
# 
#     def set2(self, vector):
#         '''Set values of this vector
# 
#         *Parameters:*
# 
#         - `vector`: `Vector3`
#         '''
#         self.set(vector.x, vector.y, vector.z)


import numpy as np
from vulk.math.vector import Vector3

    def to_identity(self):
        '''Set this matrix to identity matrix'''
        self._values[:] = 0.
        self._values[0] = 1.
        self._values[5] = 1.
        self._values[10] = 1.
        self._values[15] = 1.

        return self


class ViewMatrix(Matrix4):
    '''This class represents a view Matrix.

    View Matrix convert vertex from World space to View space.
    '''
    def to_look_at_direction(self, direction, up):
        '''
        Set this matrix to a *look at* matrix with a `direction` and a `up`
        vector.

        *Parameters:*

        - `direction`: Direction `Vector3`
        - `up`: Up `Vector3`
        '''
        vec_z = Vector3(direction).nor()
        vec_x = Vector3(direction).nor()
        vec_x.crs(up.nor()).nor()

# Path: vulk/math/vector.py
# class Vector3(Vector, XMixin, YMixin, ZMixin):
#     '''Vector3 class represents a Vector in 3D space.
#     It has three components `x`, `y` and `z`.
#     '''
#     X = None
#     Y = None
#     Z = None
#     Zero = None
# 
#     def __init__(self, values=None):
#         '''
#         *Parameters:*
# 
#         - `values`: `list` of 3 `float`
#         '''
#         if not values:
#             super().__init__([0, 0, 0])
#         elif len(values) == 3:
#             super().__init__(values)
#         else:
#             raise ValueError("Vector3 needs 3 components")
# 
#         # tmp properties used during computation
#         self.tmp_v4 = Vector4()
# 
#     def mul(self, vector):
#         '''Multiply this vector by `vector`.
# 
#         *Parameters:*
# 
#         - `vector`: `Vector3`
#         '''
#         # TODO: To test and valid
#         self._values *= vector.values
# 
#     def mul2(self, matrix):
#         '''Multiply this vector by a `Matrix4`
# 
#         *Parameters:*
# 
#         - `matrix`: `Matrix4`
#         '''
#         self.tmp_v4.set2(self).mul2(matrix)
#         self._values[:] = self.tmp_v4.values[0:3]
#         return self
# 
#     def prj(self, matrix):
#         '''
#         Project this vector to the `matrix` parameter.
#         It's just a multiplication followed by a division by w.
# 
# 
# 
#         *Parameters:*
# 
#         - `matrix`: `Matrix4`
#         '''
#         self.tmp_v4.set2(self).mul2(matrix).norw()
#         self._values[:] = self.tmp_v4.values[0:3]
# 
#     def set(self, x, y, z):
#         '''Set values of this vector
# 
#         *Parameters:*
# 
#         - `x`, `y`, `z`: `float`
#         '''
#         self._values[0] = x
#         self._values[1] = y
#         self._values[2] = z
# 
#     def set2(self, vector):
#         '''Set values of this vector
# 
#         *Parameters:*
# 
#         - `vector`: `Vector3`
#         '''
#         self.set(vector.x, vector.y, vector.z)


# Path: vulk/math/matrix.py
import numpy as np
from vulk.math.vector import Vector3


    def to_identity(self):
        '''Set this matrix to identity matrix'''
        self._values[:] = 0.
        self._values[0] = 1.
        self._values[5] = 1.
        self._values[10] = 1.
        self._values[15] = 1.

        return self


class ViewMatrix(Matrix4):
    '''This class represents a view Matrix.

    View Matrix convert vertex from World space to View space.
    '''
    def to_look_at_direction(self, direction, up):
        '''
        Set this matrix to a *look at* matrix with a `direction` and a `up`
        vector.

        *Parameters:*

        - `direction`: Direction `Vector3`
        - `up`: Up `Vector3`
        '''
        vec_z = Vector3(direction).nor()
        vec_x = Vector3(direction).nor()
        vec_x.crs(up.nor()).nor()

        vec_y = Vector3(vec_x).crs(vec_z).nor()