include/crbn/matter/fresnel.hpp

00001 #ifndef _FRESNEL_HPP_
00002 #define _FRESNEL_HPP_
00003 
00004 #include <crbn/basic/scalar.hpp>
00005 
00006 // http://scienceworld.wolfram.com/physics/FresnelEquations.html
00007 // ----> http://citadels.no-ip.info/~mooz/renderDiamond_WCGS00.pdf
00008 // ----> http://citadels.no-ip.info/~mooz/reflectance.pdf
00009 // ----> http://www.tf.uni-kiel.de/matwis/amat/semi_en/kap_5/backbone/r5_2_2.html
00010 // http://www.integra.co.jp/webpages/inspirer/whitepap/ch3/ch3.htm
00011 // ----> http://www.imagico.de/pov/water/water_app1.html
00012 // ----> http://hyperphysics.phy-astr.gsu.edu/hbase/phyopt/freseq.html
00013 // http://www.atis.org/tg2k/_absorption_index.html
00014 //
00015 
00016 // Compute fresnel term
00017 
00018 // FresnelPerpendicularReflect :
00019 // Ratio of amplitudes of reflected to incoming electric 
00020 // fields perpendicular to the plane of incidence
00021 inline float FresnelPerpendicularReflect(const float& n1, const float& cos_alpha, 
00022                                          const float& n2, const float& cos_beta ) {
00023         return ((n1 * cos_alpha) - (n2 * cos_beta)) / ((n1 * cos_alpha) + (n2 * cos_beta));
00024 }
00025 
00026 // FresnelParallelReflect :
00027 // Ratio of amplitudes of reflected to incoming electric
00028 // fields parallel to the plane of incidence
00029 inline float FresnelParallelReflect(const float& n1, const float& cos_alpha,
00030                                     const float& n2, const float& cos_beta ) {
00031         return ((n2 * cos_alpha) - (n1 * cos_beta)) / ((n1 * cos_beta) + (n2 * cos_alpha));
00032 }
00033 
00034 // FresnelPerpendicularTransmit :
00035 // Ratio of amplitudes of transmitted to incoming electric
00036 // fields perpendicular to the plane of incidence
00037 inline float FresnelPerpendicularTransmit(const float& n1, const float& cos_alpha,
00038                                           const float& n2, const float& cos_beta ) {
00039         return (2.0 * n1 * cos_alpha) / ((n1 * cos_alpha) + (n2 * cos_beta));
00040 }
00041 
00042 // FresnelParallelTransmit :
00043 // Ratio of amplitudes of transmitted to incoming electric
00044 // fields parallel to the plane of incidence
00045 inline float FresnelParallelTransmit(const float& n1, const float& cos_alpha,
00046                                      const float& n2, const float& cos_beta ) {
00047         return (2.0 * n1 * cos_alpha) / ((n1 * cos_beta) + (n2 * cos_alpha));
00048 }
00049 
00050 // Reflected + Transmitted = 1
00051 // Reflected power
00052 inline float Reflected(const float& n1, const float& cos_alpha,
00053                        const float& n2, const float& cos_beta ) {
00054         float parallel      = FresnelParallelReflect(n1, cos_alpha, n2, cos_beta);
00055         float perpendicular = FresnelPerpendicularReflect(n1, cos_alpha, n2, cos_beta);
00056         return 0.5 * (sqr(parallel) + sqr(perpendicular));
00057 }
00058 
00059 // Transmitted power
00060 inline float Transmitted(const float& n1, const float& cos_alpha,
00061                          const float& n2, const float& cos_beta ) {
00062         float parallel      = FresnelParallelTransmit(n1, cos_alpha, n2, cos_beta);
00063         float perpendicular = FresnelPerpendicularTransmit(n1, cos_alpha, n2, cos_beta);
00064 
00065         return ((n2 * cos_beta) / (n1 * cos_alpha)) * 0.5 * (sqr(parallel) + sqr(perpendicular)); 
00066 }
00067 
00068 #endif

Generated on Tue Nov 14 15:40:08 2006 for libcrbn by  doxygen 1.5.0