MATLAB Functions Help Desk

inpolygon

Purpose

Detect points inside a polygonal region

Syntax

Description

IN = inpolygon(X,Y,xv,yv) returns a matrix IN the same size as X and Y. Each element of IN is assigned one of the values 1, 0.5 or 0, depending on whether the point (X(p,q),Y(p,q)) is inside the polygonal region whose vertices are specified by the vectors xv and yv. In particular:

IN(p,q) = 1

If (X(p,q),Y(p,q)) is inside the polygonal region

IN(p,q) = 0.5

If (X(p,q),Y(p,q)) is on the polygon boundary

IN(p,q) = 0

If (X(p,q),Y(p,q)) is outside the polygonal region

Examples



[ Previous | Help Desk | Next ]