16 #ifndef DIFFRACTION_PATH_SELECTOR
17 #define DIFFRACTION_PATH_SELECTOR
42 vector<boost::shared_ptr<Event>>* events = r->getEvents();
43 if (events->size() == 0)
53 Source* pSource = r->getSource();
56 vec3 current_pos = origin;
59 vector<boost::shared_ptr<Event>>::reverse_iterator rit = events->rbegin();
60 while (rit != events->rend())
62 cumul_distance += (*rit)->getPosition().distance(current_pos);
72 decimal direct_distance = origin.distance((*rit)->getPosition());
73 cumul_delta += (cumul_distance - direct_distance);
79 origin = (*rit)->getPosition();
89 current_pos = (*rit)->getPosition();
97 cumul_distance += current_pos.distance(pSource->
getPosition());
101 cumul_delta += (cumul_distance - direct_distance);
112 virtual void insert(T* r,
unsigned long long& replace)
119 vector<boost::shared_ptr<Event>>* events = r->getEvents();
121 if (events->size() == 0)
131 Source* pSource = r->getSource();
134 vec3 current_pos = origin;
137 vector<boost::shared_ptr<Event>>::reverse_iterator rit = events->rbegin();
138 while (rit != events->rend())
140 cumul_distance += (*rit)->getPosition().distance(current_pos);
150 decimal direct_distance = origin.distance((*rit)->getPosition());
151 cumul_delta += (cumul_distance - direct_distance);
157 origin = (*rit)->getPosition();
167 current_pos = (*rit)->getPosition();
175 cumul_distance += current_pos.distance(pSource->
getPosition());
179 cumul_delta += (cumul_distance - direct_distance);
210 return typeid(
this).
name();
: Rejects rays if the cumulative length added by the diffractions events in comparison to the length ...
virtual bool insertWithTest(T *r)
Select the ray if it respects the criteria of this Selector.
void setMaximumDelta(double _maximumDelta)
Set maximumDelta.
double maximumDelta
Maximal path length difference between rays produced by diffraction.
virtual void insert(T *r, unsigned long long &replace)
Select the ray.
virtual Selector< T > * Copy()
Copy Selector.
double getMaximumDelta()
Get maximumDelta.
virtual SELECTOR_RESPOND canBeInserted(T *r, unsigned long long &replace)
Check if the ray respects the criteria of this Selector and return a SELECTOR_RESPOND.
virtual const char * getSelectorName()
Return the class type of the selector.
DiffractionPathSelector(double _maximumDelta=8)
Constructor.
Receptor inherits from a Sphere Shape.
vec3 getPosition()
Get the center of the bounding box.
Base class for Selector (used to keep or disable rays according different criterias)
void setIsDeletable(bool _isDeletable)
Set deletable flag.
bool deletable
Flag to know if the selector may be deleted or not.
vec3 getPosition()
Get the position of the Source.
base_vec3< decimal > vec3