Beispiel #1
0
def AutoCheckTest(IncidentLight,Plane,ReflectedLight,TrasmittedLight,n1,n2):
    #'use the Reflectedlight to calculate the Incidentlight'
    r2 = np.array([0,0,0])
    r2 = Fun.CaRDir(ReflectedLight,Plane)


    #'use the Trasmitted light to calculate the Incidentlight'
    t2 = np.array([0,0,0])
    t2 = Fun.CaTdir(TrasmittedLight,Plane,n2,n1)
    

    if abs(np.linalg.norm(np.cross(IncidentLight.dn,r2))) <= 0.1:
        print('yes')
    else:
        print('-------->  R false for this point:--------<')
        IncidentLight.displayLight()
        print(r2)
        return False
    
    if abs(np.linalg.norm(np.cross(IncidentLight.dn,t2))) <= 0.1:
        print('ok')
    else:
        print('-------->  T false for this point:--------<')
        IncidentLight.displayLight()
        print('n1 : n2')
        print(n1,n2)
        print(t2)
        return False

    return True
Beispiel #2
0
def InputLightPlane7():
    a = Fun.Light()  # a is Incidentlight
    b = Fun.Plane()  # b is the Plane

    a.inc([1, 2, -3], [2, 1, 4])
    b.inc([0, 0, 0], [2, 4, 3])
    n1 = 1
    n2 = 1
    return (a, b, n1, n2)
Beispiel #3
0
def InputLightPlane3():
    a = Fun.Light()  # a is Incidentlight
    b = Fun.Plane()  # b is the Plane

    a.inc([1, 0, 0], [2, 1, 2])
    b.inc([0, 0, 0], [-1, 4, -0.9])
    n1 = 1
    n2 = 1
    return (a, b, n1, n2)
Beispiel #4
0
def InputLightPlane13():
    a = Fun.Light()  # a is Incidentlight
    b = Fun.Plane()  # b is the Plane

    a.inc([0, 0, 0], [0, 0, 0])
    b.inc([0, 0, 0], [0, 1, 0])
    n1 = 1
    n2 = 1
    return (a, b, n1, n2)
Beispiel #5
0
def InputLightPlane9():
    a = Fun.Light()  # a is Incidentlight
    b = Fun.Plane()  # b is the Plane

    a.inc([-1, 1, 0], [1, -1, 0])
    b.inc([0, 0, 0], [0, 1, 0])
    n1 = math.sqrt(2)
    n2 = 1
    return (a, b, n1, n2)
Beispiel #6
0
def RandomLightInput():

    a = Fun.Light()  # a is Incidentlight
    b = Fun.Plane()  # b is the Plane

    a.inc(np.random.randint(5, size=3), np.random.randint(5, size=3))
    b.inc(np.random.randint(5, size=3), np.random.randint(5, size=3))
    n1 = random.randint(1, 3)
    n2 = random.randint(1, 3)
    return (a, b, n1, n2)
Beispiel #7
0
def test4():
    a = Fun.Light()  # a is Incident light
    b = Fun.Plane()  # b is the Plane
    #The input of Function
    a.inc([0, 1, 0], [1, 1, 0])
    b.inc([0, 0, 0], [-1, 1, 0])
    n1 = 1
    n2 = 1
    #The output should be

    r2 = Fun.CaPoint(a, b) == False
    assert r2
Beispiel #8
0
def test3():
    a = Fun.Light()  # a is Incident light
    b = Fun.Plane()  # b is the Plane
    #The input of Function
    a.inc([0, 0, 0], [0, 0, 0])
    b.inc([0, 0, 0], [0, 1, 0])
    n1 = 1
    n2 = 1
    #The output should be

    r1 = (Fun.JudgeCrossPoint(a, b) == False)
    assert r1
Beispiel #9
0
def test1():
    a = Fun.Light()  # a is Incident light
    b = Fun.Plane()  # b is the Plane
    #The input of Function
    a.inc([-1, 1, 0], [1, -1, 0])
    b.inc([0, 0, 0], [0, 1, 0])
    n1 = math.sqrt(2)
    n2 = 1
    #The output should be

    r1 = (Fun.CaRDir(a, b) == Fun.Normalized(np.array([1, 1, 0]))).all()
    r2 = (Fun.CaPoint(a, b) == np.array([0, 0, 0])).all()
    r3 = (Fun.CaTdir(a, b, n1, n2) == Fun.Normalized(np.array([0, 0,
                                                               0]))).all()
    assert r1 & r2 & r3
Beispiel #10
0
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
from matplotlib import cm
import random
import sys
import os

import FunktionLight as Fun
import DisplayWholeProcess as DisWP
import DisplayWholeProcess2 as DisWP2
import test as TS
import AutoTest as TIS

if __name__ == '__main__':
    
    a = Fun.Light()# a is Incidentlight
    b = Fun.Plane()# b is the Plane
    r = Fun.Light()# r is reflectedlight
    t = Fun.Light()# t is refractedlight(transmitted light)
    n1 = 1
    n2 = 1

    # if we will autotest or take the case we handly set
    Autotest = False
    # the results of the autotest ---> WriteN
    WriteN = False
    # WriteN --> and then we write in the AutotestOutput.txt
    f = open("AutotestOutput.txt", 'w+')


# sssd is just for circulation to the gauss random number check