16 #ifndef CLOSE_EVENT_SELECTOR
17 #define CLOSE_EVENT_SELECTOR
41 vector<boost::shared_ptr<Event>>* events = r->getEvents();
43 if (events->size() < 2)
48 for (
unsigned int i = 0; i < events->size() - 1; i++)
50 boost::shared_ptr<Event> ev1 = events->at(i);
51 boost::shared_ptr<Event> ev2 = events->at(i + 1);
52 int type1 = events->at(i)->getType();
53 int type2 = events->at(i + 1)->getType();
54 Shape *sh1 = NULL, *sh2 = NULL, *sh3 = NULL;
62 sh1 =
dynamic_cast<Cylindre*
>(ev1->getShape())->getFirstShape();
63 sh2 =
dynamic_cast<Cylindre*
>(ev1->getShape())->getSecondShape();
64 sh3 = ev2->getShape();
68 sh1 =
dynamic_cast<Cylindre*
>(ev2->getShape())->getFirstShape();
69 sh2 =
dynamic_cast<Cylindre*
>(ev2->getShape())->getSecondShape();
70 sh3 = ev1->getShape();
73 if ((sh3 == sh1) || (sh3 == sh2))
85 vector<boost::shared_ptr<Event>>* events = r->getEvents();
87 if (events->size() < 2)
92 for (
unsigned int i = 0; i < events->size() - 1; i++)
94 boost::shared_ptr<Event> ev1 = events->at(i);
95 boost::shared_ptr<Event> ev2 = events->at(i + 1);
96 int type1 = events->at(i)->getType();
97 int type2 = events->at(i + 1)->getType();
98 Shape *sh1 = NULL, *sh2 = NULL, *sh3 = NULL;
102 if ((type1 != type2))
106 sh1 =
dynamic_cast<Cylindre*
>(ev1->getShape())->getFirstShape();
107 sh2 =
dynamic_cast<Cylindre*
>(ev1->getShape())->getSecondShape();
108 sh3 = ev2->getShape();
112 sh1 =
dynamic_cast<Cylindre*
>(ev2->getShape())->getFirstShape();
113 sh2 =
dynamic_cast<Cylindre*
>(ev2->getShape())->getSecondShape();
114 sh3 = ev1->getShape();
117 if ((sh3 == sh1) || (sh3 == sh2))
132 return typeid(
this).
name();
Rejects a ray if two of its events occur on the same shape (for example a diffraction close to a refl...
virtual bool insertWithTest(T *r)
Select the ray if it respects the criteria of this Selector.
virtual const char * getSelectorName()
Return the class type of the selector.
virtual Selector< T > * Copy()
Copy Selector.
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.
CloseEventSelector()
Constructor.
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.
base class for shapes (Cylindre, Mesh, Sphere, Triangle,...)