public ITransformation CreateFromTwoPoints(Point[] points)
 {
     var translate = new TranslateTransformation(points[0]);
     var finish = translate.ReverseTransform(points[1]);
     var distort = new DistortTransformation(finish, new Point(-finish.Y, finish.X));
     return new CompositeTransformation(distort, translate);
 }
 public Point Transform(Point point)
 {
     var result = point;
     foreach (var transformation in Transformations)
     {
         result = transformation.Transform(result);
     }
     return result;
 }
 public Point Transform(Point point)
 {
     return
         new Point
         {
             X = point.X * AxisX.X + point.Y * AxisY.X,
             Y = point.X * AxisX.Y + point.Y * AxisY.Y
         };
 }
 public Point ReverseTransform(Point point)
 {
     var result = point;
     foreach (var transformation in Transformations.Reverse())
     {
         result = transformation.ReverseTransform(result);
     }
     return result;
 }
        public ITransformation CreateFromThreePoints(Point[] points)
        {
            var translate = new TranslateTransformation(points[0]);
            var axisX = translate.ReverseTransform(points[1]);
            var axisY = translate.ReverseTransform(points[2]);
            var distort = new DistortTransformation(axisX, axisY);

            return new CompositeTransformation(distort, translate);
        }
 public Point ReverseTransform(Point point)
 {
     var det = AxisX.X * AxisY.Y - AxisX.Y * AxisY.X;
     return
         new Point
         {
             X = (+point.X * AxisY.Y - point.Y * AxisY.X) / det,
             Y = (-point.X * AxisX.Y + point.Y * AxisX.X) / det
         };
 }
 public Point Transform(Point point)
 {
     var w = (point.X - 1) * (Arrow.Y - 1) + (point.Y - 1) * (Arrow.X - 1) - 1;
     return
         new Point
         {
             X = -point.X * Arrow.X / w,
             Y = -point.Y * Arrow.Y / w
         };
 }
 public Point ReverseTransform(Point point)
 {
     var w = (point.Y * Arrow.X * (Arrow.X - 1) + point.X * Arrow.Y * (Arrow.Y - 1) + Arrow.X * Arrow.Y) /
             (Arrow.X + Arrow.Y - 1);
     return
         new Point
         {
             X = point.X * Arrow.Y / w,
             Y = point.Y * Arrow.X / w
         };
 }
 public ITransformation CreateFromFourPoints(Point[] points)
 {
     var translate = new TranslateTransformation(points[0]);
     var axisX = translate.ReverseTransform(points[1]);
     var axisY = translate.ReverseTransform(points[2]);
     var distort = new DistortTransformation(axisX, axisY);
     var arrow = distort.ReverseTransform(
         translate.ReverseTransform(points[3]));
     var perspective = new PerspectiveTransformation(arrow);
     return new CompositeTransformation(perspective, distort, translate);
 }
 public ITransformation CreateFromOnePoint(Point start, Point finish)
 {
     var factory = new StandardTransformationFactory();
     return CreateFromRoute(factory.CreateFromOnePoint(start),
         factory.CreateFromOnePoint(finish));
 }
 public PerspectiveTransformation(Point arrow)
 {
     Arrow = arrow;
 }
 public Point Transform(Point point)
 {
     return InnerTransformation.ReverseTransform(point);
 }
 public ITransformation CreateFromFourPoints(Point[] start, Point[] finish)
 {
     var factory = new StandardTransformationFactory();
     return CreateFromRoute(factory.CreateFromFourPoints(start),
         factory.CreateFromFourPoints(finish));
 }
 public Point Transform(Point point)
 {
     return new Point(point.X + Offest.X, point.Y + Offest.Y);
 }
 public DistortTransformation(Point axisX, Point axisY)
 {
     AxisX = axisX;
     AxisY = axisY;
 }
 public TranslateTransformation(Point offest)
 {
     Offest = offest;
 }
 public ITransformation CreateFromOnePoint(Point point)
 {
     return new TranslateTransformation(point);
 }
示例#18
0
 public PointViewModel(Point point)
 {
     _point = point;
 }
 public Point ReverseTransform(Point point)
 {
     return new Point(point.X - Offest.X, point.Y - Offest.Y);
 }