java - How I check if one oval inside the ather? -


i have function not work

there ovals

    g.setcolor(color.black);     g.filloval(irx, iry, 10, 10);      g.setcolor(raco);     g.filloval(irx+1, iry+1, 8, 8);      g.setcolor(color.black);     g.drawoval(myx, myy, w, h);      g.setcolor(setco);     g.filloval(myx+1, myy+1, w-1, w-1); 

there function

eated = iscollision( myx, myy, w, irx,iry,10);  private static boolean iscollision(double a1, double b1, float r1, double    a2, double b2, float r2) {     /*double x1, y1, x2, y2;     x1 = a1 + r1/2;     y1 = b1 - r1/2;      x2 = a2 + r2/2;     y2 = b2 - r2/2;*/      float a,dx, dy;     = (r1+r2) * (r1+r2);     dx = (float) (a1 - a2);     dy = (float) (b1 - b2);      if (a > (dx*dx) + (dy*dy))     {         return true;     }     return false; } 

i have function works thank , have nice day ! ! !

turning on telepathy module.

afair drawoval/filloval coordinates of top left corner, height , of bounding box of oval. , iscollision centers , radiuses of circles.

you should convert 1 another. remember centerx = topleftx + width/2.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -