rl_Ray.h

00001 #ifndef rl_Ray_h_INCLUDED
00002 #define rl_Ray_h_INCLUDED
00003 
00004 // File:   rl_Ray.h
00005 // Author: Terry Gaetz
00006 
00007 /* --8<--8<--8<--8<--
00008  *
00009  * Copyright (C) 2006, 2007 Smithsonian Astrophysical Observatory
00010  *
00011  * This file is part of rl_raylib
00012  *
00013  * rl_raylib is free software; you can redistribute it and/or
00014  * modify it under the terms of the GNU General Public License
00015  * as published by the Free Software Foundation; either version 2
00016  * of the License, or (at your option) any later version.
00017  *
00018  * rl_raylib is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the 
00025  *       Free Software Foundation, Inc. 
00026  *       51 Franklin Street, Fifth Floor
00027  *       Boston, MA  02110-1301, USA
00028  *
00029  * -->8-->8-->8-->8-- */
00030 
00031 #include <rl_basicray/rl_BasicRay.h>                  // rl_BasicRay
00032 #include <rl_raylib/rl_Polarization.h>                // rl_Polarization
00033 #include <dvm3/dvm3_vector.h>                         // dmv3_Vector
00034 
00035 //########################################################################
00036 // rl_Ray
00037 //########################################################################
00038 
00045 class rl_Ray
00046   : public rl_BasicRay
00047 {
00048 private:
00049 
00051   rl_Polarization  pol_;
00052 
00053 public:
00054 
00055 
00059  virtual ~rl_Ray();
00060 
00065  rl_Ray();
00066 
00071   rl_Ray( rl_BasicRay const& ray, rl_PolCSPOD const& cspol );
00072 
00082   rl_Ray( dvm3_Vector const& pos, dvm3_Vector const& dir,
00083           double energy, long int id,
00084           rl_PolCSPOD const& cspol );
00085 
00095   void init_ray( dvm3_Vector const& pos, dvm3_Vector const& dir,
00096                  double energy, long int id,
00097                  rl_PolCSPOD const& cspol );
00098 
00104   rl_Polarization const& polarization() const;
00105 
00111   void set_polarization( rl_PolCSPOD const& cspol );
00112 
00118   void get_PolCSPOD( rl_PolCSPOD& cs ) const;
00119 
00125   double intensity() const;
00126 
00132   void attenuate( double by_how_much );
00133 
00140   void reflect( dvm3_Vector const& normal, 
00141                 rl_ReflectionCoefPOD const& rflcoef );
00142 
00150   void translate_rotate( dvm3_Vector const& trans,
00151                          dvm3_RotMat const& rotmat );
00152 
00161   void derotate_detranslate( dvm3_Vector const& trans,
00162                              dvm3_RotMat const& rotmat );
00163 
00171   std::ostream& print_on( std::ostream& os, char const pre[] = "", 
00172                                             char const pst[] = "" ) const;
00173 };
00174 
00175 //########################################################################
00176 //########################################################################
00177 //
00178 //    #    #    #  #          #    #    #  ######   ####
00179 //    #    ##   #  #          #    ##   #  #       #
00180 //    #    # #  #  #          #    # #  #  #####    ####
00181 //    #    #  # #  #          #    #  # #  #            #
00182 //    #    #   ##  #          #    #   ##  #       #    #
00183 //    #    #    #  ######     #    #    #  ######   ####
00184 //
00185 //########################################################################
00186 //########################################################################
00187 
00188 //=========================================================================
00189 // dtor, ctors, initializers...
00190 
00191 //-------------------------------------------------------------------------
00192 inline rl_Ray::
00193 rl_Ray()
00194 {}
00195 
00196 //-------------------------------------------------------------------------
00197 inline rl_Ray::
00198 rl_Ray( rl_BasicRay const& ray, rl_PolCSPOD const& cspol )
00199   : rl_BasicRay( ray ), pol_( cspol, ray.direction() )
00200 {}
00201 
00202 inline rl_Ray::
00203 rl_Ray( dvm3_Vector const& pos, dvm3_Vector const& dir,
00204         double energy, long int id,
00205         rl_PolCSPOD const& cspol )
00206   : rl_BasicRay( pos, dir, energy, id ),
00207     pol_( cspol, dir )
00208 {}
00209 
00210 inline void rl_Ray::
00211 init_ray( dvm3_Vector const& pos, dvm3_Vector const& dir,
00212           double energy, long int id,
00213           rl_PolCSPOD const& cspol )
00214 { 
00215   rl_BasicRay::init( pos, dir, energy, id ); 
00216   pol_.init( cspol, dir );
00217 }
00218 
00219 //=========================================================================
00220 // accessors
00221 
00222 //-------------------------------------------------------------------------
00223 inline rl_Polarization const& rl_Ray::
00224 polarization() const
00225 { return pol_; }
00226 
00227 //-------------------------------------------------------------------------
00228 inline void rl_Ray::
00229 get_PolCSPOD( rl_PolCSPOD& cs ) const
00230 { pol_.get_PolCSPOD( cs, dir_); }
00231 
00232 //-------------------------------------------------------------------------
00233 inline double rl_Ray::
00234 intensity() const
00235 { return pol_.intensity(); }
00236 
00237 //=========================================================================
00238 // mutators
00239 
00240 //-------------------------------------------------------------------------
00241 inline void rl_Ray::
00242 set_polarization( rl_PolCSPOD const& cspol )
00243 { pol_.init( cspol, dir_ ); }
00244 
00245 //-------------------------------------------------------------------------
00246 inline void rl_Ray::
00247 attenuate( double by_how_much )
00248 { pol_.attenuate( by_how_much ); }
00249 
00250 // rl_Ray_h_INCLUDED
00251 #endif

Generated on Mon Nov 3 18:15:05 2008 for rl_raylib by  doxygen 1.5.6