FitLine

Fit a line into a point set.

Syntax

Definition:

HRESULT FitLine(
    HRESULT            hrPrev,
    ITcVnContainer*    ipPointSet,
    TcVnVector4_LREAL& aFitLine,
    ETcVnDistanceType  eDistanceType = DT_L2,
    double             fParam = 0,
    double             fEpsRadius = 0.001,
    double             fEpsAngle = 0.001
)

Parameters

Name

Type

Default

Description

hrPrev

HRESULT

 

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

ipPointSet

ITcVnContainer*

 

Source point set (ContainerType_Vector_TcVnPoint2_DINT or ContainerType_Vector_TcVnPoint2_REAL; The elements of this container are the individual points.)

aFitLine

TcVnVector4_LREAL&

 

Resulting line. The first and second element describe the x and y component of a vector collinear to the line. The third and fourth element describe the x and y component of a point on the line.

eDistanceType

ETcVnDistanceType

DT_L2

Distance computation method (supported: L1, L2, L12, FAIR, WELSCH, HUBER)

fParam

double

0

Numerical parameter (c) for some eDistanceType (should be >= 0). If 0, an optimal value is chosen internally.

fEpsRadius

double

0.001

Accuracy of the radius (distance of the line from the coordinate origin, should be > 0). A smaller value means higher accuracy.

fEpsAngle

double

0.001

Accuracy of the angle (should be > 0). A smaller value means higher accuracy.

FitLine 1: Return value

HRESULT

Required License

TC3 Vision Base

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