ocmath_find_base_regions

 

Description

Find the flat part in the curve as baseline

Syntax

int ocmath_find_base_regions( UINT nSize, const double * px, const double * py, int nMinBasePts, UINT nMaxRegions, int * pBegs, int * pEnds, double dTol = 1.0, double dMaxSearchSize = 0.4, int nRange0 = 0 )

Parameters

nSize
[input] size of the curve data
px
[input] pointer to x coordinates of the curve
py
[input] pointer to y coordinates of the curve
nMinBasePts
[input] minimum points that can be seen as baseline
nMaxRegions
[input] maximum segments of a baseline
pBegs
[output] series of begin indices of baselines
pEnds
[output] series of end indices of baselines
dTol
[input] tolerance to determine the linear regions
dMaxSearchSize
[input] maximum search range to find baseline, description as percentage
nRange0
[input] minimum step to calculate the slope

Return

Return number of baseline regions.

Examples

EX1

void ocmath_find_base_regions_ex1()
{
    vector vx = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    vector vy = {8.15988E-4,
                0.01832,
                0.16901,
                0.64118,
                1,
                0.64118,
                0.16901,
                0.01832,
                8.15988E-4,
                1.49453E-5}
    vector<int> vBeg(9);
    vector<int> vEnd(9);
    ocmath_find_base_regions(10, vx, vy, 2, 2, vBeg, vEnd);
}

Remark

See Also

header to Include

origin.h

Reference