public CoordinatMotion(Vector position, int intensity, int feed, Color color)
     : base(position)
 {
     Intensity = intensity;
     Feed = feed;
     Color = color;
 }
Exemple #2
0
 public Bezier(Vector start, Vector end, Vector pStart, Vector pEnd)
 {
     Start = start;
     End = end;
     PStart = pStart;
     PEnd = pEnd;
 }
Exemple #3
0
        //конструктор прямой через вектор нормали и точку
        public Line(Vector normalVector, Vector pointToCross)
        {
            A = normalVector.X;
            B = normalVector.Y;

            C = -(A * pointToCross.X + B * pointToCross.Y);
        }
Exemple #4
0
        public void GeneratePixels(double pointResolution)
        {
            var directionVector = new Vector(-B, A).Normalize() * pointResolution; // _NormalVector.Normalize().Rotate90CCW() * pointResolution;
            if (directionVector.X < 0)
                directionVector = directionVector.Reverse();

            var currentVector = GetFirstVector();

            IInterpolator inter = InterpolateHelper.CurrentInterpolator;

            //наполняем пикселями
            Pixel temp = _Image.GetPixel(currentVector.X, currentVector.Y);//inter.GetPixel(_Image, currentVector);
            while (temp != null)
            {
                _Pixels.Add(temp);
                currentVector += directionVector;
                temp = _Image.GetPixel(currentVector.X, currentVector.Y);//inter.GetPixel(_Image, currentVector);
            }

            var lastAddedVector = currentVector - directionVector;
            var lastVector = GetLastVector();
            if (lastAddedVector.X != lastVector.X && lastAddedVector.Y != lastVector.Y)
            {
                _Pixels.Add(_Image.GetPixel(lastVector.X, lastVector.Y));

            }
        }
Exemple #5
0
        public ImageByLinesPresenter CreatePresenter()
        {
            var ip = new ImageByLinesPresenter(_image);

            var angleInRadian = AngleToVector.DegToRad(_Angle);
            var mathVector = AngleToVector.GetNormal(angleInRadian);
            var resultingVector = new Vector(Math.Round(mathVector.X, 6), Math.Round(mathVector.Y, 6));

            ip.Present(resultingVector, _LineRes, _PointRes);

            return ip;
        }
        public void Present(Vector normalVector, double lineResolution, double pointResolution)
        {
            LineResolution = lineResolution;
            Lines.Clear();

            Vector vectorIncrement = normalVector.Normalize() * lineResolution;

            Vector startingPoint;
            Vector endPoint;
            Vector currentVector;
            if (vectorIncrement.X < 0) //для углов 91-180 рисуем, начиная с левого верхнего края - координата (0, Ymax)
            {
                startingPoint = new Vector(0, Image.Height);
                endPoint = new Vector(Image.Width, 0);
                vectorIncrement = vectorIncrement.Reverse();
                currentVector = Line.GetIntersection(new Line(vectorIncrement, startingPoint), new Line(new Vector(-vectorIncrement.Y, vectorIncrement.X), new Vector(0, 0)));
            }
            else // для углов 0-90 с точки (0,0)
            {
                startingPoint = new Vector(0, 0);
                endPoint = new Vector(Image.Width, Image.Height);
                currentVector = vectorIncrement;
            }

            Lines.Add(new ImageLine(vectorIncrement, startingPoint, Image));

            var BorderLine = new Line(vectorIncrement, endPoint);
            var IncrementLine = new Line(new Vector(-vectorIncrement.Y, vectorIncrement.X), new Vector(0, 0));
            var Intersection = Line.GetIntersection(BorderLine, IncrementLine);

            while (currentVector.X <= Intersection.X && (currentVector.Y * Intersection.Y < 0 || Math.Abs(currentVector.Y) <= Math.Abs(Intersection.Y)))
            {
                Lines.Add(new ImageLine(currentVector, Image));
                currentVector += vectorIncrement;
            }

            foreach (var item in Lines)
            {
                item.GeneratePixels(pointResolution);
            }
        }
 public FreeMotionStroke(Vector destinationPoint)
 {
     DestinationPoint = destinationPoint;
 }
Exemple #8
0
 public Pixel(double intencity, Vector v)
     : this(intencity, v.X, v.Y)
 {
 }
Exemple #9
0
 //конструктор прямой через вектор нормали и точку
 public ImageLine(Vector normalVector, Vector pointToCross, Image image)
     : base(normalVector, pointToCross)
 {
     _Pixels = new List<Pixel>();
     _Image = image;
 }
Exemple #10
0
 public ArcMotion(Vector position, double r, int intensity, int feed, Color color)
     : base(position, intensity, feed, color)
 {
     R = r;
 }
Exemple #11
0
 //closestPoint - ближайшая точка прямой
 //pointForDirection - любая точка на линии разгона
 public IdleStroke(Vector destination)
     : base(destination, 0)
 {
 }
Exemple #12
0
 //контструктор прямой через вектор нормали. А координаты точки совпадают с координатами вектора нормали
 public Line(Vector normalVector)
     : this(normalVector, normalVector)
 {
 }
Exemple #13
0
 public VisualLine(Vector v1, Vector v2, double intensity)
 {
     _v1 = v1;
     _v2 = v2;
     _intensity = intensity;
 }
Exemple #14
0
 public RapidMotion(Vector position, string comment)
     : this(position)
 {
     Comment = comment;
 }
Exemple #15
0
 public RapidMotion(Vector position)
     : base(position)
 {
 }
Exemple #16
0
 public CoordinatMotion(Vector position, int intensity, int feed)
     : this(position, intensity, feed, Color.Black)
 {
 }
Exemple #17
0
 public static double GetAngle(Vector v)
 {
     return Math.Acos(v.Normalize().X);
 }
Exemple #18
0
 public ArcMotion(Vector position, double r, int intensity, int feed)
     : base(position, intensity, feed)
 {
     R = r;
 }
Exemple #19
0
 //контструктор прямой через вектор нормали. А координаты точки, через которую проходит прямая, совпадают с координатами вектора нормали
 public ImageLine(Vector normalVector, Image image)
     : this(normalVector, normalVector, image)
 {
 }
Exemple #20
0
 public static double GetLength(Vector a, Vector b)
 {
     return Math.Sqrt((a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y));
 }
Exemple #21
0
 public Stroke(Vector destinationPoint, double intensity)
     : base(destinationPoint)
 {
     Intensity = intensity;
 }
Exemple #22
0
 public BaseMotion(Vector position)
     : base("")
 {
     Position = position;
 }