#ifndef __PLANEWAVE__ #define __PLANEWAVE__ #include #include #include "rts/math/vector.h" template class planewave { rts::vector k; rts::vector E; public: //constructor, initialize to an x-polarized wave propagating along z planewave() { k = rts::vector(0, 0, 1); E = rts::vector(1, 0, 0); } planewave(rts::vector k_vec, rts::vector E0) { k = k_vec; //enforce k \dot E = 0 rts::vector s = E0.cross(k); rts::vector E_hat; if(s.len() == 0) E_hat = rts::vector(0, 0, 0); else E_hat = (s.cross(k)).norm(); E = E_hat * (E_hat.dot(E0)); } // refract will bend the wave vector k to correspond to the normalized vector v refract(rts::vector v) { //make sure that v is normalized v = v.norm(); } std::string toStr() { std::stringstream ss; ss<<"k = "<