13.16.4 Checking if a point is in a polygon or circle:
is_inside
The
is_inside
command determines whether or not a point is in a polygon or a circle.
is_inside
takes two arguments:
P
, a point.
C
, a polygon or a circle.
is_inside(
P
,
C
)
returns
1
if
P
is inside
C
(including the boundary) and returns
0
otherwise.
Examples.
Input:
is_inside(0,circle(-1,1))
Output:
1
Input:
is_inside(2,polygon([1,2-i,3+i]))
Output:
1
Input:
is_inside(1-i, triangle([1,2-i,3+i]))
Output:
0