| MIL 10 Reference
| Customize Help
| Save Settings

MmeasCalculate



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Calculate measurements between two markers.
Syntax
void MmeasCalculate(
MIL_ID ContextId, //in
MIL_ID Marker1Id, //in
MIL_ID Marker2Id, //in
MIL_ID MeasResultId, //in
MIL_INT64 MeasurementList //in
)
Description

This function calculates the specified measurements between the two specified markers. Before using an edge, stripe, or circle marker with this function, it must have been previously found in a target image (MmeasFindMarker()). Before using a point marker, its position must have been previously set (MmeasSetMarker()).

The settings of the specified measurement context control the behavior of this function; to adjust these settings, use MmeasControl(). MIL stores the results of an MmeasCalculate() operation in the specified measurement result buffer; to obtain the results, use MmeasGetResult() or MmeasGetResultSingle(). If the markers were found in a calibrated image, you can specify the output units using MmeasControl() with M_RESULT_OUTPUT_UNITS. MIL calculates the specified measurements according to the line joining the reference position of each marker (Marker1Id and Marker2Id).

For edge, stripe, and circle markers, the default reference position corresponds to the marker's found position. For an edge marker, the default reference position is the X- and Y-coordinates of the edge's maximum edgevalue. For a stripe marker, the default reference position is the center of the center line that is fit between the stripe's two outer edges. For a circle marker, the default reference position is the X- and Y-coordinates of the circle's center. For a point marker, the default reference position is the same as the position specified using MmeasSetMarker() with M_POSITION.

To change the reference position of any marker, use MmeasSetMarker() with M_MARKER_REFERENCE. Modifying the reference position only affects calculations between two markers (MmeasCalculate()); it does not, for example, affect how MIL locates or returns the position of markers (MmeasFindMarker()).

If you specify multiple-occurrence markers, MIL performs its calculations using the occurrences of the first marker and the corresponding occurrences of the second marker. MIL limits the number of calculations to the smallest number of occurrences held in either marker. For example, if a marker contains one edge occurrence, MIL only performs one calculation, regardless of the number of edge occurrences in the other marker.

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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
ContextId

Specifies the measurement context to use.

function map For specifying the measurement context
CollapseValue Description
Collapse M_DEFAULT

Specifies the default measurement context of the current MIL application.

Collapse Measurement context ID

Specifies a valid measurement context, allocated using MmeasAllocContext().

Marker1Id

Specifies the identifier of the first marker buffer to use for calculating measurements.

Marker2Id

Specifies the identifier of the second marker buffer to use for calculating measurements.

MeasResultId

Specifies the identifier of the result buffer in which to place results.

MeasurementList

Specifies which measurement(s) to calculate. This parameter must be set to one of the following values. To calculate more than one measurement, add the values together (for example, M_DISTANCE + M_ANGLE).

function map For specifying which measurement(s) to calculate
CollapseValue Description
Collapse M_DEFAULT

Same as M_ANGLE + M_DISTANCE + M_LINE_EQUATION.

Collapse M_ANGLE

Calculates the angle of the line joining both markers, relative to the positive X-axis. The resulting angle can be any value between 0° and 360°.

(summarize)
Collapse M_DISTANCE

Calculates the distance of the line joining both markers.

Collapse M_LINE_EQUATION

Calculates the equation of the line joining both markers.

Compilation information
Header Include mil.h.
Library Use mil.lib; milmeas.lib.
DLL Requires mil.dll; milmeas.dll.
DEFAULT DEFAULT ANGLE DISTANCE LINE EQUATION