GeometryCollective / boundary-first-flattening

MIT License
768 stars 96 forks source link

Fitting a target shape #42

Closed giorgiomarcias closed 5 years ago

giorgiomarcias commented 5 years ago

Hi,

Really great work, guys. Thanks.

I'd like to experiment with some target shapes. Could you tell me how to use the API, please? I suppose the only function is void BFF::flattenToShape(const std::vector<Vector>& gamma);. Is the argument a 2D polyline representing the target closed polygon? Do you provide a way to match the first boundary vertex with the beginning of the input polygon (especially when the mesh is read from an OBJ file)?

rohan-sawhney commented 5 years ago

Thanks @giorgiomarcias. Yes, gamma is a 2D polyline representing the target closed polygon. The API doesn't provide a way to match input and output vertices but it should be doable. You'll probably have to look through some of the internals of the code, since the BFF algorithm parameterizes/encodes the output curve via its curvature and scaling (per vertex) before assigning it coordinates in the plane. Additionally, the coordinates of the output curve won't exactly match the coordinates of the input curve since curvature and scaling values of the output curve are sampled along the input curve.

giorgiomarcias commented 5 years ago

So I was supposing correctly.

I needed to modify the normalization step, when building the mesh at load-time, but I came out with a temporary solution and I got the mach.

Regarding the output curve, yes, it was clear from the paper.

Thank you so much, @rohan-sawhney. Again, congratulations!