Tuesday, June 6, 2017

inrect.c (done)

int InRectangle( float pt[2], float rect[4] )
{
    int contained = 0;int result = 0;
    if( (pt[0]>=rect[0]) && (pt[0]<=rect[2])){
        contained++;
    }
    if( (pt[1]>=rect[1]) && (pt[1]<=rect[3]) ){
        contained++;
    }
    if ( contained == 2 ){
        result = 1;
    }
    return result;
}

No comments:

Post a Comment