Exemplo n.º 1
0
        public bool Intersects(BaseObject o)
        {
            float angle = (float)Math.Atan2(o.CenterPoint.Y - CenterPoint.Y, o.CenterPoint.X - CenterPoint.X);
            Vector2 point = CenterPoint + new Vector2(Radius * (float)Math.Cos(angle), Radius * (float)Math.Sin(angle));
            //return o.Touches(point);

            return o.Touches(point) || Vector2.Distance(CenterPoint, o.CenterPoint) < Radius;// ||
            //((Math.Abs(centerPoint.X - o.X) < radius || Math.Abs(centerPoint.X - (o.X  + o.Width)) < radius) &&
            //(Math.Abs(centerPoint.Y - o.Y) < radius || Math.Abs(centerPoint.Y - (o.Y + o.Height)) < radius));
        }
Exemplo n.º 2
0
        public override bool Intersects(BaseObject o)
        {
            float   angle = (float)Math.Atan2(o.CenterPoint.Y - centerPoint.Y, o.CenterPoint.X - centerPoint.X);
            Vector2 point = centerPoint + new Vector2(Radius * (float)Math.Cos(angle), Radius * (float)Math.Sin(angle));

            //return o.Touches(point);

            return(o.Touches(point));// ||
            //((Math.Abs(centerPoint.X - o.X) < radius || Math.Abs(centerPoint.X - (o.X  + o.Width)) < radius) &&
            //(Math.Abs(centerPoint.Y - o.Y) < radius || Math.Abs(centerPoint.Y - (o.Y + o.Height)) < radius));
        }
Exemplo n.º 3
0
        public override bool Intersects(BaseObject o)
        {
            //float angle = (float)Math.Atan2(o.CenterPoint.Y - centerPoint.Y, o.CenterPoint.X - centerPoint.X);
            //Vector2 point = centerPoint + new Vector2(Radius * (float)Math.Cos(angle), Radius * (float)Math.Sin(angle));

            Vector2 displacement = o.CenterPoint - CenterPoint;

            displacement.Normalize();
            Vector2 point = centerPoint + displacement * Radius;

            return(o.Touches(point) || Vector2.DistanceSquared(centerPoint, o.CenterPoint) < RadiusSquared);
        }