# triangsearch (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

triangsearch(a, b, c, x, y)

k = triangsearch(a, b, c, x, y)

Legacy Name: `tsearch`

## Description

Determines inside which triangle the points you specify are located. Before you call this function, use the delaunay function to generate the Delaunay triangulation.

Examples

## Inputs

Name Description
a Specifies a vector of x-coordinates that represent points in a plane.
b Specifies a vector of y-coordinates that represent points in a plane. length(b) must equal length(a).
c Specifies an n-by-3 matrix of integers, where n equals length(a). Each row of c represents a triangle of the Delaunay triangulation. Use the delaunay function to calculate matrix c.
x Specifies a vector of x-coordinates. This function determines whether the points you specify in x and y are inside a triangle of the Delaunay triangulation.
y Specifies a vector of y-coordinates. This function determines whether the points you specify in x and y are inside a triangle of the Delaunay triangulation.

## Outputs

Name Description
k Indicates whether the points you specify in x and y are inside a triangle of the Delaunay triangulation. If the points are inside one of the triangles, this function returns the row number in c that represents that triangle. Otherwise, this function returns NaN.

## 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

a = [1, 2, 3, 4, 5, 6, 7, 8];
b = [2, 4, 1, 6, 4, 5, 6, 2];
c = delaunay(a, b);
k = triangsearch(a, b, c, [4, 0], [3.5, 0])