Example Code

Points inside or outside ? - A Cauchy Integral solution

Code and Documents

Attachment

Introduction

There are many algorithms to evaluate the question, whether a point is inside or outside a region.

Some algorithms are very fast, but suffering on complex region structures.

With that VI we check from given points their position related to a curve, which represents a closed polygon.

The curve and the points are represented by complex arrays.

The decision, if a point is inside or outside the polygon, is based upon the evaluation of the Cauchy-Line-Integral. Each point is hereby defined as singularity. If the point is inside the curve, a value of +/- 2*Pi*N will be calculated, otherwise a value of Zero will appear.
For each point a boolean array will represent each position. If the element is true, the point is inside the closed curve. Additionally, two lists with points inside and outside will be given back.

If the curve is defined only by a few points, x- and y- values will be interpolated with 10 additional values (10 = Default). This value can be changed by use of the optional input. The used curve (with or without interpolation) can be accessed via the output "Curve_Interp".

If the input "Grafik?" is set to true, a XY-graph with the curves and the points will appear. Points outside and inside are drawn in different style, so that you can directly view the result of classification...

Steps to Complete

Copy this VI to your user.lib-subdirectories.

Additional Notes

cauchy-blockdiagram.gif

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors