private static ICircleEntity ByPointsOnCurveCore(Point firstPoint, Point secondPoint, Point thirdPoint) { if (firstPoint == null) { throw new ArgumentNullException("firstPoint"); } else if (secondPoint == null) { throw new ArgumentNullException("secondPoint"); } else if (thirdPoint == null) { throw new ArgumentNullException("thirdPoint"); } else if (firstPoint.Equals(secondPoint)) { throw new ArgumentException(string.Format(Properties.Resources.EqualGeometry, "first point", "second point"), "firstPoint, secondPoint"); } else if (secondPoint.Equals(thirdPoint)) { throw new ArgumentException(string.Format(Properties.Resources.EqualGeometry, "second point", "thrid point"), "secondPoint, thirdPoint"); } else if (thirdPoint.Equals(firstPoint)) { throw new ArgumentException(string.Format(Properties.Resources.EqualGeometry, "third point", "first point"), "thirdPoint, firstPoint"); } else if (GeometryExtension.ArePointsColinear(firstPoint, secondPoint, thirdPoint)) { throw new ArgumentException(string.Format(Properties.Resources.PointsColinear, "first, second and thrid points"), "firstPoint, secondPoint, thirdPoint"); } /* * Vector normal = null; * var centerPt = Utils.GetCircumCenter(firstPoint, secondPoint, thirdPoint, out normal); * if (centerPt == null || normal == null) * { * return null; * } * double rad = firstPoint.PointEntity.DistanceTo(centerPt.PointEntity); * if( rad <= 0.0) * { * return null; * } */ var entity = HostFactory.Factory.CircleByPointsOnCurve(firstPoint.PointEntity, secondPoint.PointEntity, thirdPoint.PointEntity); if (null == entity) { throw new Exception(string.Format(Properties.Resources.OperationFailed, "Circle.ByPointsOnCurve")); } return(entity); }
private static IArcEntity ByPointsOnCurveCore(Point firstPoint, Point secondPoint, Point thirdPoint) { if (firstPoint == null) { throw new ArgumentNullException("firstPoint"); } else if (secondPoint == null) { throw new ArgumentNullException("secondPoint"); } else if (thirdPoint == null) { throw new ArgumentNullException("thirdPoint"); } else if (firstPoint.Equals(secondPoint)) { throw new ArgumentException(string.Format(Properties.Resources.EqualGeometry, "first point", "second point"), "firstPoint, secondPoint"); } else if (secondPoint.Equals(thirdPoint)) { throw new ArgumentException(string.Format(Properties.Resources.EqualGeometry, "second point", "thrid point"), "secondPoint, thridPoint"); } else if (thirdPoint.Equals(firstPoint)) { throw new ArgumentException(string.Format(Properties.Resources.EqualGeometry, "third point", "first point"), "thirdPoint, firstPoint"); } else if (GeometryExtension.ArePointsColinear(firstPoint, secondPoint, thirdPoint)) { throw new ArgumentException(string.Format(Properties.Resources.PointsColinear, "first, second and thrid points"), "firstPoint, secondPoint, thridPoint"); } IArcEntity entity = HostFactory.Factory.ArcByPointsOnCurve(firstPoint.PointEntity, secondPoint.PointEntity, thirdPoint.PointEntity); if (null == entity) { throw new Exception(string.Format(Properties.Resources.OperationFailed, "Arc.ByPointsOnCurve")); } return(entity); }