Beispiel #1
0
    def setMicrofacet(self, eta, alpha):
        n = self.resolution()
        h = int(n / 2)
        fourierOrdersTarget = self.fourierOrders()
        FL = np.zeros((n, n, fourierOrdersTarget))
        for i in range(n):
            for o in range(n):
                coeffs = ll.microfacetFourierSeries(- self.nodes[o], - self.nodes[i], eta, alpha, fourierOrdersTarget, 10e-4)
                #coeffs = microfacetFourierSeries(- self.nodes[o], - self.nodes[i], eta, alpha, fourierOrdersTarget)
                for l in range(len(coeffs[:fourierOrdersTarget])):
                    FL[o, i, l] = coeffs[l]

        SM = np.zeros((n, n, fourierOrdersTarget))
        for i in range(fourierOrdersTarget):
            SM[:, :, i] = self.applyWeights(FL[:, :, i], i)

        self.scatteringMatrix = SM
y  = np.zeros(n)
y2  = np.zeros(n)
mu_i = -0.6
mu_o = 0.5
alpha = 0.05
eta_i = 1.5c
eta_o = 1.0
eta = eta_i / eta_o
etaC = complex(eta, 0)
relerr = 10e-6

for i in range(n):
    curPhi = phi[i]
    y[i] = microfacetNoExp(mu_o, mu_i, etaC, alpha, curPhi)

quickTest = ll.microfacetFourierSeries(1.0, 1.0, etaC, alpha, n, 10e-4)
quickTest2 = microfacetFourierSeries(1.0, 1.0, etaC, alpha, n, 10e-4)
cOrig = ll.microfacetFourierSeries(mu_o, mu_i, etaC, alpha, n, 10e-4)
c = microfacetFourierSeries(mu_o, mu_i, etaC, alpha, n)
cnoExp = microfacetNoExpFourierSeries(mu_o, mu_i, etaC, alpha, nCoeffb, np.pi)

print("Our coeff: " + str(len(c)))
print("ll coeff: " + str(len(cOrig)))

plt.figure()
plt.plot(cOrig, 'b')
plt.plot(c, 'r--')
plt.savefig("Coeff.pdf")

yOrig = fourierEval(cOrig, phi)
y = fourierEval(c, phi)