F_VN_ClosestPointsBF

F_VN_ClosestPointsBF 1:

Find the closest distance between two 2d point sets of the same type, using a brute force approach.

Syntax

Definition:

FUNCTION F_VN_ClosestPointsBF : HRESULT
VAR_INPUT
    ipPointSet1 : ITcVnContainer;
    ipPointSet2 : ITcVnContainer;
END_VAR
VAR_IN_OUT
    fMinDist    : LREAL;
    aPoint1     : TcVnPoint2_LREAL;
    aPoint2     : TcVnPoint2_LREAL;
END_VAR
VAR_INPUT
    hrPrev      : HRESULT;
END_VAR

F_VN_ClosestPointsBF 2: Inputs

Name

Type

Description

ipPointSet1

ITcVnContainer

Container with 1st set of 2d points

ipPointSet2

ITcVnContainer

Container with 2nd set of 2d points

hrPrev

HRESULT

HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.)

F_VN_ClosestPointsBF 3: In/Outputs

Name

Type

Description

fMinDist

LREAL

Returns the minimum distance between 2 points of the different point sets

aPoint1

TcVnPoint2_LREAL

Returns the point out of ipPointSet1, for which fMinDist is achieved

aPoint2

TcVnPoint2_LREAL

Returns the point out of ipPointSet2, for which fMinDist is achieved

F_VN_ClosestPointsBF 4: Return value

HRESULT

Further information

The function F_VN_ClosestPointsBF determines which points from two point clouds are closest to each other.

Parameter

Point clouds

The closest two points are sought in the point clouds ipPointSet1 and ipPointSet2.

Minimum distance (Return value)

The parameter fMinDist returns the distance between the two points that are closest to each other. This corresponds to the minimum distance between the two point clouds.

Closest points (Return value)

The parameters aPoint1 and aPoint2 return the two points that are closest to each other in the point clouds.

Application

The determination of the minimum distance between two lines looks like this, for example:

hr := F_VN_ClosestPointsBF(
    ipPointSet1 :=  ipLine1,
    ipPointSet2 :=  ipLine2,
    fMinDist    :=  fDistance,
    aPoint1     :=  aPoint1,
    aPoint2     :=  aPoint2,
    hrPrev      :=  hr
);

Related functions

Required License

TC3 Vision Metrology 2D

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.54 or later

PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision