Logo

Programming-Idioms

History of Idiom 178 > diff from v4 to v5

Edit summary for version 5 by 1.7.4:
[JS] Oups forgot to match a paren :3
ā†·

Version 4

2019-01-24, 13:47:44

Version 5

2019-01-24, 13:48:05

Idiom #178 Check if point is inside rectangle

Set boolean b to true if if the point with coƶrdinates (x,y) is inside the rectangle with coƶrdinates (x1,y1,x2,y2) , or to false otherwise.
Describe if the edges are considered to be inside the rectangle.

Idiom #178 Check if point is inside rectangle

Set boolean b to true if if the point with coƶrdinates (x,y) is inside the rectangle with coƶrdinates (x1,y1,x2,y2) , or to false otherwise.
Describe if the edges are considered to be inside the rectangle.

Code
const pointInRect = ({x1, y1, x2, y2}, {x, y}) => (
  (x > x1 && x < x2) && (y > y1 && y < y2)
Code
const pointInRect = ({x1, y1, x2, y2}, {x, y}) => (
  (x > x1 && x < x2) && (y > y1 && y < y2)
)