00001 /* 00002 * File: ray.h 00003 * Summary: Ray definition 00004 */ 00005 00006 #ifndef RAY_H 00007 #define RAY_H 00008 00009 #include "fixedarray.h" 00010 #include "geom2d.h" 00011 00012 typedef SquareArray<bool,1> reflect_grid; 00013 00014 struct ray_def 00015 { 00016 geom::ray r; 00017 bool on_corner; 00018 int cycle_idx; 00019 00020 ray_def() : on_corner(false), cycle_idx(-1) {} 00021 ray_def(const geom::ray& _r) 00022 : r(_r), on_corner(false), cycle_idx(-1) {} 00023 00024 coord_def pos() const; 00025 bool advance(); 00026 void bounce(const reflect_grid &rg); 00027 void regress(); 00028 00029 // Get and set the direction. 00030 double get_degrees() const; 00031 void set_degrees(double d); 00032 00033 bool _valid() const; 00034 }; 00035 00036 #endif