Пример #1
0
        static double dbugCurrentLen(PixelFarm.Drawing.PointD p0, PixelFarm.Drawing.PointD p1)
        {
            double dx = p1.X - p0.X;
            double dy = p1.Y - p0.Y;

            return(Math.Sqrt(dx * dx + dy * dy));
        }
 PixelFarm.Drawing.PointD CreateExtendedInnerEdges(PixelFarm.Drawing.PointD p0, PixelFarm.Drawing.PointD p1)
 {
     PixelFarm.VectorMath.Vector2 v2 = new PixelFarm.VectorMath.Vector2(p1.X - p0.X, p1.Y - p0.Y);
     PixelFarm.VectorMath.Vector2 r1 = v2.RotateInDegree(270).NewLength(3);
     return(new PixelFarm.Drawing.PointD(p1.X + r1.x, p1.Y + r1.Y));
     //if (LeftPointKind == Vec2PointKind.Touch1 || LeftPointKind == Vec2PointKind.Touch2)
     //{
     //    double rad = Math.Atan2(p1.Y - p0.Y, p1.X - p0.X);
     //    double currentLen = CurrentLen(p0, p1);
     //    if (currentLen - 3 < 0)
     //    {
     //        return p0;//***
     //    }
     //    double newLen = currentLen - 3;
     //    //double new_dx = Math.Cos(rad) * newLen;
     //    //double new_dy = Math.Sin(rad) * newLen;
     //    return new PixelFarm.Drawing.PointD(p0.X + (Math.Cos(rad) * newLen), p0.Y + (Math.Sin(rad) * newLen));
     //}
     //else
     //{
     //    PixelFarm.VectorMath.Vector2 v2 = new PixelFarm.VectorMath.Vector2(p1.X - p0.X, p1.Y - p0.Y);
     //    PixelFarm.VectorMath.Vector2 r1 = v2.RotateInDegree(270).NewLength(3);
     //    return new PixelFarm.Drawing.PointD(p1.X + r1.x, p1.Y + r1.Y);
     //}
 }
Пример #3
0
 public void Offset(double dx, double dy)
 {
     //
     _pLeft   = PixelFarm.Drawing.PointD.OffsetPoint(_pLeft, dx, dy);
     _pCenter = PixelFarm.Drawing.PointD.OffsetPoint(_pCenter, dx, dy);
     _pRight  = PixelFarm.Drawing.PointD.OffsetPoint(_pRight, dx, dy);
 }
        PixelFarm.Drawing.PointD CreateExtendedOuterEdges(PixelFarm.Drawing.PointD p0, PixelFarm.Drawing.PointD p1, double dlen = 3)
        {
            //create perpendicular line

            PixelFarm.VectorMath.Vector2 v2 = new PixelFarm.VectorMath.Vector2(p1.X - p0.X, p1.Y - p0.Y);
            PixelFarm.VectorMath.Vector2 r1 = v2.RotateInDegree(90).NewLength(3);
            return(new PixelFarm.Drawing.PointD(p1.X + r1.x, p1.Y + r1.Y));
            //if (LeftPointKind == Vec2PointKind.Touch1 || LeftPointKind == Vec2PointKind.Touch2)
            //{
            //    double rad = Math.Atan2(p1.Y - p0.Y, p1.X - p0.X);
            //    double currentLen = CurrentLen(p0, p1);
            //    double newLen = currentLen + dlen;

            //    //double new_dx = Math.Cos(rad) * newLen;
            //    //double new_dy = Math.Sin(rad) * newLen;
            //    return new PixelFarm.Drawing.PointD(p0.X + (Math.Cos(rad) * newLen), p0.Y + (Math.Sin(rad) * newLen));
            //}
            //else
            //{

            //    //create perpendicular line

            //    PixelFarm.VectorMath.Vector2 v2 = new PixelFarm.VectorMath.Vector2(p1.X - p0.X, p1.Y - p0.Y);
            //    PixelFarm.VectorMath.Vector2 r1 = v2.RotateInDegree(90).NewLength(3);
            //    return new PixelFarm.Drawing.PointD(p1.X + r1.x, p1.Y + r1.Y);
            //}
        }
Пример #5
0
        //-----------

        public ContourCorner(int cornerNo, Vec2Info left, Vec2Info center, Vec2Info right)
        {
            if (cornerNo >= ushort.MaxValue)
            {
                throw new NotSupportedException();
            }

            _cornerNo = (ushort)cornerNo;
            _left     = left;
            _center   = center;
            _right    = right;

            _pLeft   = new PixelFarm.Drawing.PointD(left.x, left.y);
            _pCenter = new PixelFarm.Drawing.PointD(center.x, center.y);
            _pRight  = new PixelFarm.Drawing.PointD(right.x, right.y);
        }