26 std::cerr <<
"Error : ray without source or receptor computeLongueur" << std::endl;
48 longueur = posSource.distance(posRecep);
68 longueur += posLastEvent.distance(posRecepteur);
84 std::vector<boost::shared_ptr<Event>>::iterator iter =
events.begin();
86 vec3 previous = (*iter)->getPosition();
87 vec3 current(0., 0., 0.);
90 while (iter !=
events.end())
92 current = (*iter)->getPosition();
93 length += current.distance(previous);
105 std::cerr <<
"Error : ray without source or receptor computeTrueLength" << std::endl;
117 closestPoint = ref.closestPointOnLine(posSource, lastPos);
120 return posSource.distance(closestPoint);
132 posLastEvent =
events.back()->getPosition();
135 closestPoint = ref.closestPointOnLine(posLastEvent, lastPos);
139 return length += closestPoint.distance(posLastEvent);
151 std::cerr <<
"Error : ray without source (computePertinentLength)" << std::endl;
158 vec3 current(0., 0., 0.), previous(0., 0., 0.);
174 s =
dynamic_cast<Source*
>(pertinentEvent);
188 e =
dynamic_cast<Event*
>(pertinentEvent);
194 std::vector<boost::shared_ptr<Event>>::reverse_iterator rit =
events.rbegin();
196 previous = (*rit)->getPosition();
199 while ((rit !=
events.rend()) && ((*rit).get() != e))
202 current = (*rit)->getPosition();
203 pertinent_length += current.distance(previous);
208 posLastEvent =
vec3(
events.back()->getPosition());
210 closestPoint = ref.closestPointOnLine(posLastEvent, lastPos);
213 return (pertinent_length += closestPoint.distance(posLastEvent));
227 for (std::vector<boost::shared_ptr<Event>>::iterator iter =
events.begin(); iter !=
events.end(); ++iter)
229 if ((*iter)->getType() == evType)
231 res = (
Base*)((*iter).get());
240 std::vector<unsigned int> result;
242 for (
unsigned int i = 0; i <
events.size(); i++)
244 result.push_back(
events.at(i)->getShape()->getFaceId());
253 std::vector<unsigned int> result;
255 for (
unsigned int i = 0; i <
events.size(); i++)
257 result.push_back(
events.at(i)->getShape()->getPrimitiveId());
270 return distance * angle;
273 return (
decimal)(2. * distance * sqrt(angle /
M_PI));
304 return std::make_pair(SR, SD);
312 for (
size_t i = 0; i <
events.size(); i++)
323 for (
size_t i = 0; i <
events.size(); i++)
327 if (
events.at(i)->getType() == typeEv)
std::pair< bitSet, bitSet > signature
Base class of Event, Material, PostFilter, Ray, Repere, Scene, Shape, Simulation, Source.
Class describing an event (reflection, diffraction, ...)
virtual int getType() const
Return the event type.
virtual int getInitialNbResponseLeft() const
Return the number of rays to launch after event.
decimal computeTrueLength(const vec3 &ref, const vec3 &lastPos, vec3 &closestPoint)
Compute ray length from source to closestPoint.
std::vector< boost::shared_ptr< Event > > events
Events list for the ray.
bitSet getSRBitSet(const unsigned int &source_id, const unsigned int &receptor_id)
Compute the bitSet associated with a source and a receptor.
decimal getSolidAngle(bool &diffraction)
Compute the solid angle associated with the ray (depends on the type of source which generated the ra...
Source * source
Pointer to the source of the ray.
std::vector< unsigned int > getPrimitiveHistory()
Return the array of primitives id encountered by the ray.
void * recepteur
Pointer to the receptor of the ray.
decimal getThickness(const decimal &distance, bool diffraction)
Compute the thickness of the ray after having traveled a certain distance depending on the type of so...
vec3 getPosition() const
Return starting point ray.
Base * getLastPertinentEventOrSource(typeevent evType=DIFFRACTION)
Return a pointer to the last event of type evType or source if none.
std::vector< unsigned int > getEventSignature()
signature getSignature(const typeevent &typeEv=SPECULARREFLEXION)
Compute the signature (i.e. std::pair<unsigned int, unsigned int>) of the ray)
std::vector< unsigned int > getFaceHistory()
Return the array of faces id encountered by the ray.
bitSet getEventsBitSet(const typeevent &typeEv)
Compute the bitSet associated with a list of events of type evType.
decimal computePertinentLength(const vec3 &ref, const vec3 &lastPos, vec3 &closestPoint)
Compute ray length from last pertinent event (i.e. source or last diffraction) to the nearest point o...
decimal longueur
Distance traveled by the ray.
decimal computeEventsSequenceLength()
Compute the length of the sequence of events.
void computeLongueur()
Compute the distance traveled (length) by the ray and the result is set into the longueur attribute.
Receptor inherits from a Sphere Shape.
int getInitialRayCount()
Get the initial rays counter.
vec3 getPosition()
Get the position of the Source.
unsigned int getId()
Get the Source id.
base_vec3< decimal > vec3