@@ -25,12 +25,15 @@ namespace Clipper2Lib
2525 public static class Clipper
2626 {
2727
28- public static Rect64 MaxInvalidRect64 = new Rect64 (
28+ private static Rect64 maxInvalidRect64 = new Rect64 (
2929 long . MaxValue , long . MaxValue , long . MinValue , long . MinValue ) ;
3030
31- public static RectD MaxInvalidRectD = new RectD (
31+ private static RectD maxInvalidRectD = new RectD (
3232 double . MaxValue , - double . MaxValue , - double . MaxValue , - double . MaxValue ) ;
3333
34+ public static Rect64 MaxInvalidRect64 => maxInvalidRect64 ;
35+ public static RectD MaxInvalidRectD => maxInvalidRectD ;
36+
3437 public static Paths64 Intersect ( Paths64 subject , Paths64 clip , FillRule fillRule )
3538 {
3639 return BooleanOp ( ClipType . Intersection , subject , clip , fillRule ) ;
@@ -206,28 +209,28 @@ public static string Path64ToString(Path64 path)
206209 {
207210 string result = "" ;
208211 foreach ( Point64 pt in path )
209- result = result + pt . ToString ( ) ;
212+ result += pt . ToString ( ) ;
210213 return result + '\n ' ;
211214 }
212215 public static string Paths64ToString ( Paths64 paths )
213216 {
214217 string result = "" ;
215218 foreach ( Path64 path in paths )
216- result = result + Path64ToString ( path ) ;
219+ result += Path64ToString ( path ) ;
217220 return result ;
218221 }
219222 public static string PathDToString ( PathD path )
220223 {
221224 string result = "" ;
222225 foreach ( PointD pt in path )
223- result = result + pt . ToString ( ) ;
226+ result += pt . ToString ( ) ;
224227 return result + '\n ' ;
225228 }
226229 public static string PathsDToString ( PathsD paths )
227230 {
228231 string result = "" ;
229232 foreach ( PathD path in paths )
230- result = result + PathDToString ( path ) ;
233+ result += PathDToString ( path ) ;
231234 return result ;
232235 }
233236 public static Path64 OffsetPath ( Path64 path , long dx , long dy )
@@ -575,7 +578,7 @@ public static void AddPolyNodeToPathsD(PolyPathD polyPath, PathsD paths)
575578 public static PathsD PolyTreeToPathsD ( PolyTreeD polyTree )
576579 {
577580 PathsD result = new PathsD ( ) ;
578- foreach ( var polyPathBase in polyTree )
581+ foreach ( PolyPathBase polyPathBase in polyTree )
579582 {
580583 PolyPathD p = ( PolyPathD ) polyPathBase ;
581584 AddPolyNodeToPathsD ( p , result ) ;
@@ -720,7 +723,7 @@ public static Path64 TrimCollinear(Path64 path, bool isOpen = false)
720723 else
721724 {
722725 while ( result . Count > 2 && InternalClipper . CrossProduct (
723- result [ result . Count - 1 ] , result [ result . Count - 2 ] , result [ 0 ] ) == 0 )
726+ result [ ^ 1 ] , result [ ^ 2 ] , result [ 0 ] ) == 0 )
724727 result . RemoveAt ( result . Count - 1 ) ;
725728 if ( result . Count < 3 )
726729 result . Clear ( ) ;
@@ -754,8 +757,7 @@ public static Path64 Ellipse(Point64 center,
754757 double si = Math . Sin ( 2 * Math . PI / steps ) ;
755758 double co = Math . Cos ( 2 * Math . PI / steps ) ;
756759 double dx = co , dy = si ;
757- Path64 result = new Path64 ( steps ) ;
758- result . Add ( new Point64 ( center . X + radiusX , center . Y ) ) ;
760+ Path64 result = new Path64 ( steps ) { new Point64 ( center . X + radiusX , center . Y ) } ;
759761 for ( int i = 1 ; i < steps ; ++ i )
760762 {
761763 result . Add ( new Point64 ( center . X + radiusX * dx , center . Y + radiusY * dy ) ) ;
@@ -777,8 +779,7 @@ public static PathD Ellipse(PointD center,
777779 double si = Math . Sin ( 2 * Math . PI / steps ) ;
778780 double co = Math . Cos ( 2 * Math . PI / steps ) ;
779781 double dx = co , dy = si ;
780- PathD result = new PathD ( steps ) ;
781- result . Add ( new PointD ( center . x + radiusX , center . y ) ) ;
782+ PathD result = new PathD ( steps ) { new PointD ( center . x + radiusX , center . y ) } ;
782783 for ( int i = 1 ; i < steps ; ++ i )
783784 {
784785 result . Add ( new PointD ( center . x + radiusX * dx , center . y + radiusY * dy ) ) ;
0 commit comments