From 9:00 AM - 12:00 PM CDT on Saturday, June 6th, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

# is_inpolygon (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info

Owning Class: geometry

Requires: MathScript RT Module

## Syntax

a = is_inpolygon(px, py, polyx, polyy)

[a, b] = is_inpolygon(px, py, polyx, polyy)

Legacy Name: `inpolygon`

## Description

Determines whether given points in the plane are inside a specified polygon.

Examples

## Inputs

Name Description
px Specifies a vector of real numbers that represent the x-coordinates of the given points.
py Specifies a vector of real numbers that represent the y-coordinates of the given points. length(py) must equal length(px).
polyx Specifies a vector of real numbers that represent the x-coordinates of the given points of the polygon.
polyy Specifies a vector of real numbers that represent the y-coordinates of the given points of the polygon. length(polyy) must equal length(polyx).

## Outputs

Name Description
a Returns a vector of logical numbers of the same size as px. If the nth point (px, py) is inside or on the edge of the polygon, the nth element of a is 1. Otherwise, the nth element of a is 0.
b Returns a vector of logical numbers of the same size as px. If the nth point (px, py) is on the edge of the polygon, the nth element of b is 1. Otherwise, the nth element of b is 0.

## Details

The following table lists the support characteristics of this function.

 Supported in the LabVIEW Run-Time Engine Yes Supported on RT targets Yes Suitable for bounded execution times on RT Not characterized

## Examples

Z = 0:pi / 4:2*pi;
Polyx = cos(Z);
Polyy = sin(Z);
Px = 2*rand(500, 1) - 1;
Py = 2*rand(500, 1) - 1;
A = is_inpolygon(Px, Py, Polyx, Polyy)

Not Helpful