Пример #1
0
        static public UPointD FlattenPoint(UPointD _pin, bool roundUp)
        {
            UPointD 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);
        }
Пример #2
0
        public UPointD AddY(params int[] P)
        {
            UPointD PBase = Clone();

            foreach (int RefPoint in P)
            {
                PBase.Y += RefPoint;
            }
            return(PBase);
        }
Пример #3
0
        public UPointD NegY(params UPointD[] P)
        {
            UPointD PBase = Clone();

            foreach (UPointD RefPoint in P)
            {
                PBase.Y -= RefPoint.Y;
            }
            return(PBase);
        }
Пример #4
0
        public UPointD NegY(params int[] P)
        {
            UPointD PBase = Clone();

            foreach (int Ref in P)
            {
                PBase.Y -= Ref;
            }
            return(PBase);
        }
Пример #5
0
        static public UPointD Average(params UPointD[] xp)
        {
            UPointD p = new UPointD(0);

            foreach (UPointD pt in xp)
            {
                p += pt;
            }
            return(p / xp.Length);
        }
Пример #6
0
        public UPointD AddX(params UPointD[] P)
        {
            UPointD PBase = Clone();

            foreach (UPointD RefPoint in P)
            {
                PBase.X += RefPoint.X;
            }
            return(PBase);
        }
Пример #7
0
        /// ? AutoScale ? Multiplies against largest source size: ( ( source.X | source.Y ) * ( dest / source.X | source.Y ) )<br/>?
        /// ScaleWidth ( dest * source.X )
        static public UPointD Fit(UPointD dest, UPointD source, scaleFlags sf)
        {
            UPointD 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);
            }
        }
Пример #8
0
        /// <summary>use Flat or flatten calls.</summary>
        public UPointD ScaleTo(UPointD 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");
            }
//			else Global.cstat(ConsoleColor.Red,"X is SMALLER");
            return(this);
        }
Пример #9
0
        public UPointD Divide(params UPointD[] P)
        {
            if (P.Length == 0)
            {
                throw new ArgumentException("there is no data!");
            }
            if (P.Length == 1)
            {
                return(new UPointD(X, Y) / P[0]);
            }
            UPointD NewPoint = new UPointD(X, Y) / P[0];

            for (int i = 1; i < P.Length; i++)
            {
                NewPoint /= P[i];
            }
            return(NewPoint);
        }
Пример #10
0
        public UPointD Multiply(params float[] P)
        {
            if (P.Length == 0)
            {
                throw new ArgumentException("there is no data!");
            }
            if (P.Length == 1)
            {
                return(new UPointD(X, Y) * P[0]);
            }
            UPointD NewPoint = new UPointD(X, Y) * P[0];

            for (int i = 1; i < P.Length; i++)
            {
                NewPoint *= P[i];
            }
            return(NewPoint);
        }
Пример #11
0
 public bool IsGEq(UPointD p)
 {
     return (X>=p.X) && (Y>=p.Y);
 }
Пример #12
0
 public UPointD GetRation(UPointD dst)
 {
     return dst/this;
 }
Пример #13
0
 public void CopyPoint(UPointD inPoint)
 {
     X=inPoint.X; Y=inPoint.Y;
 }
Пример #14
0
 public static UPointD FlattenPoint(UPointD _pin)
 {
     return FlattenPoint(_pin,false);
 }
Пример #15
0
 public bool IsYL(UPointD P)
 {
     return(Y < P.Y);
 }
Пример #16
0
 public bool IsYG(UPointD P)
 {
     return(Y > P.Y);
 }
Пример #17
0
 public bool IsYEq(UPointD P)
 {
     return Y==P.Y;
 }
Пример #18
0
 public bool IsYEq(UPointD P)
 {
     return(Y == P.Y);
 }
Пример #19
0
 public bool IsXEq(UPointD P)
 {
     return(X == P.X);
 }
Пример #20
0
 public bool IsYLEq(UPointD P)
 {
     return(IsYG(P) & IsYG(P));
 }
Пример #21
0
 public bool IsXLEq(UPointD P)
 {
     return(IsXG(P) & IsXG(P));
 }
Пример #22
0
 public bool IsGEq(UPointD p)
 {
     return((X >= p.X) && (Y >= p.Y));
 }
Пример #23
0
 public bool IsLEq(UPointD p)
 {
     return((X <= p.X) && (Y <= p.Y));
 }
Пример #24
0
 public bool IsXEq(UPointD P)
 {
     return X==P.X;
 }
Пример #25
0
 public bool IsXL(UPointD P)
 {
     return X<P.X;
 }
Пример #26
0
 // =======================================================
 /// ? AutoScale ? multiplies agains largest point in ?dest / source?
 public static UPointD Fit(UPointD dest, UPointD source)
 {
     return Fit(dest,source,scaleFlags.autoScale);
 }
Пример #27
0
 public bool IsYL(UPointD P)
 {
     return Y<P.Y;
 }
Пример #28
0
 /// <summary>same as FlattenPoint overload without boolean</summary>
 public static UPointD FlattenDown(UPointD _pin)
 {
     return FlattenPoint(_pin);
 }
Пример #29
0
 public static UPointD Average(params UPointD[] xp)
 {
     UPointD p = new UPointD(0);
     foreach (UPointD pt in xp) p += pt;
     return p/xp.Length;
 }
Пример #30
0
 public bool IsXL(UPointD P)
 {
     return(X < P.X);
 }
Пример #31
0
 /// ? AutoScale ? Multiplies against largest source size: ( ( source.X | source.Y ) * ( dest / source.X | source.Y ) )<br/>?
 /// ScaleWidth ( dest * source.X )
 public static UPointD Fit(UPointD dest, UPointD source, scaleFlags sf)
 {
     UPointD 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;
 }
Пример #32
0
 public UPointD Translate(UPointD offset, UPointD zoom)
 {
     return((this + offset) * zoom);
 }
Пример #33
0
 public static UPointD FlattenPoint(UPointD _pin, bool roundUp)
 {
     UPointD 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;
 }
Пример #34
0
 public UPointD GetScaledRation(UPointD dst)
 {
     return(this * (dst / this));
 }
Пример #35
0
 public static UPointD FlattenUp(UPointD _pin)
 {
     return FlattenPoint(_pin,true);
 }
Пример #36
0
 public UPointD GetRation(UPointD dst)
 {
     return(dst / this);
 }
Пример #37
0
 public UPointD Divide(params UPointD[] P)
 {
     if (P.Length==0) throw new ArgumentException("there is no data!");
     if (P.Length==1) return new UPointD(X,Y)/P[0];
     UPointD NewPoint = new UPointD(X,Y)/P[0];
     for (int i = 1; i < P.Length; i++)
     {
         NewPoint /= P[i];
     }
     return NewPoint;
 }
Пример #38
0
 static public UPointD FlattenUp(UPointD _pin)
 {
     return(FlattenPoint(_pin, true));
 }
Пример #39
0
 public UPointD GetScaledRation(UPointD dst)
 {
     return this*(dst/this);
 }
Пример #40
0
 // =======================================================
 /// ? AutoScale ? multiplies agains largest point in ?dest / source?
 static public UPointD Fit(UPointD dest, UPointD source)
 {
     return(Fit(dest, source, scaleFlags.autoScale));
 }
Пример #41
0
 public bool IsLEq(UPointD p)
 {
     return (X<=p.X) && (Y<=p.Y);
 }
Пример #42
0
 public UPointD Multiply(params float[] P)
 {
     if (P.Length==0) throw new ArgumentException("there is no data!");
     if (P.Length==1) return new UPointD(X,Y)*P[0];
     UPointD NewPoint = new UPointD(X,Y)*P[0];
     for (int i = 1; i < P.Length; i++)
     {
         NewPoint *= P[i];
     }
     return NewPoint;
 }
Пример #43
0
 public bool IsXG(UPointD P)
 {
     return X>P.X;
 }
Пример #44
0
 public UPointD Translate(UPointD offset, UPointD zoom)
 {
     return (this+offset)*zoom;
 }
Пример #45
0
 public bool IsXLEq(UPointD P)
 {
     return IsXG(P)&IsXG(P);
 }
Пример #46
0
 /// <summary>same as FlattenPoint overload without boolean</summary>
 static public UPointD FlattenDown(UPointD _pin)
 {
     return(FlattenPoint(_pin));
 }
Пример #47
0
 public bool IsYG(UPointD P)
 {
     return Y>P.Y;
 }
Пример #48
0
 static public UPointD FlattenPoint(UPointD _pin)
 {
     return(FlattenPoint(_pin, false));
 }
Пример #49
0
 public bool IsYLEq(UPointD P)
 {
     return IsYG(P)&IsYG(P);
 }
Пример #50
0
 public bool IsXG(UPointD P)
 {
     return(X > P.X);
 }
Пример #51
0
 /// <summary>use Flat or flatten calls.</summary>
 public UPointD ScaleTo(UPointD 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");
     }
     //			else Global.cstat(ConsoleColor.Red,"X is SMALLER");
     return this;
 }
Пример #52
0
 public void CopyPoint(UPointD inPoint)
 {
     X = inPoint.X; Y = inPoint.Y;
 }
Пример #53
0
 public RectangleDoubleUnit(UnitD x, UnitD y, UnitD width, UnitD height)
 {
     Location = new UPointD(x,y); Size = new UPointD(width,height);
 }
Пример #54
0
 public RectangleDoubleUnit(UnitD x, UnitD y, UnitD width, UnitD height)
 {
     Location = new UPointD(x, y); Size = new UPointD(width, height);
 }