diff --git a/Geometry_Engine/Query/Centroid.cs b/Geometry_Engine/Query/Centroid.cs index fe44799f8..64d571b9e 100644 --- a/Geometry_Engine/Query/Centroid.cs +++ b/Geometry_Engine/Query/Centroid.cs @@ -35,20 +35,31 @@ public static partial class Query /***************************************************/ /**** Public Methods - Curves ****/ /***************************************************/ - + [Deprecated("2.4", "Deprecated to expose tolerance as optional parameter for greater control", null, "Centroid(this Polyline curve, double tolerance = Tolerance.Distance)")] public static Point Centroid(this Polyline curve) { - if (!curve.IsPlanar()) + return curve.Centroid(Tolerance.Distance); + } + + [Deprecated("2.4", "Deprecated to expose tolerance as optional parameter for greater control", null, "Centroid(this PolyCurve curve, double tolerance = Tolerance.Distance)")] + public static Point Centroid(this PolyCurve curve) + { + return curve.Centroid(Tolerance.Distance); + } + + public static Point Centroid(this Polyline curve, double tolerance = Tolerance.Distance) + { + if (!curve.IsPlanar(tolerance)) { Reflection.Compute.RecordError("Input must be planar."); return null; } - else if (!curve.IsClosed()) + else if (!curve.IsClosed(tolerance)) { Reflection.Compute.RecordError("Curve is not closed. Input must be a polygon"); return null; } - else if (curve.IsSelfIntersecting()) + else if (curve.IsSelfIntersecting(tolerance)) { Reflection.Compute.RecordWarning("Curve is self intersecting"); return null; @@ -112,19 +123,19 @@ public static Point Centroid(this Polyline curve) /***************************************************/ - public static Point Centroid(this PolyCurve curve) + public static Point Centroid(this PolyCurve curve, double tolerance = Tolerance.Distance) { - if (!curve.IsPlanar()) + if (!curve.IsPlanar(tolerance)) { Reflection.Compute.RecordError("Input must be planar."); return null; } - else if (!curve.IsClosed()) + else if (!curve.IsClosed(tolerance)) { Reflection.Compute.RecordError("Curve is not closed."); return null; } - else if (curve.IsSelfIntersecting()) + else if (curve.IsSelfIntersecting(tolerance)) { Reflection.Compute.RecordWarning("Curve is self intersecting"); return null; @@ -288,9 +299,9 @@ private static Point CircularSegmentCentroid(this Arc arc) /***************************************************/ public static Point ICentroid(this ICurve curve) - { - return Centroid(curve as dynamic); - } + { + return Centroid(curve as dynamic); + } /***************************************************/ } diff --git a/Geometry_Engine/Query/Normal.cs b/Geometry_Engine/Query/Normal.cs index 877e69146..8caf1df4d 100644 --- a/Geometry_Engine/Query/Normal.cs +++ b/Geometry_Engine/Query/Normal.cs @@ -88,21 +88,33 @@ public static List Normals(this Mesh mesh) /***************************************************/ /**** Public Methods - Curves ****/ /***************************************************/ - + + [Deprecated("2.4", "Deprecated to expose tolerance as optional parameter for greater control", null, "Normal(this Polyline curve, double tolerance = Tolerance.Distance)")] public static Vector Normal(this Polyline curve) { + return curve.Normal(Tolerance.Distance); + } + + [Deprecated("2.4", "Deprecated to expose tolerance as optional parameter for greater control", null, "Normal(this PolyCurve curve, double tolerance = Tolerance.Distance)")] + public static Vector Normal(this PolyCurve curve) + { + return curve.Normal(Tolerance.Distance); + } - if (!curve.IsPlanar()) + public static Vector Normal(this Polyline curve, double tolerance = Tolerance.Distance) + { + + if (!curve.IsPlanar(tolerance)) { Reflection.Compute.RecordError("Input must be planar."); return null; } - else if (!curve.IsClosed()) + else if (!curve.IsClosed(tolerance)) { Reflection.Compute.RecordError("Curve is not closed. Input must be a polygon"); return null; } - else if (curve.IsSelfIntersecting()) + else if (curve.IsSelfIntersecting(tolerance)) { Reflection.Compute.RecordWarning("Curve is self intersecting"); return null; @@ -124,20 +136,20 @@ public static Vector Normal(this Polyline curve) /***************************************************/ - public static Vector Normal(this PolyCurve curve) + public static Vector Normal(this PolyCurve curve, double tolerance = Tolerance.Distance) { - if (!curve.IsPlanar()) + if (!curve.IsPlanar(tolerance)) { Reflection.Compute.RecordError("Input must be planar."); return null; } - else if (!curve.IsClosed()) + else if (!curve.IsClosed(tolerance)) { Reflection.Compute.RecordError("Curve is not closed. Input must be a polygon"); return null; } - else if (curve.IsSelfIntersecting()) + else if (curve.IsSelfIntersecting(tolerance)) { Reflection.Compute.RecordWarning("Curve is self intersecting"); return null;