Example #1
0
        public Postion2D Apply(Postion2D postion)
        {
            postion.X += Left;
            postion.Y += Top;

            return(postion);
        }
Example #2
0
        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));
        }
Example #3
0
 public Paultangle(double x, double y, double width, double height)
 {
     Postion2D = new Postion2D(x, y);
     Width     = width;
     Height    = height;
 }
Example #4
0
 public Paultangle(Postion2D postion2D, double width, double height) : this(postion2D.X, postion2D.Y, width, height)
 {
 }
Example #5
0
 public Postion2D Calcaute(Paultangle bounds, Postion2D size)
 {
     return new Postion2D(0, Math.Floor(bounds.Height / 2) - Math.Floor(size.Y / 2));
 }
Example #6
0
 public bool Conatins(Postion2D postion2D)
 {
     return(postion2D.X > X && postion2D.X <Right& postion2D.Y> Y && postion2D.Y < Bottom);
 }
Example #7
0
 public bool AtOrPast(Postion2D target)
 {
     return(IsAt(target) || X > target.X || Y > target.Y);
 }
Example #8
0
        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);
        }
Example #9
0
 public bool IsAt(Postion2D target)
 {
     return(X == target.X && Y == target.Y);
 }
Example #10
0
 public Postion2D(Postion2D postion2D) : this(postion2D.X, postion2D.Y)
 {
 }
Example #11
0
 public Postion2D Calcaute(Paultangle bounds, Postion2D size)
 {
     return(new Postion2D((bounds.Width / 2) - (size.X / 2), 0));
 }