Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Severity Check in NumberOfVertices Set Property on DiscreteCurveEvolution Class #183

Closed
hzawary opened this issue Jan 5, 2016 · 2 comments

Comments

@hzawary
Copy link
Contributor

hzawary commented Jan 5, 2016

Hi,

I think that NumberOfVertices in DiscreteCurveEvolution class on Accord.Math.Geometry can be more than 3, but thrown exception:

    private int vertices = 20;

    /// <summary>
    /// Gets or sets the number of vertices.
    /// </summary>
    /// 
    public int NumberOfVertices
    {
        get { return vertices; }
        set
        {
            if (value <= 0 || value > 3)
                throw new ArgumentOutOfRangeException("value", 
                    "Number of vertices should be between 0 and 3.");

            vertices = value;
        }
    }

Seems this is enough:

    public List<IntPoint> OptimizeShape(List<IntPoint> shape)
    {
        if (vertices > shape.Count)
            throw new ArgumentException("Number of points left must be higher than number of the shape.");

.
.
.

In actually I can't set NumberOfVertices to more than 3 points, caused the exception! In addition, vertices set to 20 in initialization class. Exist repugnance!

@cesarsouza
Copy link
Member

Thanks!

@cesarsouza
Copy link
Member

Integrated in release 3.4.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants