| Customize Help
| Save Settings

MbeadGetNeighbors



Function Map
Synopsis
Get the template and/or vertex closest to a source point.
Syntax
void MbeadGetNeighbors(
MIL_ID ContextBeadId, //in
MIL_INT LabelOrIndex, //in
MIL_DOUBLE PositionX, //in
MIL_DOUBLE PositionY, //in
MIL_INT *TemplateLabelPtr, //out
MIL_INT *PointIndexPtr, //out
MIL_INT64 ControlFlag //in
)
Description

This function retrieves the label of the template, and the vertex within that template, that is closest to the specified position. This function can also retrieve the vertex within the specified template that is closest to the specified position. You can only use this function with templates whose path follows a polyline (MbeadControl() with M_TRAINING_PATH set to either M_POLYLINE_SEED or M_POLYLINE).

To set a maximum distance for which MIL considers a template or vertex to be the closest, use MbeadControl() with M_CLOSEST_POINT_MAX_DISTANCE. By default, there is no maximum distance.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ContextBeadId

Specifies the identifier of the bead context. The bead context must have been previously allocated on the required system using MbeadAlloc().

LabelOrIndex

Specifies the bead template in which the closest vertex is expected to be located.

This parameter must be set to one of the following values:

function map For specifying a bead template
Click to summarizeValue Description
Click to summarize M_NULL

Specifies no label or index value.

When using M_CLOSEST_TEMPLATE, LabelOrIndex must be set to M_NULL.

(summarize)
Click to summarize

Specifies the index of the template.

(summarize)
Parameters

Specifies the index. The index must be greater than or equal to 0.

Click to summarize

Specifies the label of the template.

(summarize)
Parameters

Specifies the label. The label must be greater than 0.

PositionX

Specifies the source point's X-position.

PositionY

Specifies the source point's Y-position.

TemplateLabelPtr

Specifies the address of the variable in which to write the label of the closest template.

When using M_CLOSEST_POINT, TemplateLabelPtr must be set to M_NULL.

If there is no template (in the case of M_CLOSEST_TEMPLATE) sufficiently close to the source point, M_INVALID will be returned.

PointIndexPtr

Specifies the address of the variable in which to write the index of the closest vertex.

If there is no template (in the case of M_CLOSEST_TEMPLATE) or vertex (in the case of M_CLOSEST_POINT) sufficiently close to the source point, M_INVALID will be returned.

ControlFlag

Specifies whether to retrieve the closest template and/or the closest vertex.

function map For specifying whether to receive the closest template or the closest vertex
Click to summarizeValue Description
Click to summarize M_DEFAULT

Same as M_CLOSEST_TEMPLATE.

Click to summarize M_CLOSEST_POINT

Specifies to return the vertex, within the specified template, that is closest to the specified source point.

Click to summarize M_CLOSEST_TEMPLATE

Specifies to return the template, and the vertex within that template, that are closest to the specified source point.

Compilation information
Header Include mil.h.
Library Use mil.lib; milbead.lib.
DLL Requires mil.dll; milbead.dll.
NULL INVALID DEFAULT CLOSEST POINT CLOSEST TEMPLATE