# Path: tracer/spatial_geometry.py
# def general_axis_rotation(axis,  angle):
# def rotation_to_z(vecs):
# def generate_transform(axis, angle, translation):
# def rotx(ang):
# def roty(ang):
# def rotz(ang):
# def translate(x, y, z):


import unittest
import numpy as np
from tracer import spatial_geometry as sg

class TestRotateToZ(unittest.TestCase):
    def test_single_vec(self):
        """A rotation into one vector is correct"""
        vec = np.r_[1., 1., 1.]/np.sqrt(3)
        rot = sg.rotation_to_z(vec)
        np.testing.assert_array_almost_equal(rot, np.c_[
            np.r_[1., -1, 0.]/np.sqrt(2), np.r_[1., 1., -2.]/np.sqrt(6), vec])
    
    def test_two_vecs(self):
        """Vectorization of rotation into a vector"""
        vecs = np.vstack((np.r_[1., 1., 1.]/np.sqrt(3), np.r_[1., 0., 0.]))

# Path: tracer/spatial_geometry.py
# def general_axis_rotation(axis,  angle):
# def rotation_to_z(vecs):
# def generate_transform(axis, angle, translation):
# def rotx(ang):
# def roty(ang):
# def rotz(ang):
# def translate(x, y, z):


# Path: tests/test_transforms.py
import unittest
import numpy as np
from tracer import spatial_geometry as sg


class TestRotateToZ(unittest.TestCase):
    def test_single_vec(self):
        """A rotation into one vector is correct"""
        vec = np.r_[1., 1., 1.]/np.sqrt(3)
        rot = sg.rotation_to_z(vec)
        np.testing.assert_array_almost_equal(rot, np.c_[
            np.r_[1., -1, 0.]/np.sqrt(2), np.r_[1., 1., -2.]/np.sqrt(6), vec])
    
    def test_two_vecs(self):
        """Vectorization of rotation into a vector"""
        vecs = np.vstack((np.r_[1., 1., 1.]/np.sqrt(3), np.r_[1., 0., 0.]))

        rots = sg.rotation_to_z(vecs)