ulfben icon

circleRectangleIntersection

ulfben | PRO | 01/10/16 08:37:56 AM UTC | 0 ⭐ | 10930 👁️ | Never ⏰ | []
ActionScript 3 |

0 B

|

None

|

0 👍

/

0 👎

public function circleRectangleIntersection(circle:Entity, rect:Entity):Boolean
{
    var closestX:Number = circle.x < rect.x ? rect.x : circle.x > (rect.x+rect.width) ? (rect.x+rect.width) : circle.x;
    var closestY:Number = circle.y < rect.y ? rect.y : circle.y > (rect.y+rect.height) ? (rect.y+rect.height) : circle.y;
    var dx:Number = closestX-circle.x;
    var dy:Number = closestY-circle.y;
    return ((dy*dy)+(dx*dx) < (circle.radius*circle.radius));
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  • Rteuixl icon
    04/02/26 04:33:08 PM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
     Remove the @ 
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎