def __init__(self, theta=0.0, phi=0.0, etaIn=1.0, etaOut=1.0): self.etaIn = etaIn self.etaOut = etaOut self.incoming = SphericalCoords(theta * math.pi, phi * 2 * math.pi) self.reflected = self.incoming.reflect() self.refracted = self.incoming.refract(etaIn, etaOut) self.initScene()
def visualizeSphereParametrization(): sphere(radius=1, opacity=0.25, material=materials.show_mat_pos) thetaSampleCount = 20 phiSampleCount = 40 thetaStep = 1.0 / float(thetaSampleCount) phiStep = 1.0 / float(phiSampleCount) for i in range(0, thetaSampleCount + 1): for j in range(0, phiSampleCount + 1): spherical = SphericalCoords( theta = (i * thetaStep - 0.5) * math.pi, phi = (j * phiStep) * 2 * math.pi) color = visual.color.hsv_to_rgb((j * phiStep, i * thetaStep, 1.0)) points(pos=[spherical.toCartesian()], color=color)