GLM and API surface area #962
Replies: 8 comments 44 replies
-
Great question. I really don't know - I originally used GLM as a submodule for pretty much exactly this reason. I'm still trying to understand how dependency management in C++ can be so bad that I can't even use a header math library! @fire, @kintel, @starseeker, @pca006132 let's see if we can put our heads together and figure out a decent solution here. Things we have tried:
Possible futures:
Please chime in and help us come to consensus here. |
Beta Was this translation helpful? Give feedback.
-
Ignoring APIs that are provided by
I would expect the first part to be easy to implement and the remaining 5 requiring more code. But yeah, I was probably underestimating the code needed... Regarding should we keep glm: I don't think removing it from the public API will buy us anything for godot, they care about compile-time dependency as well. I think it is fine to keep this as is, if someone wants to get rid of this they are free to open a PR and implement everything... |
Beta Was this translation helpful? Give feedback.
-
My take would be to avoid re-inventing the glm wheel and stick with solution 2/3. That said, I would definitely advise getting glm out of the public manifold API (option 6), unless there are serious negative implications in performance or code complexity in doing so. I'll own up to a selfish reason for wanting option 6 - BRL-CAD bundles manifold, and its exposure of glm in the public headers means we also need to bundle glm because of how we manage and build against dependencies. It would be better if glm were just a compile time dependency - we do distinguish between them. More importantly, if someday down the road glm becomes problematic for whatever reason and Manifold wants or needs to switch to some other spiffy math library, having glm types in the public headers means that'll be a breaking change for client codes on a much larger scale. |
Beta Was this translation helpful? Give feedback.
-
..or go straight for Eigen, which may be a bit more ubiquitous :) |
Beta Was this translation helpful? Give feedback.
-
In the interest of incremental progress, I'd say doing option 6 is a good one. That reduces the API surface area. The decision of whether to (effectively) fork GLM is a separate issue. As an alternative to GLM, maybe this one? https://github.com/sgorsten/linalg. Just one header so you can drop it into the repo without much guilt :) |
Beta Was this translation helpful? Give feedback.
-
Starting a new thread based on:
According to this, GLM is actually designed for this kind of casting. Would this be a simple solution to 6)? Just cast any GLM structs currently exposed in our public API to generic arrays? What do you think @pca006132? |
Beta Was this translation helpful? Give feedback.
-
Opening a new thread regarding avoiding copy for My proposal for this would be to make struct MeshGLP {
VecView<Precision> vertProperties;
// ...
std::unique_ptr<DataSource<Precision, I>> dataSource = nullptr;
}; The data source pointer handles ownership. When |
Beta Was this translation helpful? Give feedback.
-
FYI: #976 (comment) |
Beta Was this translation helpful? Give feedback.
-
I've put in a few hours of work trying to replace GLM. It's not exactly a couple hundred lines as @pca006132 suggested earlier. And manifold doesn't use GLM in totally trivial ways. There is more numerical code in Manifold that I expected (
svd.h
,smoothing.cpp
). There's a bit of stuff for me to get wrong. To be clear, it's totally something I can do and have done this sort of thing before (though I haven't had to write my own vector/matrix classes since grad school).So I'm wondering, should GLM just be out of the public API but still used for internal calculations? Since it's header-only what's the harm in just checking it in to the repo so it doesn't need to be an external dep? That seems preferable to some little short-on-features set of structs I would write. Why reinvent the wheel?
Beta Was this translation helpful? Give feedback.
All reactions