P5js > À l'intérieur d'un rectangle

Contents (hide)

  1. 1. Algorithme
  2. 2. Exemple(s)

1.  Algorithme

Un point est à l'intérieur d'un rectangle si :

if ( xPoint > xCoin && xPoint < xCoin + largeur && yPoint > yCoin &&  yPoint < yCoin + hauteur ) {

}

p77 de Make: Getting Started with p5.js 
if ( mouseX > x && mouseX < x + w && mouseY > y &&  mouseY < y + h ) {

}

2.  Exemple(s)