Implementation
D

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
Types
b := PtInRect(Rect(x1,y1,x2,y2), Point(x,y));
Point = Struct.new(:x, :y)

Rect  = Struct.new(:x1, :y1, :x2, :y2) do
  def contains?(point)
    point.x.between?(x1,x2) && point.y.between?(y1,y2)
  end
end

b = Rect.new(0,0,2,5).contains?(Point.new(0,0))
const pointInRect = ({x1, y1, x2, y2}, {x, y}) => (
  (x > x1 && x < x2) && (y > y1 && y < y2)
)
b = (x1 < x < x2) and (y1 < y < y2)
import "image"
p := image.Pt(x, y)
r := image.Rect(x1, y1, x2, y2)
b := p.In(r)
(setf b (and (< x1 x x2)
             (< y1 y y2)))
int isInsideRect(double x1, double y1, double x2, double y2, double px, double py){
	return px >= x1 && px <= x2 && py >= y1 && py <= y2; 
}
struct Rect {
    x1: i32,
    x2: i32,
    y1: i32,
    y2: i32,
}

impl Rect {
    fn contains(&self, x: i32, y: i32) -> bool {
        return self.x1 < x && x < self.x2 && self.y1 < y && y < self.y2;
    }
}
logical :: b
b = (x1 < x) .and. (x < x2) .and. (y1 < y) .and. (y < y2)