# Path: tracer/optics.py
# def fresnel(ray_dirs, normals, n1, n2):
# def reflections(ray_dirs, normals):  
# def refractions(n1, n2, ray_dirs, normals):
# def refr_idx_hartmann(wavelength, a, b, c, d, e):
#     R = (Rs + Rp)/2


import math
import unittest
import numpy as N
from tracer import optics
# Unit tests for the optics module.
#
# Reference:
# [1] Grant R. Fowles, Introduction to Modern Optics, 2nd ed.; Dover 
#     Publications Inc.; 1989



class TestSingleReflection(unittest.TestCase):
    def runTest(self):
        """A single beam at 45 degs to the surface reflects correctly"""
        dir = N.array([[0, 1, -1]]).T / math.sqrt(2)
        normal = N.array([[0, 0, 1]]).T
        correct_reflection = N.array([[0, 1, 1]]).T / math.sqrt(2)
        

# Path: tracer/optics.py
# def fresnel(ray_dirs, normals, n1, n2):
# def reflections(ray_dirs, normals):  
# def refractions(n1, n2, ray_dirs, normals):
# def refr_idx_hartmann(wavelength, a, b, c, d, e):
#     R = (Rs + Rp)/2


# Path: tests/test_optics.py
import math
import unittest
import numpy as N
from tracer import optics

# Unit tests for the optics module.
#
# Reference:
# [1] Grant R. Fowles, Introduction to Modern Optics, 2nd ed.; Dover 
#     Publications Inc.; 1989



class TestSingleReflection(unittest.TestCase):
    def runTest(self):
        """A single beam at 45 degs to the surface reflects correctly"""
        dir = N.array([[0, 1, -1]]).T / math.sqrt(2)
        normal = N.array([[0, 0, 1]]).T
        correct_reflection = N.array([[0, 1, 1]]).T / math.sqrt(2)
        

        reflection = optics.reflections(dir, normal)