Ticket #1942: partialsort.patch

File partialsort.patch, 827 bytes (added by fsincos, 8 years ago)

Do a partial sort on the edgeSquares since we are mainly interested in the nearest ones.

  • source/simulation2/components/CCmpPathfinder_Vertex.cpp

    diff --git a/source/simulation2/components/CCmpPathfinder_Vertex.cpp b/source/simulation2/components/CCmpPathfinder_Vertex.cpp
    index 5ab11b6..c1c2de9 100644
    a b void CCmpPathfinder::ComputeShortPath(const IObstructionTestFilter& filter,  
    808808
    809809        // Sort the edges so ones nearer this vertex are checked first by CheckVisibility,
    810810        // since they're more likely to block the rays
    811         std::sort(edgeSquares.begin(), edgeSquares.end(), SquareSort(vertexes[curr.id].p));
     811        if (edgeSquares.size() > 8)
     812            std::partial_sort(edgeSquares.begin(), edgeSquares.begin() + 8, edgeSquares.end(), SquareSort(vertexes[curr.id].p));
    812813
    813814        std::vector<Edge> edgesUnaligned;
    814815        std::vector<EdgeAA> edgesLeft;