public Postion2D Apply(Postion2D postion) { postion.X += Left; postion.Y += Top; return(postion); }
public static Postion2D IncrmnetForPoint(Postion2D start, Postion2D target, double deltaTime, double speed) { var startVec = start.ToVector(); var targetVec = target.ToVector(); float distance = Vector2.Distance(startVec, targetVec); var direction = Vector2.Normalize(targetVec - startVec); var inc = direction * (float)speed * (float)deltaTime; while (Vector2.Distance(startVec, inc + startVec) >= distance) { speed -= 0.1; inc = direction * (float)speed * (float)deltaTime; } return(new Postion2D(inc)); }
public Paultangle(double x, double y, double width, double height) { Postion2D = new Postion2D(x, y); Width = width; Height = height; }
public Paultangle(Postion2D postion2D, double width, double height) : this(postion2D.X, postion2D.Y, width, height) { }
public Postion2D Calcaute(Paultangle bounds, Postion2D size) { return new Postion2D(0, Math.Floor(bounds.Height / 2) - Math.Floor(size.Y / 2)); }
public bool Conatins(Postion2D postion2D) { return(postion2D.X > X && postion2D.X <Right& postion2D.Y> Y && postion2D.Y < Bottom); }
public bool AtOrPast(Postion2D target) { return(IsAt(target) || X > target.X || Y > target.Y); }
public bool WithinRadius(Postion2D target, double radius) { var d = Math.Sqrt(Math.Pow((X - target.X), 2) + Math.Pow((Y - target.Y), 2)); return(d <= radius); }
public bool IsAt(Postion2D target) { return(X == target.X && Y == target.Y); }
public Postion2D(Postion2D postion2D) : this(postion2D.X, postion2D.Y) { }
public Postion2D Calcaute(Paultangle bounds, Postion2D size) { return(new Postion2D((bounds.Width / 2) - (size.X / 2), 0)); }