]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/Contour/Propagation.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / Contour / Propagation.cxx
index c6d2365481a9baa3806792f72baad6afc0ce0fb3..580863f9d39587b6deb7314fc62087962936f5da 100644 (file)
@@ -762,8 +762,8 @@ int PropContour::VectorDirection(std::vector<double>*InX, std::vector<double>*In
        {
                ax = (*InX)[i]-SumX;
                ay = (*InY)[i]-SumY;
-               bx = (*InX)[i+1]-SumX;
-               by = (*InY)[i+1]-SumY;
+               bx = (*InX)[(i+1)%size]-SumX;
+               by = (*InY)[(i+1)%size]-SumY;
                axb = (ax*by) - (bx*ay);
                if(axb > 0)
                {
@@ -1096,7 +1096,7 @@ void PropContour::SetKeyContours(std::vector<double>*InX, std::vector<double>*In
                                okFind=true;
                                i=sizeKeyContour;
                        }
-                       if ( (_KeyContourZ[i-1] != _KeyContourZ[i]) )
+                       if ( (i<sizeKeyContour) && (_KeyContourZ[i-1] != _KeyContourZ[i]) )
                        {
                                tmpIdKeyContSizes++;
                        }