Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Toolbox/DicomStructureSet.cpp @ 1897:144f8f82c15a
added ctrl key in RtViewerWasm
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 26 Jan 2022 17:28:47 +0100 |
parents | b3c08e607d9f |
children | a5e54bd87b25 |
comparison
equal
deleted
inserted
replaced
1896:b3c08e607d9f | 1897:144f8f82c15a |
---|---|
899 if (polygon->Project(x1, y1, x2, y2, slice)) | 899 if (polygon->Project(x1, y1, x2, y2, slice)) |
900 { | 900 { |
901 projected.push_back(CreateRectangle(x1, y1, x2, y2)); | 901 projected.push_back(CreateRectangle(x1, y1, x2, y2)); |
902 } | 902 } |
903 } | 903 } |
904 | |
905 BoostMultiPolygon merged; | |
906 Union(merged, projected); | |
907 | |
908 chains.resize(merged.size()); | |
909 for (size_t i = 0; i < merged.size(); i++) | |
910 { | |
911 const std::vector<BoostPoint>& outer = merged[i].outer(); | |
912 | |
913 chains[i].resize(outer.size()); | |
914 for (size_t j = 0; j < outer.size(); j++) | |
915 { | |
916 chains[i][j] = ScenePoint2D(outer[j].x(), outer[j].y()); | |
917 } | |
918 } | |
904 #else | 919 #else |
905 // this will contain the intersection of the polygon slab with | 920 // this will contain the intersection of the polygon slab with |
906 // the cutting plane, projected on the cutting plane coord system | 921 // the cutting plane, projected on the cutting plane coord system |
907 // (that yields a rectangle) + the Z coordinate of the polygon | 922 // (that yields a rectangle) + the Z coordinate of the polygon |
908 // (this is required to group polygons with the same Z later) | 923 // (this is required to group polygons with the same Z later) |
924 static_cast<float>(y1), | 939 static_cast<float>(y1), |
925 static_cast<float>(x2), | 940 static_cast<float>(x2), |
926 static_cast<float>(y2)),curZ)); | 941 static_cast<float>(y2)),curZ)); |
927 } | 942 } |
928 } | 943 } |
929 #endif | 944 |
930 | |
931 #if USE_BOOST_UNION_FOR_POLYGONS != 1 | |
932 // projected contains a set of rectangles specified by two opposite | 945 // projected contains a set of rectangles specified by two opposite |
933 // corners (x1,y1,x2,y2) | 946 // corners (x1,y1,x2,y2) |
934 // we need to merge them | 947 // we need to merge them |
935 // each slab yields ONE polygon! | 948 // each slab yields ONE polygon! |
936 | 949 |
984 { | 997 { |
985 chains[i].resize(2); | 998 chains[i].resize(2); |
986 chains[i][0] = segments[i].first; | 999 chains[i][0] = segments[i].first; |
987 chains[i][1] = segments[i].second; | 1000 chains[i][1] = segments[i].second; |
988 } | 1001 } |
989 | |
990 #else | |
991 BoostMultiPolygon merged; | |
992 Union(merged, projected); | |
993 | |
994 chains.resize(merged.size()); | |
995 for (size_t i = 0; i < merged.size(); i++) | |
996 { | |
997 const std::vector<BoostPoint>& outer = merged[i].outer(); | |
998 | |
999 chains[i].resize(outer.size()); | |
1000 for (size_t j = 0; j < outer.size(); j++) | |
1001 { | |
1002 chains[i][j] = ScenePoint2D(outer[j].x(), outer[j].y()); | |
1003 } | |
1004 } | |
1005 #endif | 1002 #endif |
1006 | 1003 |
1007 return true; | 1004 return true; |
1008 } | 1005 } |
1009 else | 1006 else |