コード例 #1
0
ファイル: GeoRect.cs プロジェクト: gr001/PeaksProcessing2
 public static GeoRect Intersect(GeoRect rect1, GeoRect rect2)
 {
     if (IntersectionExist(rect1, rect2))
     {
         double x      = Math.Max(rect1.Left, rect2.Left);
         double y      = Math.Max(rect1.Bottom, rect2.Bottom);
         double width  = Math.Max((double)(Math.Min(rect1.Right, rect2.Right) - x), (double)0.0);
         double height = Math.Max((double)(Math.Min(rect1.Top, rect2.Top) - y), (double)0.0);
         return(new GeoRect(x, y, width, height));
     }
     else
     {
         return(null);
     }
 }
コード例 #2
0
ファイル: GeoRect.cs プロジェクト: XiBeichuan/hydronumerics
 public static GeoRect Intersect(GeoRect rect1, GeoRect rect2)
 {
     if (IntersectionExist(rect1, rect2))
     {
         double x = Math.Max(rect1.Left, rect2.Left);
         double y = Math.Max(rect1.Bottom, rect2.Bottom);
         double width = Math.Max((double)(Math.Min(rect1.Right, rect2.Right) - x), (double)0.0);
         double height = Math.Max((double)(Math.Min(rect1.Top, rect2.Top) - y), (double)0.0);
         return new GeoRect(x, y, width, height);
     }
     else
     {
         return null;
     }
 }
コード例 #3
0
ファイル: GeoRect.cs プロジェクト: gr001/PeaksProcessing2
 public static bool IntersectionExist(GeoRect rect1, GeoRect rect2)
 {
     return(rect1.Left <= rect2.Right && rect1.Top >= rect2.Bottom && rect1.Bottom <= rect2.Top && rect1.Right >= rect2.Left);
 }
コード例 #4
0
ファイル: GeoRect.cs プロジェクト: XiBeichuan/hydronumerics
 public static bool IntersectionExist(GeoRect rect1, GeoRect rect2)
 {
     return (rect1.Left <= rect2.Right && rect1.Top >= rect2.Bottom && rect1.Bottom <= rect2.Top && rect1.Right >= rect2.Left);
 }