Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

inpolygon (MathScript Function) (Windows, Not in Base Package)

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Member of the geometry class.

Syntax

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

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

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.

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 = inpolygon(Px, Py, Polyx, Polyy)

Related Topics

convhull
delaunay
rand
rectint
voronoi


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit