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

Severity Check in NumberOfVertices Set Property on DiscreteCurveEvolution Class #183

@hzawary

Description

@hzawary

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions