GeometryCollective / boundary-first-flattening

MIT License
768 stars 96 forks source link

Compile with emscripten question #80

Closed sysuyl closed 1 year ago

sysuyl commented 1 year ago

Hi, @rohan-sawhney ,

The BFF is so fast and stable for surface parameterization, and I am trying to port it to the frontend for our web application. But there is a big problem when compiling suitesparse with emscripten, because its depdency LAPACK is written in FORTRAN language. With my limited knowledge, I tried some experiments but all faied, and guess it maybe nearly impossible to compile them.

I noticed that you have successfully compiled some c++ libs to web, and especially mentioned that there maybe a update of suitesparse backend for linear-algebra-js. So is there a way to compile it? Do you have some experimence or suggestions?

Another question is, if suitesparse is not working, is there a alternative to replace suitesparse function used in BFF, e.g. Eigen? If exists, how much work need to do replacement and will the performance drop too much?

Thanks!

rohan-sawhney commented 1 year ago

Hi @sysuyl, this library has support for BFF here built on top of linear-algebra-js which uses Eigen internally. Not as fast as Suitesparse unfortunately, but for moderately sized meshes the performance hit isn't too noticeable. I would recommend if you can to use emscripten on the latest version of Eigen in linear-algebra-js, since its likely to be faster than the ~3 year old version of Eigen linear-algebra-js is currently using.

sysuyl commented 1 year ago

Hi @rohan-sawhney , Thank you for reply and suggestions. The geometry-processing-js library is amazing, it supports parameterization and also shows that eigen can be a good replacement.

But there is still a problem, I need to compile BFF with some other c++ processing code together to form a function module, so the direct way maybe replace suitesparse with eigen in this c++ code repository. But for now, I cannot estimate how much work need to do, and where should I focus to rewrite the code with eigen. It's a some challenge for me actually.

Besides, I think if there is a pure Eigen based BBF, it will be very convenient to be integrated in many other(even pure c++) applications. So may I ask, could you consider to add a eigen support for this library?

Thanks!