# Path: p5/pmath/matrix.py
# def _magnitude(arr):
# def _normalize(arry):
# def scale_transform(x, y, z=1):
# def translation_matrix(x, y, z=0):
# def rotation_matrix(axis, angle):
# def euler_rotation_matrix(heading, attitude, bank):
# def triple_axis_rotation_matrix(x, y, z):
# def look_at(eye, at, up):
# def perspective_matrix(field_of_view, aspect_ratio, near_plane, far_plane):
# 
# Path: p5/pmath/utils.py
# PI = math.pi


import unittest
import numpy as np
from p5.pmath import matrix
from p5.pmath.utils import PI


v = np.array([3, 4])


class TestMatrix(unittest.TestCase):

    def test_magnitude(self):
        self.assertEqual(matrix._magnitude(v), 5.0)

    def test_normalize(self):
        self.assertTrue(np.array_equal(matrix._normalize(v), v / 5.0))

    def test_scale_transform(self):
        T = matrix.scale_transform(1, 2, 3)
        R = np.array([
            [1, 0, 0, 0],
            [0, 2, 0, 0],
            [0, 0, 3, 0],
            [0, 0, 0, 1]
        ])
        self.assertTrue(np.array_equal(T, R))

    def test_translation_matrix(self):

# Path: p5/pmath/matrix.py
# def _magnitude(arr):
# def _normalize(arry):
# def scale_transform(x, y, z=1):
# def translation_matrix(x, y, z=0):
# def rotation_matrix(axis, angle):
# def euler_rotation_matrix(heading, attitude, bank):
# def triple_axis_rotation_matrix(x, y, z):
# def look_at(eye, at, up):
# def perspective_matrix(field_of_view, aspect_ratio, near_plane, far_plane):
# 
# Path: p5/pmath/utils.py
# PI = math.pi


# Path: p5/pmath/tests/test_matrix.py
import unittest
import numpy as np
from p5.pmath import matrix
from p5.pmath.utils import PI



v = np.array([3, 4])


class TestMatrix(unittest.TestCase):

    def test_magnitude(self):
        self.assertEqual(matrix._magnitude(v), 5.0)

    def test_normalize(self):
        self.assertTrue(np.array_equal(matrix._normalize(v), v / 5.0))

    def test_scale_transform(self):
        T = matrix.scale_transform(1, 2, 3)
        R = np.array([
            [1, 0, 0, 0],
            [0, 2, 0, 0],
            [0, 0, 3, 0],
            [0, 0, 0, 1]
        ])
        self.assertTrue(np.array_equal(T, R))

    def test_translation_matrix(self):

        T = matrix.translation_matrix(5, 6, 7)