PedestrianDynamics / jupedsim

JuPedSim is an open source pedestrian dynamics simulator
http://jupedsim.org
Other
40 stars 28 forks source link

Unintended door warning #962

Closed JetteSchumann closed 2 years ago

JetteSchumann commented 2 years ago

I checked the warnings of this simulation example (version 0.9.3): UnintendedDoor.zip

[2022-03-03 09:12:59.390] [warning] Ped 134: used an unindented door 10, but wanted to go to 9.

This warning makes no sense (apart from the typo :wink:). The agent is moving straight from one door to the next one.

schroedtert commented 2 years ago

It seems that int Line::IntersectionWith(const Point & p1, const Point & p2, Point & p3) const detects an intersection already if the pedestrian is close proximity of the line.

In this case the line is (8, 2) - (8, 3) and the ped movement is (8.0003882292737973, 2.6819323835814051) - (8.0099988090806828, 2.6815977393033035), which doesn't intersect the line at all.

schroedtert commented 2 years ago

Played a bit around, when using boost::geometry to detect the intersection the warnings don't appear anymore and the result seems to be the same for the provided case. Not tested if all functionality is as before, especially the overlap detection:

int Line::IntersectionWith(const Point & p1, const Point & p2, Point & p3) const
{
    boost::geometry::model::segment<Point> line(_point1, _point2);
    boost::geometry::model::segment<Point> foo(p1, p2);
    std::vector<Point> output;
    boost::geometry::intersection(line, foo, output);

    switch(output.size()) {
        case 0:
            return LineIntersectType::NO_INTERSECTION;
        case 1:
            p3 = output[0];
            return LineIntersectType::INTERSECTION;
        case 2:
            return LineIntersectType::OVERLAP;
    }
    throw std::runtime_error("Not reachable...");
}
Ozaq commented 2 years ago

Thanks a lot for looking into it, I agree this looks like a bug in the current implementation.

Ozaq commented 2 years ago

Fixed on master and for 0.9.5