Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Routines2D.cs =================================================================== diff -u -r4184 -r4185 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Routines2D.cs (.../Routines2D.cs) (revision 4184) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Routines2D.cs (.../Routines2D.cs) (revision 4185) @@ -82,7 +82,7 @@ /// /// Static class Routines2D /// -public class Routines2D +public static class Routines2D { private const double CEpsilon = 1.0e-4; @@ -101,7 +101,7 @@ /// /// For connected parallel lines, the connection point will be returned as valid intersection point. /// - public LineIntersection DetermineIf2DLinesIntersectStrickly(Point2D point1, Point2D point2, Point2D point3, + public static LineIntersection DetermineIf2DLinesIntersectStrickly(Point2D point1, Point2D point2, Point2D point3, Point2D point4, out Point2D intersectionPoint) { return DetermineIf2DLinesIntersectStrickly(point1, point2, point3, point4, @@ -116,7 +116,7 @@ /// The point. /// The tolerance. /// - public bool DoesPointExistInLine(Point2D linePoint1, Point2D linePoint2, Point2D point, double tolerance) + public static bool DoesPointExistInLine(Point2D linePoint1, Point2D linePoint2, Point2D point, double tolerance) { // Function to find if lies on or close to a line (within a given tolerance) // Input - a line defined by lTwo points, a third point to test and tolerance aValue @@ -168,7 +168,7 @@ /// /// /// - public Clockwise IsClockWise(IEnumerable aPolygon) + public static Clockwise IsClockWise(IEnumerable aPolygon) { Point2D[] distinctPoints = aPolygon.Distinct().ToArray(); if (distinctPoints.Length < 3) @@ -227,7 +227,7 @@ /// The x. /// The z. /// - public PointInPolygon CheckIfPointIsInPolygon(GeometryLoop polygon, double x, double z) + public static PointInPolygon CheckIfPointIsInPolygon(GeometryLoop polygon, double x, double z) { // This is done by calculating and adding the angles from the point to all points // of the polygon (using the ArcTan2 function). If the sum of these angles is @@ -331,7 +331,7 @@ /// /// /// - public List IntersectCircleline(double aX, double aY, double aR, double aX1, double aX2, double aY1, double aY2) + public static List IntersectCircleline(double aX, double aY, double aR, double aX1, double aX2, double aY1, double aY2) { // Solve by filling in parametric equation of line : // X = x1 + u*(x2 - x1) @@ -413,7 +413,7 @@ /// /// /// - public double FindAngle(Point2D line1Point1, Point2D line1Point2, Point2D line2Point1, + public static double FindAngle(Point2D line1Point1, Point2D line1Point2, Point2D line2Point1, Point2D line2Point2) { double x1 = line1Point2.X - line1Point1.X; @@ -442,7 +442,7 @@ /// /// /// - public bool AreEqual(double x1, double x2, double tolerance) + public static bool AreEqual(double x1, double x2, double tolerance) { return (Math.Abs(x1 - x2) < tolerance); } @@ -456,7 +456,7 @@ /// a point4. /// a intersection point. /// - public LineIntersection DetermineIf2DLinesIntersectWithExtrapolation(Point2D aPoint1, Point2D aPoint2, Point2D aPoint3, Point2D aPoint4, out Point2D aIntersectionPoint) + public static LineIntersection DetermineIf2DLinesIntersectWithExtrapolation(Point2D aPoint1, Point2D aPoint2, Point2D aPoint3, Point2D aPoint4, out Point2D aIntersectionPoint) { LineConstant lLineConstant1 = CalculateNormalLineConstants(aPoint1, aPoint2); LineConstant lLineConstant2 = CalculateNormalLineConstants(aPoint3, aPoint4); @@ -475,7 +475,7 @@ /// /// /// - public LineIntersection DetermineIf2DLinesIntersectWithExtrapolation(LineConstant aLine1Constant, LineConstant aLine2Constant, out Point2D aIntersectionPoint) + public static LineIntersection DetermineIf2DLinesIntersectWithExtrapolation(LineConstant aLine1Constant, LineConstant aLine2Constant, out Point2D aIntersectionPoint) { aIntersectionPoint = new Point2D(0.0, 0.0); @@ -510,7 +510,7 @@ /// The point2 z. /// The tolerance. /// - public bool DetermineIfPointsCoincide(double point1X, double point1Z, double point2X, double point2Z, double tolerance) + public static bool DetermineIfPointsCoincide(double point1X, double point1Z, double point2X, double point2Z, double tolerance) { if ((Math.Abs(point1X - point2X)) < tolerance && Math.Abs(point1Z - point2Z) < tolerance) { @@ -520,7 +520,7 @@ return false; } - private void UndoAddIfNeeded(GeometryLoop polygon, bool needed) + private static void UndoAddIfNeeded(GeometryLoop polygon, bool needed) { if (needed) { @@ -536,7 +536,7 @@ /// X-coordinate of the second point /// Y-coordinate of the second point /// - private double CrossProduct(double pointAx, double pointAy, double pointBx, double pointBy) + private static double CrossProduct(double pointAx, double pointAy, double pointBx, double pointBy) { return pointAx * pointBy - pointBx * pointAy; } @@ -547,7 +547,7 @@ /// The point1. /// The point2. /// - private LineConstant CalculateNormalLineConstants(Point2D point1, Point2D point2) + private static LineConstant CalculateNormalLineConstants(Point2D point1, Point2D point2) { double point1X = point1.X; double point1Z = point1.Z; @@ -573,7 +573,7 @@ /// a line2 constant y. /// The tolerance. /// - private bool AreLinesParallel(double aLine1ConstantX, double aLine1ConstantY, double aLine2ConstantX, double aLine2ConstantY, double tolerance) + private static bool AreLinesParallel(double aLine1ConstantX, double aLine1ConstantY, double aLine2ConstantX, double aLine2ConstantY, double tolerance) { return Math.Abs(CrossProduct(aLine1ConstantX, aLine2ConstantX, aLine1ConstantY, aLine2ConstantY)) < tolerance; } @@ -586,7 +586,7 @@ /// X-coordinate of the second point /// Y-coordinate of the second point /// The distance between the given points. - private double Compute2DDistance(double aX1, double aY1, double aX2, double aY2) + private static double Compute2DDistance(double aX1, double aY1, double aX2, double aY2) { double lX = aX1 - aX2; double lY = aY1 - aY2; @@ -610,7 +610,7 @@ /// /// For connected parallel lines, the connection point will be returned as valid intersection point. /// - private LineIntersection DetermineIf2DLinesIntersectStrickly(Point2D point1, Point2D point2, Point2D point3, + private static LineIntersection DetermineIf2DLinesIntersectStrickly(Point2D point1, Point2D point2, Point2D point3, Point2D point4, out Point2D intersectionPoint, double tolerance) { double point1X = point1.X; @@ -674,7 +674,7 @@ /// The point4 z. /// The tolerance. /// - private bool DoLinesAtLeastPartialyOverlap(double point1X, double point1Z, double point2X, double point2Z, + private static bool DoLinesAtLeastPartialyOverlap(double point1X, double point1Z, double point2X, double point2Z, double point3X, double point3Z, double point4X, double point4Z, double tolerance) { bool result = AreLinesParallel(point1X, point1Z, point2X, point2Z, point3X, point3Z, point4X, point4Z, tolerance); @@ -730,7 +730,7 @@ /// /// True when parallel /// - private bool AreLinesParallel(double point1X, double point1Z, double point2X, double point2Z, + private static bool AreLinesParallel(double point1X, double point1Z, double point2X, double point2Z, double point3X, double point3Z, double point4X, double point4Z, double tolerance) { double aX = point2X - point1X; @@ -747,7 +747,7 @@ /// /// Normalizes this instance. /// - private void Normalize(ref double pointX, ref double pointY) + private static void Normalize(ref double pointX, ref double pointY) { double q = Math.Sqrt(pointX * pointX + pointY * pointY);