Skip to content

Bug in line along x axis #8

@DavidHernandezLopez

Description

@DavidHernandezLopez

I think there is a bug.
virtual Line ComputeModel(const std::vector& data, const std::set& samples)
when not if (fabs(b) > DBL_EPSILON)
a and b coefficients for lines in x and y axis solved by:

    double maxDiffX=0.;
    double maxDiffY=0.;
    for(int np=0;np<(data.size()-1);np++)
    {
        double diffX=fabs(data[np+1].x-data[np].x);
        if(diffX>maxDiffX) maxDiffX=diffX;
        double diffY=fabs(data[np+1].y-data[np].y);
        if(diffY>maxDiffY) maxDiffY=diffY;
    }
    if(maxDiffX<maxDiffY)
    {
        line.a = 1;
        line.b = 0;
    }
    else
    {
        line.a = 0;
        line.b = 1;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions