Previous Up Next

10.18.4  Savoir si 1 point est à l’intérieur d’un polygone ou d’un cercle : is_inside est_dans

is_inside ou est_dans est une fonction booléenne ayant comme argument un point et un polygone ou un cercle.
is_inside ou est_dans vaut 1 si le point est à l’intérieur ou sur le bord du polygone ou du cercle, et vaut 0 sinon.
On tape :

est_dans((point(0),cercle(-1,1))

On obtient :

1

On tape :

est_dans(point(2),polygone([1,2-i,3+i]))

On obtient :

1

On tape :

est_dans(point(1-i),triangle([1,2-i,3+i]))

On obtient :

0

Previous Up Next