elalish / manifold

Geometry library for topological robustness
Apache License 2.0
840 stars 90 forks source link

js bindings: CrossSection.toPolygons() return value doesn't match typescript type #943

Open dsafa opened 3 hours ago

dsafa commented 3 hours ago

The points are objects of type {x,y} instead of an array [x,y] like the types indicate. example: run this on the web example console.log(CrossSection.square().toPolygons()); output:

[
    [
        {
            "x": 0,
            "y": 0
        },
        {
            "x": 1,
            "y": 0
        },
        {
            "x": 1,
            "y": 1
        },
        {
            "x": 0,
            "y": 1
        }
    ]
]

expected:

[
    [
        [0,0],
        [1,0],
        [1,1],
        [0,1]
    ]
]

I can look into fixing it later if no one wants to fix it.

elalish commented 2 hours ago

Thanks, good find. @pca006132 this makes me wonder if we should do any additional API changes here. We switched from Mesh vector-of-vec3 to MeshGL flat vectors. Should we do something similar with Polygon?