Beispiel #1
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 #2
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 #3
0
#while sssd < 100: 
#    sssd +=1


    #'here we input the situation'   
    if Autotest == True:
        (a,b,n1,n2) = TIS.RandomLightInput()
    else:
        #'use the Test Case we set by hand'
        (a,b,n1,n2) = TS.InputLightPlane13()

    #''
    if Fun.JudgeCrossPoint(a,b):

        # calculate the reflected light and print the point and vector
        r.inc(Fun.CaPoint(a,b),Fun.CaRDir(a,b))
        print('The point and direction of the reflected light is:')
        r.displayLight()

        #'first judge if the total reflection will happen, Ture is not happen, and False is happen'
        if Fun.JudgeTotalReflection(a,b,n1,n2):

            # calculate the transmitted light and print the point and vector
            t.inc(Fun.CaPoint(a,b),Fun.CaTdir(a,b,n1,n2))
            print('The point and direction of the transmitted(refractedlight) light is:')
            t.displayLight()
            
            # if we will test or not, 
            # and we assume you dont want to see the figure, 100 figure is troublesome
            if Autotest == True:
                WriteN = TIS.AutoCheckTest(a,b,r,t,n1,n2)