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); }
public UPointD AddY(params int[] P) { UPointD PBase = Clone(); foreach (int RefPoint in P) { PBase.Y += RefPoint; } return(PBase); }
public UPointD NegY(params UPointD[] P) { UPointD PBase = Clone(); foreach (UPointD RefPoint in P) { PBase.Y -= RefPoint.Y; } return(PBase); }
public UPointD NegY(params int[] P) { UPointD PBase = Clone(); foreach (int Ref in P) { PBase.Y -= Ref; } return(PBase); }
static public UPointD Average(params UPointD[] xp) { UPointD p = new UPointD(0); foreach (UPointD pt in xp) { p += pt; } return(p / xp.Length); }
public UPointD AddX(params UPointD[] P) { UPointD PBase = Clone(); foreach (UPointD RefPoint in P) { PBase.X += RefPoint.X; } return(PBase); }
/// ? 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); } }
/// <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); }
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); }
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); }
public bool IsGEq(UPointD p) { return (X>=p.X) && (Y>=p.Y); }
public UPointD GetRation(UPointD dst) { return dst/this; }
public void CopyPoint(UPointD inPoint) { X=inPoint.X; Y=inPoint.Y; }
public static UPointD FlattenPoint(UPointD _pin) { return FlattenPoint(_pin,false); }
public bool IsYL(UPointD P) { return(Y < P.Y); }
public bool IsYG(UPointD P) { return(Y > P.Y); }
public bool IsYEq(UPointD P) { return Y==P.Y; }
public bool IsYEq(UPointD P) { return(Y == P.Y); }
public bool IsXEq(UPointD P) { return(X == P.X); }
public bool IsYLEq(UPointD P) { return(IsYG(P) & IsYG(P)); }
public bool IsXLEq(UPointD P) { return(IsXG(P) & IsXG(P)); }
public bool IsGEq(UPointD p) { return((X >= p.X) && (Y >= p.Y)); }
public bool IsLEq(UPointD p) { return((X <= p.X) && (Y <= p.Y)); }
public bool IsXEq(UPointD P) { return X==P.X; }
public bool IsXL(UPointD P) { return X<P.X; }
// ======================================================= /// ? AutoScale ? multiplies agains largest point in ?dest / source? public static UPointD Fit(UPointD dest, UPointD source) { return Fit(dest,source,scaleFlags.autoScale); }
public bool IsYL(UPointD P) { return Y<P.Y; }
/// <summary>same as FlattenPoint overload without boolean</summary> public static UPointD FlattenDown(UPointD _pin) { return FlattenPoint(_pin); }
public static UPointD Average(params UPointD[] xp) { UPointD p = new UPointD(0); foreach (UPointD pt in xp) p += pt; return p/xp.Length; }
public bool IsXL(UPointD P) { return(X < P.X); }
/// ? 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; }
public UPointD Translate(UPointD offset, UPointD zoom) { return((this + offset) * zoom); }
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; }
public UPointD GetScaledRation(UPointD dst) { return(this * (dst / this)); }
public static UPointD FlattenUp(UPointD _pin) { return FlattenPoint(_pin,true); }
public UPointD GetRation(UPointD dst) { return(dst / this); }
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; }
static public UPointD FlattenUp(UPointD _pin) { return(FlattenPoint(_pin, true)); }
public UPointD GetScaledRation(UPointD dst) { return this*(dst/this); }
// ======================================================= /// ? AutoScale ? multiplies agains largest point in ?dest / source? static public UPointD Fit(UPointD dest, UPointD source) { return(Fit(dest, source, scaleFlags.autoScale)); }
public bool IsLEq(UPointD p) { return (X<=p.X) && (Y<=p.Y); }
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; }
public bool IsXG(UPointD P) { return X>P.X; }
public UPointD Translate(UPointD offset, UPointD zoom) { return (this+offset)*zoom; }
public bool IsXLEq(UPointD P) { return IsXG(P)&IsXG(P); }
/// <summary>same as FlattenPoint overload without boolean</summary> static public UPointD FlattenDown(UPointD _pin) { return(FlattenPoint(_pin)); }
public bool IsYG(UPointD P) { return Y>P.Y; }
static public UPointD FlattenPoint(UPointD _pin) { return(FlattenPoint(_pin, false)); }
public bool IsYLEq(UPointD P) { return IsYG(P)&IsYG(P); }
public bool IsXG(UPointD P) { return(X > P.X); }
/// <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; }
public void CopyPoint(UPointD inPoint) { X = inPoint.X; Y = inPoint.Y; }
public RectangleDoubleUnit(UnitD x, UnitD y, UnitD width, UnitD height) { Location = new UPointD(x,y); Size = new UPointD(width,height); }
public RectangleDoubleUnit(UnitD x, UnitD y, UnitD width, UnitD height) { Location = new UPointD(x, y); Size = new UPointD(width, height); }