本文整理汇总了C++中Transition::DistTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Transition::DistTo方法的具体用法?C++ Transition::DistTo怎么用?C++ Transition::DistTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transition
的用法示例。
在下文中一共展示了Transition::DistTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateFlowAtDoors
void Simulation::UpdateFlowAtDoors(const Pedestrian& ped) const
{
if (_config->ShowStatistics()) {
Transition* trans = _building->GetTransitionByUID(ped.GetExitIndex());
if (trans) {
//check if the pedestrian left the door correctly
if (trans->DistTo(ped.GetPos())>0.5) {
Log->Write("WARNING:\t pedestrian [%d] left room/subroom [%d/%d] in an unusual way. Please check",
ped.GetID(), ped.GetRoomID(), ped.GetSubRoomID());
Log->Write(" :\t distance to last door (%d | %d) is %f. That should be smaller.",
trans->GetUniqueID(), ped.GetExitIndex(),
trans->DistTo(ped.GetPos()));
Log->Write(" :\t correcting the door statistics");
//ped.Dump(ped.GetID());
//checking the history and picking the nearest previous destination
double biggest = 0.3;
bool success = false;
for (const auto& dest:ped.GetLastDestinations()) {
if (dest!=-1) {
Transition* trans_tmp = _building->GetTransitionByUID(dest);
if (trans_tmp && trans_tmp->DistTo(ped.GetPos())<biggest) {
biggest = trans_tmp->DistTo(ped.GetPos());
trans = trans_tmp;
Log->Write(" :\t Best match found at door %d", dest);
success = true;//at least one door was found
}
}
}
if (!success) {
Log->Write("WARNING :\t correcting the door statistics");
return; //todo we need to check if the ped is in a subroom neighboring the target. If so, no problems!
}
}
//#pragma omp critical
trans->IncreaseDoorUsage(1, ped.GetGlobalTime());
}
}
}