changeset 1838:80e029f8ec91

fix wrong display of RTStruct when an RTStruct point has exactly the same X or Y coordinates as the origin
author Alain Mazy <alain@mazy.be>
date Thu, 17 Jun 2021 17:00:06 +0200
parents 5a6adbc20ace
children d7ac540e0149
files OrthancStone/Sources/Toolbox/DicomStructureSet.cpp
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp	Sat Jun 12 13:43:42 2021 +0200
+++ b/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp	Thu Jun 17 17:00:06 2021 +0200
@@ -342,8 +342,8 @@
 
         // if prev* and cur* are on opposite sides of y, this means that the
         // segment intersects the plane.
-        if ((prevY < y && curY > y) ||
-            (prevY > y && curY < y))
+        if ((prevY <= y && curY >= y) ||
+            (prevY >= y && curY <= y))
         {
           double p = (curX * prevY - curY * prevX + y * (prevX - curX)) / (prevY - curY);
           xmin = std::min(xmin, p);
@@ -413,8 +413,8 @@
         double curX, curY;
         geometry_.ProjectPoint2(curX, curY, points_[i]);
 
-        if ((prevX < x && curX > x) ||
-            (prevX > x && curX < x))
+        if ((prevX <= x && curX >= x) ||
+            (prevX >= x && curX <= x))
         {
           double p = (curX * prevY - curY * prevX + x * (curY - prevY)) / (curX - prevX);
           ymin = std::min(ymin, p);