is_inpolygon (MathScript RT Module Function)

LabVIEW 2012 MathScript RT模块帮助

»查看产品信息 下载帮助（仅限Windows）

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)

﻿