| | 1490 | #define ur_setLogic(c,b) ur_initType(c,UT_LOGIC); ur_logic(c) = b |
| | 1491 | |
| | 1492 | // (rect pnt -- logic) |
| | 1493 | UR_CALL( uc_point_in ) |
| | 1494 | { |
| | 1495 | UCell* res = ur_s_prev(tos); |
| | 1496 | if( ur_is(tos, UT_COORD) && ur_is(res, UT_COORD) ) |
| | 1497 | { |
| | 1498 | int inside; |
| | 1499 | int16_t* pnt = tos->coord.elem; |
| | 1500 | int16_t* rect = res->coord.elem; |
| | 1501 | if( pnt[0] < rect[0] || |
| | 1502 | pnt[1] < rect[1] || |
| | 1503 | pnt[0] > (rect[0] + rect[2]) || |
| | 1504 | pnt[1] > (rect[1] + rect[3]) ) |
| | 1505 | inside = 0; |
| | 1506 | else |
| | 1507 | inside = 1; |
| | 1508 | ur_setLogic(res, inside); |
| | 1509 | UR_S_DROP; |
| | 1510 | return; |
| | 1511 | } |
| | 1512 | ur_throwErr( UR_ERR_DATATYPE, "point-in expected 2 coord! values" ); |
| | 1513 | } |
| | 1514 | |
| | 1515 | |