public override void MoveToCore(Point newPosition) { ILinearFigure figure = LinearFigure; Parameter = figure.GetNearestParameterFromPoint(newPosition); newPosition = figure.GetPointFromParameter(Parameter); base.MoveToCore(newPosition); }
public static IEnumerable <Point> EnumeratePointsOnLinearFigure(this ILinearFigure figure) { var domain = figure.GetParameterDomain(); for (double lambda = domain.Item1; lambda < domain.Item2; lambda += 0.01) { yield return(figure.GetPointFromParameter(lambda)); } }
public static Point SnapPointToFigure(this ILinearFigure figure, Point point) { var parameter = figure.GetNearestParameterFromPoint(point); return(figure.GetPointFromParameter(parameter)); }