Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pointInFigure([arg1, arg2, arg3]) {
- let h = Number(arg1);
- let x = Number(arg2);
- let y = Number(arg3);
- let rectangle1 = (x > 0) && (x < (h * 3)) && (y > 0) && (y < h);
- let rectangle2 = (x > h) && (x < (h * 2)) && (y >= h) && (y < (h * 4));
- if (rectangle1 || rectangle2) {
- console.log('inside');
- } else if (((y == 0) && (x >= 0) && (x <= (h * 3))) || ((y == h) && (((x >= 0) && (x <= h)) || ((x >= (h * 2)) && (x <= (h * 3))))) || ((y == (h * 4)) && (x >= h) && (x <= (h * 2)))) {
- console.log('border');
- } else if ((((x == 0) || (x == (h * 3))) && (y >= 0) && (y <= h)) || (((x == h) || (x == (h * 2))) && (y >= h) && (y <= (h * 4)))) {
- console.log('border');
- } else {
- console.log('outside');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement