Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryGenerator.cs =================================================================== diff -u -r5218 -r5219 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryGenerator.cs (.../GeometryGenerator.cs) (revision 5218) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryGenerator.cs (.../GeometryGenerator.cs) (revision 5219) @@ -1039,169 +1039,419 @@ geometryData.NewlyEffectedPoints.Clear(); } - private bool RegenerateParallelCurves(GeometryCurve line1, GeometryCurve line2, ref bool isCurveInserted) - { - Point2D headPoint1 = line1.HeadPoint; - Point2D endPoint1 = line1.EndPoint; - Point2D headPoint2 = line2.HeadPoint; - Point2D endPoint2 = line2.EndPoint; - bool flag1 = Routines2D.DoesPointExistInLine(headPoint1, endPoint1, headPoint2, 0.001); - bool flag2 = Routines2D.DoesPointExistInLine(headPoint1, endPoint1, endPoint2, 0.001); - bool flag3 = Routines2D.DoesPointExistInLine(headPoint2, endPoint2, headPoint1, 0.001); - bool flag4 = Routines2D.DoesPointExistInLine(headPoint2, endPoint2, endPoint1, 0.001); - double slope1 = !headPoint1.Z.IsNearEqual(endPoint1.Z) ? (headPoint1.X - endPoint1.X) / (headPoint1.Z - endPoint1.Z) : double.MaxValue; - double slope2 = !headPoint2.Z.IsNearEqual(endPoint2.Z) ? (headPoint2.X - endPoint2.X) / (headPoint2.Z - endPoint2.Z) : double.MaxValue; - if (Math.Abs(Math.Abs(slope1) - Math.Abs(slope2)) > 5E-12) + /// + /// Regenerates all the Parellel curves. + /// + /// + /// + /// + /// + private bool RegenerateParallelCurves(GeometryCurve line1, GeometryCurve line2, ref bool isCurveInserted) { - // The lines are not parallel - if (flag1 && flag2) + const double accuracyAngle = 5E-12; + // check if the lines are parallel and on + // |----o------|----o or o----|------o----| or + // |----o------o----| or o----|------|----o + // |o----o----------| or |----------o----o| + Point2D localPoint1 = line1.HeadPoint; + Point2D localPoint2 = line1.EndPoint; + Point2D localPoint3 = line2.HeadPoint; + Point2D localPoint4 = line2.EndPoint; + + bool isPoint3OnLine1 = Routines2D.DoesPointExistInLine(localPoint1, localPoint2, localPoint3, GeometryConstants.Accuracy); + bool isPoint4OnLine1 = Routines2D.DoesPointExistInLine(localPoint1, localPoint2, localPoint4, GeometryConstants.Accuracy); + bool isPoint1OnLine2 = Routines2D.DoesPointExistInLine(localPoint3, localPoint4, localPoint1, GeometryConstants.Accuracy); + bool isPoint2OnLine2 = Routines2D.DoesPointExistInLine(localPoint3, localPoint4, localPoint2, GeometryConstants.Accuracy); + + double slope1; + double slope2; + + if (localPoint1.Z.IsNearEqual(localPoint2.Z)) { - // When both headPoint2 and endPoint2 are (almost) on line1, then flag point that is closest to line1 - // When the distance is the same, flag endPoint2 - DetermineFlagValuesWithDistanceToLine(headPoint2, endPoint2, headPoint1, endPoint1, ref flag1, ref flag2); + slope1 = double.MaxValue; } - if (flag3 && flag4) + else { - // When both headPoint1 and endPoint1 are (almost) on line2, then flag point that is closest to line2 - // When the distance is the same, flag endPoint1 - DetermineFlagValuesWithDistanceToLine(headPoint1, endPoint1, headPoint2, endPoint2, ref flag3, ref flag4); + slope1 = (localPoint1.X - localPoint2.X)/(localPoint1.Z - localPoint2.Z); } - } - bool flag5 = Routines2D.DetermineIfPointsCoincide(headPoint1.X, headPoint1.Z, headPoint2.X, headPoint2.Z, 0.001); - bool flag6 = Routines2D.DetermineIfPointsCoincide(headPoint1.X, headPoint1.Z, endPoint2.X, endPoint2.Z, 0.001); - bool flag7 = Routines2D.DetermineIfPointsCoincide(endPoint1.X, endPoint1.Z, headPoint2.X, headPoint2.Z, 0.001); - bool flag8 = Routines2D.DetermineIfPointsCoincide(endPoint1.X, endPoint1.Z, endPoint2.X, endPoint2.Z, 0.001); - if (Math.Abs(Math.Abs(slope1) - Math.Abs(slope2)) > 5E-12) - { - // The lines are not parallel - if (flag5 && flag7) + if (localPoint3.Z.IsNearEqual(localPoint4.Z)) { - // When both headPoint1 and endPoint1 (almost) coincide with headPoint2, then flag point that is closest to headPoint2 - // When the distance is the same, flag endPoint1 - DetermineFlagValuesWithDistanceBetweenPoints(headPoint1, endPoint1, headPoint2, ref flag5, ref flag7); + slope2 = double.MaxValue; } - if (flag6 && flag8) + else { - // When both headPoint1 and endPoint1 (almost) coincide with endPoint2, then flag point that is closest to endPoint2 - // When the distance is the same, flag endPoint1 - DetermineFlagValuesWithDistanceBetweenPoints(headPoint1, endPoint1, endPoint2, ref flag6, ref flag8); + slope2 = (localPoint3.X - localPoint4.X)/(localPoint3.Z - localPoint4.Z); } - } - //if (flag3 && flag4 || flag1 && flag2 || flag1 | flag2 && flag3 || flag4) - //ToDo bka: Check if the above condition is correct, was | operator intended instead of || operator? - //Next line is the same as above line, but with || operator instead of | operator - if (flag3 && flag4 || flag1 && flag2 || ((flag1 || flag2) && flag3) || flag4) - //The solo flag4 at the end is strange, because at the start there is flag3 && flag4, you could leave that out: - //if (flag1 && flag2 || ((flag1 || flag2) && flag3) || flag4) - //Probably something else was meant, but that could give a different result, e.g. - //if (flag3 && flag4 || flag1 && flag2 || (flag1 || flag2) && (flag3 || flag4)) - { - if (flag1 && !flag2 && !flag5 && !flag7) + if (Math.Abs(Math.Abs(slope1) - Math.Abs(slope2)) > accuracyAngle) { - GeometryCurve geometryCurve = this.SplitCurve(line1, line2.HeadPoint); - line2.HeadPoint = flag4 ? geometryCurve.EndPoint : line1.HeadPoint; - CheckAndAddToIntersectedCurveList(line2); - isCurveInserted = true; - return true; - } + if (isPoint1OnLine2 && isPoint2OnLine2) + { + double distance1 = Routines2D.CalculateDistanceToLine(localPoint1.X, localPoint1.Z, localPoint3.X, localPoint3.Z, localPoint4.X, localPoint4.Z); + double distance2 = Routines2D.CalculateDistanceToLine(localPoint2.X, localPoint2.Z, localPoint3.X, localPoint3.Z, localPoint4.X, localPoint4.Z); + if (distance1 > distance2) + { + isPoint1OnLine2 = false; + } + else + { + isPoint2OnLine2 = false; + } + } - if (flag2 && !flag1 && !flag6 && !flag8) - { - GeometryCurve geometryCurve = this.SplitCurve(line1, line2.EndPoint); - line2.EndPoint = flag4 ? geometryCurve.EndPoint : line1.HeadPoint; - CheckAndAddToIntersectedCurveList(line2); - isCurveInserted = true; - return true; + if (isPoint3OnLine1 && isPoint4OnLine1) + { + double distance1 = Routines2D.CalculateDistanceToLine(localPoint3.X, localPoint3.Z, localPoint1.X, localPoint1.Z, localPoint2.X, localPoint2.Z); + double distance2 = Routines2D.CalculateDistanceToLine(localPoint4.X, localPoint4.Z, localPoint1.X, localPoint1.Z, localPoint2.X, localPoint2.Z); + if (distance1 > distance2) + { + isPoint3OnLine1 = false; + } + else + { + isPoint4OnLine1 = false; + } + } } - if (flag1 && flag2 && !flag5 && !flag8 && !flag7 && !flag6) + bool isPoint1SameAsPoint3 = Routines2D.DetermineIfPointsCoincide(localPoint1.X, localPoint1.Z, localPoint3.X, localPoint3.Z,GeometryConstants.Accuracy); + bool isPoint1SameAsPoint4 = Routines2D.DetermineIfPointsCoincide(localPoint1.X, localPoint1.Z, localPoint4.X, localPoint4.Z, GeometryConstants.Accuracy); + bool isPoint2SameAsPoint3 = Routines2D.DetermineIfPointsCoincide(localPoint2.X, localPoint2.Z, localPoint3.X, localPoint3.Z, GeometryConstants.Accuracy); + bool isPoint2SameAsPoint4 = Routines2D.DetermineIfPointsCoincide(localPoint2.X, localPoint2.Z, localPoint4.X, localPoint4.Z, GeometryConstants.Accuracy); + + if (Math.Abs(Math.Abs(slope1) - Math.Abs(slope2)) > accuracyAngle) { - if (Routines2D.Compute2DDistance(headPoint1.X, headPoint1.Z, headPoint2.X, headPoint2.Z) < - Routines2D.Compute2DDistance(headPoint1.X, headPoint1.Z, endPoint2.X, endPoint2.Z)) - SplitCurve(line1, line2.HeadPoint).HeadPoint = line2.EndPoint; - else - SplitCurve(line1, line2.EndPoint).HeadPoint = line2.HeadPoint; - CheckAndAddToIntersectedCurveList(line2); - isCurveInserted = true; - return true; + if (isPoint1SameAsPoint3 && isPoint2SameAsPoint3) + { + double distance1 = Routines2D.Compute2DDistance(localPoint1.X, localPoint1.Z, localPoint3.X, localPoint3.Z); + double distance2 = Routines2D.Compute2DDistance(localPoint2.X, localPoint2.Z, localPoint3.X, localPoint3.Z); + if (distance1 > distance2) + { + isPoint1SameAsPoint3 = false; + } + else + { + isPoint2SameAsPoint3 = false; + } + } + + if (isPoint1SameAsPoint4 && isPoint2SameAsPoint4) + { + double distance1 = Routines2D.Compute2DDistance(localPoint1.X, localPoint1.Z, localPoint4.X, localPoint4.Z); + double distance2 = Routines2D.Compute2DDistance(localPoint2.X, localPoint2.Z, localPoint4.X, localPoint4.Z); + if (distance1 > distance2) + { + isPoint1SameAsPoint4 = false; + } + else + { + isPoint2SameAsPoint4 = false; + } + } } - if (flag3 && flag4 && !flag5 && !flag8 && !flag7 && !flag6) + //check for parallel + if ((isPoint1OnLine2 && isPoint2OnLine2) || (isPoint3OnLine1 && isPoint4OnLine1) + || ((isPoint3OnLine1 || isPoint4OnLine1) && (isPoint1OnLine2 || isPoint2OnLine2))) { - if (Routines2D.Compute2DDistance(headPoint2.X, headPoint2.Z, headPoint1.X, headPoint1.Z) < - Routines2D.Compute2DDistance(headPoint2.X, headPoint2.Z, endPoint1.X, endPoint1.Z)) - SplitCurve(line2, line1.HeadPoint).HeadPoint = line1.EndPoint; - else - SplitCurve(line2, line1.EndPoint).HeadPoint = line1.HeadPoint; - CheckAndAddToIntersectedCurveList(line1); - isCurveInserted = true; - return true; + // p1----p3------p2----p4 + GeometryCurve newLine; + if (isPoint3OnLine1 && !isPoint4OnLine1 && !isPoint1SameAsPoint3 && !isPoint2SameAsPoint3) + { + newLine = SplitCurve(line1, line2.HeadPoint); + + line2.HeadPoint = isPoint2OnLine2 ? newLine.EndPoint : line1.HeadPoint; + CheckAndAddToIntersectedCurveList(line2); + + isCurveInserted = true; + return true; + } + + // p1----p4------p2----p3 + if (isPoint4OnLine1 && !isPoint3OnLine1 && !isPoint1SameAsPoint4 && !isPoint2SameAsPoint4) + { + newLine = SplitCurve(line1, line2.EndPoint); + line2.EndPoint = isPoint2OnLine2 ? newLine.EndPoint : line1.HeadPoint; + CheckAndAddToIntersectedCurveList(line2); + + isCurveInserted = true; + return true; + } + + // p1----p3------p4----p2 + if (isPoint3OnLine1 && isPoint4OnLine1 && !isPoint1SameAsPoint3 && !isPoint2SameAsPoint4 && + !isPoint2SameAsPoint3 && !isPoint1SameAsPoint4) + { + double distance1 = Routines2D.Compute2DDistance(localPoint1.X, localPoint1.Z, localPoint3.X, localPoint3.Z); + double distance2 = Routines2D.Compute2DDistance(localPoint1.X, localPoint1.Z, localPoint4.X, localPoint4.Z); + + if (distance1 < distance2) + { + newLine = SplitCurve(line1, line2.HeadPoint); + newLine.HeadPoint = line2.EndPoint; + } + else + { + newLine = SplitCurve(line1, line2.EndPoint); + newLine.HeadPoint = line2.HeadPoint; + } + CheckAndAddToIntersectedCurveList(line2); + + isCurveInserted = true; + return true; + } + + // p3----p1------p2----p4 + if (isPoint1OnLine2 && isPoint2OnLine2 && !isPoint1SameAsPoint3 && !isPoint2SameAsPoint4 && + !isPoint2SameAsPoint3 && !isPoint1SameAsPoint4) + { + double distance1 = Routines2D.Compute2DDistance(localPoint3.X, localPoint3.Z, localPoint1.X, localPoint1.Z); + double distance2 = Routines2D.Compute2DDistance(localPoint3.X, localPoint3.Z, localPoint2.X, localPoint2.Z); + + if (distance1 < distance2) + { + newLine = SplitCurve(line2, line1.HeadPoint); + newLine.HeadPoint = line1.EndPoint; + } + else + { + newLine = SplitCurve(line2, line1.EndPoint); + newLine.HeadPoint = line1.HeadPoint; + } + CheckAndAddToIntersectedCurveList(line1); + + isCurveInserted = true; + return true; + } + + // vertices coincidence cases - Line2 on Line1 + if ((isPoint4OnLine1 && isPoint3OnLine1) && + (!((isPoint2SameAsPoint3 && isPoint1SameAsPoint4) || (isPoint2SameAsPoint4 && isPoint1SameAsPoint3)))) + { + if (isPoint1SameAsPoint3) + { + line1.HeadPoint = line2.EndPoint; + } + else if (isPoint2SameAsPoint3) + { + line1.EndPoint = line2.EndPoint; + } + else if (isPoint2SameAsPoint4) + { + line1.EndPoint = line2.HeadPoint; + } + else + { + line1.HeadPoint = line2.HeadPoint; + } + CheckAndAddToIntersectedCurveList(line1); + CheckAndAddToIntersectedCurveList(line2); + + return true; + } + + // Line1 on Line2 + if ((isPoint1OnLine2 && isPoint2OnLine2) && + (!((isPoint2SameAsPoint3 && isPoint1SameAsPoint4) || (isPoint2SameAsPoint4 && isPoint1SameAsPoint3)))) + { + if (isPoint1SameAsPoint3) + { + line2.HeadPoint = line1.EndPoint; + } + else if (isPoint1SameAsPoint4) + { + line2.EndPoint = line1.EndPoint; + } + else if (isPoint2SameAsPoint4) + { + line2.EndPoint = line1.HeadPoint; + } + else + { + line2.HeadPoint = line1.HeadPoint; + } + CheckAndAddToIntersectedCurveList(line1); + CheckAndAddToIntersectedCurveList(line2); + return true; + } } - if (flag2 && flag1 && !(flag7 && flag6) && !(flag8 && flag5)) + // Line1 and Line2 are same + if ((isPoint1SameAsPoint3 && isPoint2SameAsPoint4) || (isPoint1SameAsPoint4 && isPoint2SameAsPoint3)) { - if (flag5) - line1.HeadPoint = line2.EndPoint; - else if (flag7) - line1.EndPoint = line2.EndPoint; - else if (flag8) - line1.EndPoint = line2.HeadPoint; - else - line1.HeadPoint = line2.HeadPoint; CheckAndAddToIntersectedCurveList(line1); CheckAndAddToIntersectedCurveList(line2); return true; } - - if (flag3 & flag4 && !(flag7 & flag6) && !(flag8 & flag5)) - { - if (flag5) - line2.HeadPoint = line1.EndPoint; - else if (flag6) - line2.EndPoint = line1.EndPoint; - else if (flag8) - line2.EndPoint = line1.HeadPoint; - else - line2.HeadPoint = line1.HeadPoint; - this.CheckAndAddToIntersectedCurveList(line1); - this.CheckAndAddToIntersectedCurveList(line2); - return true; - } + return false; } + + + + // private bool RegenerateParallelCurves(GeometryCurve line1, GeometryCurve line2, ref bool isCurveInserted) + // { + // Point2D headPoint1 = line1.HeadPoint; + // Point2D endPoint1 = line1.EndPoint; + // Point2D headPoint2 = line2.HeadPoint; + // Point2D endPoint2 = line2.EndPoint; + // bool flag1 = Routines2D.DoesPointExistInLine(headPoint1, endPoint1, headPoint2, 0.001); + // bool flag2 = Routines2D.DoesPointExistInLine(headPoint1, endPoint1, endPoint2, 0.001); + // bool flag3 = Routines2D.DoesPointExistInLine(headPoint2, endPoint2, headPoint1, 0.001); + // bool flag4 = Routines2D.DoesPointExistInLine(headPoint2, endPoint2, endPoint1, 0.001); + // double slope1 = !headPoint1.Z.IsNearEqual(endPoint1.Z) ? (headPoint1.X - endPoint1.X) / (headPoint1.Z - endPoint1.Z) : double.MaxValue; + // double slope2 = !headPoint2.Z.IsNearEqual(endPoint2.Z) ? (headPoint2.X - endPoint2.X) / (headPoint2.Z - endPoint2.Z) : double.MaxValue; + // if (Math.Abs(Math.Abs(slope1) - Math.Abs(slope2)) > 5E-12) + // { + // // The lines are not parallel + // if (flag1 && flag2) + // { + // // When both headPoint2 and endPoint2 are (almost) on line1, then flag point that is closest to line1 + // // When the distance is the same, flag endPoint2 + // DetermineFlagValuesWithDistanceToLine(headPoint2, endPoint2, headPoint1, endPoint1, ref flag1, ref flag2); + // } + // if (flag3 && flag4) + // { + // // When both headPoint1 and endPoint1 are (almost) on line2, then flag point that is closest to line2 + // // When the distance is the same, flag endPoint1 + // DetermineFlagValuesWithDistanceToLine(headPoint1, endPoint1, headPoint2, endPoint2, ref flag3, ref flag4); + // } + // } + // + // bool flag5 = Routines2D.DetermineIfPointsCoincide(headPoint1.X, headPoint1.Z, headPoint2.X, headPoint2.Z, 0.001); + // bool flag6 = Routines2D.DetermineIfPointsCoincide(headPoint1.X, headPoint1.Z, endPoint2.X, endPoint2.Z, 0.001); + // bool flag7 = Routines2D.DetermineIfPointsCoincide(endPoint1.X, endPoint1.Z, headPoint2.X, headPoint2.Z, 0.001); + // bool flag8 = Routines2D.DetermineIfPointsCoincide(endPoint1.X, endPoint1.Z, endPoint2.X, endPoint2.Z, 0.001); + // if (Math.Abs(Math.Abs(slope1) - Math.Abs(slope2)) > 5E-12) + // { + // // The lines are not parallel + // if (flag5 && flag7) + // { + // // When both headPoint1 and endPoint1 (almost) coincide with headPoint2, then flag point that is closest to headPoint2 + // // When the distance is the same, flag endPoint1 + // DetermineFlagValuesWithDistanceBetweenPoints(headPoint1, endPoint1, headPoint2, ref flag5, ref flag7); + // } + // if (flag6 && flag8) + // { + // // When both headPoint1 and endPoint1 (almost) coincide with endPoint2, then flag point that is closest to endPoint2 + // // When the distance is the same, flag endPoint1 + // DetermineFlagValuesWithDistanceBetweenPoints(headPoint1, endPoint1, endPoint2, ref flag6, ref flag8); + // } + // } + // + // //if (flag3 && flag4 || flag1 && flag2 || flag1 | flag2 && flag3 || flag4) + // //ToDo bka: Check if the above condition is correct, was | operator intended instead of || operator? + // //Next line is the same as above line, but with || operator instead of | operator + // if (flag3 && flag4 || flag1 && flag2 || ((flag1 || flag2) && flag3) || flag4) + // //The solo flag4 at the end is strange, because at the start there is flag3 && flag4, you could leave that out: + // if (flag1 && flag2 || ((flag1 || flag2) && flag3) || flag4) + // //Probably something else was meant, but that could give a different result, e.g. + // if (flag3 && flag4 || flag1 && flag2 || (flag1 || flag2) && (flag3 || flag4)) + // { + // if (flag1 && !flag2 && !flag5 && !flag7) + // { + // GeometryCurve geometryCurve = this.SplitCurve(line1, line2.HeadPoint); + // line2.HeadPoint = flag4 ? geometryCurve.EndPoint : line1.HeadPoint; + // CheckAndAddToIntersectedCurveList(line2); + // isCurveInserted = true; + // return true; + // } + // + // if (flag2 && !flag1 && !flag6 && !flag8) + // { + // GeometryCurve geometryCurve = this.SplitCurve(line1, line2.EndPoint); + // line2.EndPoint = flag4 ? geometryCurve.EndPoint : line1.HeadPoint; + // CheckAndAddToIntersectedCurveList(line2); + // isCurveInserted = true; + // return true; + // } + // + // if (flag1 && flag2 && !flag5 && !flag8 && !flag7 && !flag6) + // { + // if (Routines2D.Compute2DDistance(headPoint1.X, headPoint1.Z, headPoint2.X, headPoint2.Z) < + // Routines2D.Compute2DDistance(headPoint1.X, headPoint1.Z, endPoint2.X, endPoint2.Z)) + // SplitCurve(line1, line2.HeadPoint).HeadPoint = line2.EndPoint; + // else + // SplitCurve(line1, line2.EndPoint).HeadPoint = line2.HeadPoint; + // CheckAndAddToIntersectedCurveList(line2); + // isCurveInserted = true; + // return true; + // } + // + // if (flag3 && flag4 && !flag5 && !flag8 && !flag7 && !flag6) + // { + // if (Routines2D.Compute2DDistance(headPoint2.X, headPoint2.Z, headPoint1.X, headPoint1.Z) < + // Routines2D.Compute2DDistance(headPoint2.X, headPoint2.Z, endPoint1.X, endPoint1.Z)) + // SplitCurve(line2, line1.HeadPoint).HeadPoint = line1.EndPoint; + // else + // SplitCurve(line2, line1.EndPoint).HeadPoint = line1.HeadPoint; + // CheckAndAddToIntersectedCurveList(line1); + // isCurveInserted = true; + // return true; + // } + // + // if (flag2 && flag1 && !(flag7 && flag6) && !(flag8 && flag5)) + // { + // if (flag5) + // line1.HeadPoint = line2.EndPoint; + // else if (flag7) + // line1.EndPoint = line2.EndPoint; + // else if (flag8) + // line1.EndPoint = line2.HeadPoint; + // else + // line1.HeadPoint = line2.HeadPoint; + // CheckAndAddToIntersectedCurveList(line1); + // CheckAndAddToIntersectedCurveList(line2); + // return true; + // } + // + // if (flag3 & flag4 && !(flag7 & flag6) && !(flag8 & flag5)) + // { + // if (flag5) + // line2.HeadPoint = line1.EndPoint; + // else if (flag6) + // line2.EndPoint = line1.EndPoint; + // else if (flag8) + // line2.EndPoint = line1.HeadPoint; + // else + // line2.HeadPoint = line1.HeadPoint; + // this.CheckAndAddToIntersectedCurveList(line1); + // this.CheckAndAddToIntersectedCurveList(line2); + // return true; + // } + // } + // + // if (!(flag5 & flag8) && !(flag6 & flag7)) + // return false; + // this.CheckAndAddToIntersectedCurveList(line1); + // this.CheckAndAddToIntersectedCurveList(line2); + // return true; + // } - if (!(flag5 & flag8) && !(flag6 & flag7)) - return false; - this.CheckAndAddToIntersectedCurveList(line1); - this.CheckAndAddToIntersectedCurveList(line2); - return true; - } + // private static void DetermineFlagValuesWithDistanceBetweenPoints(Point2D point1, Point2D point2, Point2D point3, + // ref bool flagA, ref bool flagB) + // { + // double distancePoint1ToPoint3 = Routines2D.Compute2DDistance(point1.X, point1.Z, point3.X, point3.Z); + // double distancePoint2ToPoint3 = Routines2D.Compute2DDistance(point2.X, point2.Z, point3.X, point3.Z); + // if (distancePoint1ToPoint3 > distancePoint2ToPoint3) + // flagA = false; + // else + // flagB = false; + // } + // + // private static void DetermineFlagValuesWithDistanceToLine(Point2D point1, Point2D point2, Point2D linePoint1, Point2D linePoint2, + // ref bool flagA, ref bool flagB) + // { + // double distancePoint1ToLine = Routines2D.CalculateDistanceToLine(point1.X, point1.Z, + // linePoint1.X, linePoint1.Z, linePoint2.X, linePoint2.Z); + // double distancePoint2ToLine = Routines2D.CalculateDistanceToLine(point2.X, point2.Z, + // linePoint1.X, linePoint1.Z, linePoint2.X, linePoint2.Z); + // if (distancePoint1ToLine > distancePoint2ToLine) + // flagA = false; + // else + // flagB = false; + // } - private static void DetermineFlagValuesWithDistanceBetweenPoints(Point2D point1, Point2D point2, Point2D point3, - ref bool flagA, ref bool flagB) - { - double distancePoint1ToPoint3 = Routines2D.Compute2DDistance(point1.X, point1.Z, point3.X, point3.Z); - double distancePoint2ToPoint3 = Routines2D.Compute2DDistance(point2.X, point2.Z, point3.X, point3.Z); - if (distancePoint1ToPoint3 > distancePoint2ToPoint3) - flagA = false; - else - flagB = false; - } - - private static void DetermineFlagValuesWithDistanceToLine(Point2D point1, Point2D point2, Point2D linePoint1, Point2D linePoint2, - ref bool flagA, ref bool flagB) - { - double distancePoint1ToLine = Routines2D.CalculateDistanceToLine(point1.X, point1.Z, - linePoint1.X, linePoint1.Z, linePoint2.X, linePoint2.Z); - double distancePoint2ToLine = Routines2D.CalculateDistanceToLine(point2.X, point2.Z, - linePoint1.X, linePoint1.Z, linePoint2.X, linePoint2.Z); - if (distancePoint1ToLine > distancePoint2ToLine) - flagA = false; - else - flagB = false; - } - private GeometryCurve SplitCurve(GeometryCurve curve, Point2D aPointOnCurve) { if (aPointOnCurve.LocationEquals(curve.HeadPoint) || aPointOnCurve.LocationEquals(curve.EndPoint))