16 #ifndef COPLANARITY_SELECTOR 17 #define COPLANARITY_SELECTOR 50 if(r1->getEvents()->size()==r2->getEvents()->size()){
52 for(
unsigned int i=0;i<r1->getEvents()->size();i++){
53 Event* ev1 = r1->getEvents()->at(i).get();
54 Event* ev2 = r2->getEvents()->at(i).get();
93 typename std::map<std::vector<unsigned int>, vector<T*>,
CompareToKey>::iterator it;
95 std::vector<unsigned int> event_signature = r->getEventSignature();
102 r->computeLongueur();
105 vector<T*> rays=it->second;
106 cerr<<
"rays : "<<rays.size()<<endl;
130 typename std::map<std::vector<unsigned int>, vector<T*>,
CompareToKey>::iterator it;
132 std::vector<unsigned int> event_signature = r->getEventSignature();
139 r->computeLongueur();
142 vector<T*> rays=it->second;
143 cerr<<
"rays : "<<rays.size()<<endl;
152 selectedRays.insert(std::pair<std::vector<unsigned int>, vector<T*>>(event_signature,vec));
160 typename std::map<std::vector<unsigned int>, vector<T*>,
CompareToKey>::iterator it;
162 std::vector<unsigned int> event_signature = r->getEventSignature();
169 r->computeLongueur();
172 vector<T*> rays=it->second;
173 cerr<<
"rays : "<<rays.size()<<endl;
182 selectedRays.insert(std::pair<std::vector<unsigned int>, vector<T*>>(event_signature,vec));
193 return typeid(
this).
name();
Shape * getShape()
Return the primitive of the impact.
const vec3 & getPosition() const
Return a reference to the event location point.
bool deletable
Flag to know if the selector may be deleted or not.
base_vec3< decimal > vec3
: To keep only one from two or more rays which have the same history (events on the same primitive) ...
virtual Selector< T > * Copy()
Copy Selector.
virtual int getType() const
Return the event type.
bool areBothReflections(Event *ev1, Event *ev2)
bool coPlanarityTest(Event *ev1, Event *ev2)
Base class for Selector (used to keep or disable rays according different criterias) ...
virtual const char * getSelectorName()
Return the class type of the selector.
std::map< std::vector< unsigned int >, vector< T * >, CompareToKey > selectedRays
map of all event signatures with their corresponding rays
bool haveCoPlanarEvents(T *r1, T *r2)
virtual vec3 getNormal(const vec3 pos=vec3())
Get normal.
virtual void insert(T *r)
Select the ray.
virtual bool insertWithTest(T *r)
Select the ray if it respects the criteria of this Selector.
Class describing an event (reflection, diffraction, ...)
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.
void setIsDeletable(bool _isDeletable)
Set deletable flag.
CoPlanaritySelector()
Constructor.
virtual ~CoPlanaritySelector()
Destructor.
virtual void reset()
Reset (clear the data) of this Selector.