티스토리 뷰

public static boolean contains(Rectangle r, Point p)
{
   // TODO - you need to implement this. May want to use isInBetween
       return p.x >= r.x && p.y >= r.y && p.x <= r.x + r.width && p.y < =r.y + r.height;             
       }
       

또는 주석에서 언급했듯이 IsBetween을 사용할 수 있습니다.

public static boolean contains(Rectangle r, Point p)
{
        return Assignment6.isBetween(p.x,r.x,r.x+r.width) && Assignment6.isBetween(p.y,r.y,r.y+r.height);
        }
        


출처
https://stackoverflow.com/questions/39940157
댓글
공지사항
Total
Today
Yesterday
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31