Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/LineHelper.cs
===================================================================
diff -u -r4185 -r4248
--- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/LineHelper.cs (.../LineHelper.cs) (revision 4185)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/LineHelper.cs (.../LineHelper.cs) (revision 4248)
@@ -28,24 +28,27 @@
///
/// Helper class for Line objects
///
-public static class LineHelper
+public class LineHelper
{
+
+ private readonly Routines2D routines2D = new Routines2D();
+
///
/// Calculate intersection between two lines (strict interpolation)
///
///
///
///
///
- public static bool GetStrictIntersectionPoint(Line line1, Line line2, ref GeometryPoint intersectPoint)
+ public bool GetStrictIntersectionPoint(Line line1, Line line2, ref GeometryPoint intersectPoint)
{
var point1 = new Point2D(line1.BeginPoint.X, line1.BeginPoint.Z);
var point2 = new Point2D(line1.EndPoint.X, line1.EndPoint.Z);
var point3 = new Point2D(line2.BeginPoint.X, line2.BeginPoint.Z);
var point4 = new Point2D(line2.EndPoint.X, line2.EndPoint.Z);
Point2D ip;
- LineIntersection res = Routines2D.DetermineIf2DLinesIntersectStrickly(point1, point2, point3,
+ LineIntersection res = routines2D.DetermineIf2DLinesIntersectStrickly(point1, point2, point3,
point4, out ip);
if (ip != null)
{
@@ -66,7 +69,7 @@
/// Circle's radius
/// Point collection which defines a line. Extrapolation is performed at the start and end points.
/// Intersections of this line extrapolated to the negative and positive X with the circle.
- public static List ExtendedSurfaceIntersectionPointsWithCircle(double xMid, double zMid, double radius, IList pointss)
+ public List ExtendedSurfaceIntersectionPointsWithCircle(double xMid, double zMid, double radius, IList pointss)
{
List points = pointss.Where(p => !double.IsNaN(p.X)).ToList();
if (points.Count >= 2)
@@ -103,7 +106,7 @@
/// The radius.
/// The points.
///
- public static List IntersectionPointsWithCircle(double xMid, double zMid, double radius, IList points)
+ public List IntersectionPointsWithCircle(double xMid, double zMid, double radius, IList points)
{
var result = new List();
if (points.Count >= 2)
@@ -131,7 +134,7 @@
return result;
}
- public static GeometryPoint GetIntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4)
+ public GeometryPoint GetIntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4)
{
return IntersectionPointWithExtrapolation(p1, p2, p3, p4);
}
@@ -144,9 +147,9 @@
/// The r.
/// The line.
///
- private static List Intersect_Circle_line(double xm, double ym, double r, Line line)
+ private List Intersect_Circle_line(double xm, double ym, double r, Line line)
{
- return Routines2D.IntersectCircleline(xm, ym, r, line.BeginPoint.X, line.EndPoint.X, line.BeginPoint.Z, line.EndPoint.Z);
+ return routines2D.IntersectCircleline(xm, ym, r, line.BeginPoint.X, line.EndPoint.X, line.BeginPoint.Z, line.EndPoint.Z);
}
///
@@ -157,7 +160,7 @@
///
///
/// Intersection point or null (parallel lines)
- private static GeometryPoint IntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4)
+ private GeometryPoint IntersectionPointWithExtrapolation(GeometryPoint p1, GeometryPoint p2, GeometryPoint p3, GeometryPoint p4)
{
GeometryPoint intersectPoint = null;
@@ -166,7 +169,7 @@
var point3 = new Point2D(p3.X, p3.Z);
var point4 = new Point2D(p4.X, p4.Z);
- Routines2D.DetermineIf2DLinesIntersectWithExtrapolation(point1, point2, point3, point4, out Point2D ip);
+ routines2D.DetermineIf2DLinesIntersectWithExtrapolation(point1, point2, point3, point4, out Point2D ip);
if (ip != null)
{
intersectPoint = new GeometryPoint(ip.X, ip.Z);