rl_Ray.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <rl_raylib/rl_Ray.h>
00029 #include <iostream>
00030 #include <iomanip>
00031
00032 using namespace std;
00033
00034
00035
00036
00037
00038
00039
00040 rl_Ray::
00041 ~rl_Ray()
00042 {}
00043
00044
00045
00046
00047
00048
00049
00050 void rl_Ray::
00051 reflect( dvm3_Vector const& normal,
00052 rl_ReflectionCoefPOD const& rflcoef )
00053 {
00054 dvm3_Vector old_dir( dir_ );
00055 reflect_direction_vector( normal );
00056 pol_.reflect( normal, old_dir, dir_, rflcoef );
00057 }
00058
00059
00060
00061
00062 void rl_Ray::
00063 translate_rotate( dvm3_Vector const& trans,
00064 dvm3_RotMat const& rotmat )
00065 {
00066 rl_BasicRay::translate_rotate( trans, rotmat );
00067 rl_Polarization tmp( pol_ );
00068 tmp.rotate( pol_, rotmat );
00069 }
00070
00071
00072
00073
00074 void rl_Ray::
00075 derotate_detranslate( dvm3_Vector const& trans,
00076 dvm3_RotMat const& rotmat )
00077 {
00078 rl_BasicRay::derotate_detranslate( trans, rotmat );
00079 rl_Polarization tmp( pol_ );
00080 tmp.derotate( pol_, rotmat );
00081 }
00082
00083
00084
00085 std::ostream& rl_Ray::
00086 print_on( std::ostream& os,
00087 char const pre[],
00088 char const pst[]
00089 ) const
00090 {
00091 if ( ::strlen(pre) ) { os << pre; }
00092 os.setf(ios::showpoint);
00093 os.setf(ios::fixed);
00094 os << setw(8) << id_ << " : ";
00095 os << " " << setw(18) << energy_ << " : (";
00096 pos_.print_on( os );
00097 os << ") (" << setw(18);
00098 dir_.print_on( os );
00099 os << ")";
00100 if ( ::strlen(pst) ) { os << pst; }
00101 os << endl;
00102
00103 if ( ::strlen(pre) ) { os << pre; }
00104 os << setw(8) << id_ << " : ";
00105 pol_.print_on( os );
00106 if ( ::strlen(pst) ) { os << pst; }
00107 os << endl;
00108
00109 return os;
00110 }