Skip to content

cost() function in simplify.py #47

@BenoitDaviet

Description

@BenoitDaviet

cost() function doesn't output the correct number of points.
Here is an example : res should countain 21 elements whose type isn't "None", but instead there are 23 of them

`from cereals.src.openalea.cereals.simplification import cost
import openalea.plantgl.all as pgl

xn, yn, sn, rn = (np.linspace(0, 0.7, 155),
np.linspace(0, 0.4, 155),
np.linspace(0, 1, 155),
np.ones(155))

nb_points = 21
points = [pgl.Vector3(*pt) for pt in zip(xn, rn, yn)]

res = cost(polyline=points, nb_points=nb_points)

print(len(res)) # 155, OK
print(len([r for r in res if r])) # 23, instead of 21`

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