16 #ifndef COPLANARITY_SELECTOR
17 #define COPLANARITY_SELECTOR
49 if (r1->getEvents()->size() == r2->getEvents()->size())
52 for (
unsigned int i = 0; i < r1->getEvents()->size(); i++)
54 Event* ev1 = r1->getEvents()->at(i).get();
55 Event* ev2 = r2->getEvents()->at(i).get();
97 typename std::map<std::vector<unsigned int>, vector<T*>,
CompareToKey>::iterator it;
99 std::vector<unsigned int> event_signature = r->getEventSignature();
106 r->computeLongueur();
109 vector<T*> rays = it->second;
110 cerr <<
"rays : " << rays.size() << endl;
134 typename std::map<std::vector<unsigned int>, vector<T*>,
CompareToKey>::iterator it;
136 std::vector<unsigned int> event_signature = r->getEventSignature();
143 r->computeLongueur();
146 vector<T*> rays = it->second;
147 cerr <<
"rays : " << rays.size() << endl;
157 selectedRays.insert(std::pair<std::vector<unsigned int>, vector<T*>>(event_signature, vec));
165 typename std::map<std::vector<unsigned int>, vector<T*>,
CompareToKey>::iterator it;
167 std::vector<unsigned int> event_signature = r->getEventSignature();
174 r->computeLongueur();
177 vector<T*> rays = it->second;
178 cerr <<
"rays : " << rays.size() << endl;
188 selectedRays.insert(std::pair<std::vector<unsigned int>, vector<T*>>(event_signature, vec));
200 return typeid(
this).
name();
204 std::map<std::vector<unsigned int>, vector<T*>,
CompareToKey>
: To keep only one from two or more rays which have the same history (events on the same primitive)
virtual ~CoPlanaritySelector()
Destructor.
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 void insert(T *r)
Select the ray.
bool haveCoPlanarEvents(T *r1, T *r2)
virtual Selector< T > * Copy()
Copy Selector.
CoPlanaritySelector()
Constructor.
virtual const char * getSelectorName()
Return the class type of the selector.
bool coPlanarityTest(Event *ev1, Event *ev2)
bool areBothReflections(Event *ev1, Event *ev2)
std::map< std::vector< unsigned int >, vector< T * >, CompareToKey > selectedRays
map of all event signatures with their corresponding rays
virtual void reset()
Reset (clear the data) of this Selector.
virtual bool insertWithTest(T *r)
Select the ray if it respects the criteria of this Selector.
Class describing an event (reflection, diffraction, ...)
Shape * getShape()
Return the primitive of the impact.
virtual int getType() const
Return the event type.
const vec3 & getPosition() const
Return a reference to the event location point.
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.
virtual vec3 getNormal(const vec3 pos=vec3())
Get normal.
base_vec3< decimal > vec3