Esempio n. 1
0
        private void CalculateArrowPoints(Point begin, Point end)
        {
            double ARROW_SIZE = 25;

            double deltaX = begin.X - end.X;
            double deltaY = begin.Y - end.Y;
            double length = Math.Sqrt(deltaX * deltaX + deltaY * deltaY);
            deltaX /= length;
            deltaY /= length;

            double leftArrowPointX = 6.5 * deltaX + deltaY;
            double leftArrowPointY = 6.5 * deltaY - deltaX;
            double rightArrowPointX = 6.5 * deltaX - deltaY;
            double rightArrowPointY = 6.5 * deltaY + deltaX;

            length = Math.Sqrt(leftArrowPointX * leftArrowPointX + leftArrowPointY * leftArrowPointY);
            leftArrowPointX /= length;
            leftArrowPointY /= length;
            rightArrowPointX /= length;
            rightArrowPointY /= length;

            LeftArrowPoint = new DoublePoint() { X = leftArrowPointX * ARROW_SIZE, Y = leftArrowPointY * ARROW_SIZE };
            RightArrowPoint = new DoublePoint() { X = rightArrowPointX * ARROW_SIZE, Y = rightArrowPointY * ARROW_SIZE };
        }
Esempio n. 2
0
 /// <summary>use Flat or flatten calls.</summary>
 public DoublePoint ScaleTo(DoublePoint point)
 {
     if (point.X==X && point.Y==Y) throw new InvalidOperationException("you mucker");
     System.Windows.Forms.MessageBox.Show( string.Format("X: {1},Y: {0}",Y/point.Y,X/point.X) );
     if (X > point.Y)
     {
     //				Global.cstat(ConsoleColor.Red,"X is BIGGER");
         Debug.Print("X is BIGGER");
     }
     else {
         Debug.Print("X is SMALLER");
     //				Global.cstat(ConsoleColor.Red,"X is SMALLER");
     }
     return this;
 }
Esempio n. 3
0
 public bool IsYLEq(DoublePoint P)
 {
     return IsYG(P)&IsYG(P);
 }
Esempio n. 4
0
 public bool IsYG(DoublePoint P)
 {
     return Y>P.Y;
 }
Esempio n. 5
0
 public bool IsXL(DoublePoint P)
 {
     return X<P.X;
 }
Esempio n. 6
0
 public bool IsXG(DoublePoint P)
 {
     return X>P.X;
 }
Esempio n. 7
0
 public bool IsLEq(DoublePoint p)
 {
     return (X<=p.X) && (Y<=p.Y);
 }
Esempio n. 8
0
 public DoublePoint GetScaledRation(DoublePoint dst)
 {
     return this*(dst/this);
 }
Esempio n. 9
0
 public static DoublePoint Average(params DoublePoint[] xp)
 {
     DoublePoint p = new DoublePoint(0);
     foreach (DoublePoint pt in xp) p += pt;
     return p/xp.Length;
 }
Esempio n. 10
0
 public DoubleRect(DoublePoint L, DoublePoint S)
     : this(L.X, L.Y, S.X, S.Y)
 {
 }
Esempio n. 11
0
 public DoubleRect(float x, float y, float width, float height)
 {
     Location = new DoublePoint(x, y);
       Size = new DoublePoint(width, height);
 }
Esempio n. 12
0
 ///  static FromControl Methods (relative to the control)
 public static DoubleRect FromClientInfo(DoublePoint ClientSize, Padding pad)
 {
     return new DoubleRect(DoublePoint.GetPaddingTopLeft(pad), ClientSize - DoublePoint.GetPaddingOffset(pad));
 }
Esempio n. 13
0
 public RectangleDoubleUnit(DoublePoint L, DoublePoint S) : this(L.X, L.Y, S.X, S.Y)
 {
 }
 ///	static FromControl Methods (relative to the control)
 public static RectangleDoubleUnit FromClientInfo(DoublePoint ClientSize, Padding pad)
 {
     return new RectangleDoubleUnit(DoublePoint.GetPaddingTopLeft(pad),ClientSize-DoublePoint.GetPaddingOffset(pad));
 }
Esempio n. 15
0
 // =======================================================
 /// ? AutoScale ? multiplies agains largest point in ?dest / source?
 public static DoublePoint Fit(DoublePoint dest, DoublePoint source)
 {
     return Fit(dest,source,scaleFlags.autoScale);
 }
Esempio n. 16
0
 ///	static FromControl Methods (relative to the control)
 static public RectangleDoubleUnit FromControl(Control ctl, Padding pad)
 {
     return(new RectangleDoubleUnit(DoublePoint.GetPaddingTopLeft(pad), DoublePoint.GetClientSize(ctl) - DoublePoint.GetPaddingOffset(pad)));
 }
Esempio n. 17
0
 /// ? AutoScale ? Multiplies against largest source size: ( ( source.X | source.Y ) * ( dest / source.X | source.Y ) )<br/>?
 /// ScaleWidth ( dest * source.X )
 public static DoublePoint Fit(DoublePoint dest, DoublePoint source, scaleFlags sf)
 {
     DoublePoint HX = dest/source;
     if (sf== scaleFlags.autoScale) return (HX.Y > HX.X) ? source*HX.X : source * HX.Y;
     else return (sf== scaleFlags.sWidth) ? source*HX.X : source*HX.Y;
 }
Esempio n. 18
0
 public bool IsGEq(DoublePoint p)
 {
     return (X>=p.X) && (Y>=p.Y);
 }
Esempio n. 19
0
 /// <summary>same as FlattenPoint overload without boolean</summary>
 public static DoublePoint FlattenDown(DoublePoint _pin)
 {
     return FlattenPoint(_pin);
 }
Esempio n. 20
0
 public bool IsXEq(DoublePoint P)
 {
     return X==P.X;
 }
Esempio n. 21
0
 public static DoublePoint FlattenPoint(DoublePoint _pin, bool roundUp)
 {
     DoublePoint newP = _pin.Clone();
     if (newP.X==newP.Y) return newP;
     if (_pin.X > _pin.Y) { if (roundUp) newP.Y = newP.X; else newP.X = newP.Y; }
     else { if (!roundUp) newP.Y = newP.X; else newP.X = newP.Y; }
     return newP;
 }
Esempio n. 22
0
 public bool IsXGEq(DoublePoint P)
 {
     return IsXG(P)&IsXG(P);
 }
Esempio n. 23
0
 public static DoublePoint FlattenPoint(DoublePoint _pin)
 {
     return FlattenPoint(_pin,false);
 }
Esempio n. 24
0
 public bool IsYEq(DoublePoint P)
 {
     return Y==P.Y;
 }
Esempio n. 25
0
 public static DoublePoint FlattenUp(DoublePoint _pin)
 {
     return FlattenPoint(_pin,true);
 }
Esempio n. 26
0
 public bool IsYL(DoublePoint P)
 {
     return Y<P.Y;
 }
Esempio n. 27
0
 public void CopyPoint(DoublePoint inPoint)
 {
     X=inPoint.X; Y=inPoint.Y;
 }
Esempio n. 28
0
 public DoublePoint Multiply(params float[] P)
 {
     if (P.Length==0) throw new ArgumentException("there is no data!");
     if (P.Length==1) return new DoublePoint(X,Y)*P[0];
     DoublePoint NewPoint = new DoublePoint(X,Y)*P[0];
     for (int i = 1; i < P.Length; i++)
     {
         NewPoint *= P[i];
     }
     return NewPoint;
 }
Esempio n. 29
0
 public DoublePoint Divide(params DoublePoint[] P)
 {
     if (P.Length==0) throw new ArgumentException("there is no data!");
     if (P.Length==1) return new DoublePoint(X,Y)/P[0];
     DoublePoint NewPoint = new DoublePoint(X,Y)/P[0];
     for (int i = 1; i < P.Length; i++)
     {
         NewPoint /= P[i];
     }
     return NewPoint;
 }
Esempio n. 30
0
 public DoublePoint Translate(DoublePoint offset, DoublePoint zoom)
 {
     return (this+offset)*zoom;
 }
Esempio n. 31
0
 public DoublePoint GetRation(DoublePoint dst)
 {
     return dst/this;
 }
 public RectangleDoubleUnit(DoublePoint L, DoublePoint S)
     : this(L.X,L.Y,S.X,S.Y)
 {
 }
Esempio n. 33
0
 ///	static FromControl Methods (relative to the control)
 static public RectangleDoubleUnit FromClientInfo(DoublePoint ClientSize, Padding pad)
 {
     return(new RectangleDoubleUnit(DoublePoint.GetPaddingTopLeft(pad), ClientSize - DoublePoint.GetPaddingOffset(pad)));
 }