According to the website, it is header file based (I guess that means C++ templates everywhere). It seems to consist of numerous header files.
I thought at one time that a library like that could have its routines accelerated with the graphics card. If it is header files only, I don’t know if it would call the OpenGL routines that access a graphics card (OpenGL is an open specification, but the graphics driver source code is proprietary to the graphics card manufacturers).
It just means the library itself does not need compiled. No binary is generated to link against. You just need to include the headers in order to make the functions available in your compiled extension.
As far as libraries, libigl does matrices, but also a lot of other neat stuff and looks like it might be a good fit for SketchUp. Something like Dual quaternion skinning would be amazing for SketchUp, for example.
It’s used in ‘dilay’ for geometry creation and manipulation… [ Jim posted a link Dilay for the other day ]
I started building a mac port, but had trouble linking GLM in…
I think I need to build it as a linked Library on a mac…
I’ve been looking into the MathsGeoLib some more. I like how it looks. I have one concern, however.
MathsGeoLib uses float numbers as the basis of the vectors. As far as I can understand, Sketchup uses double numbers, which as I understand has twice the precision. Have you had issues with prevision? As my manipulations need to make sure edges need to meet and edges of faces have to meet others, I am a little concerned by this. Have you experienced any issues in regards to precision before?
I don’t think I have had issues with precision. But I’m only generating transformations for placing components, not raw edges/faces.
Sketchup’s tolerance is 1/1000", is a C float more precise that 0.001? I think so.
You should try to have MathsGeoLib work on a complicated/tricky case and see if it’s precise enough.
A C float number gives around 7 “significant figures” of precision from what I have read. That means that I can achieve the 1/1000" (0.001") tolerance/accuracy for lengths of up to 9999" (9999.999"), or 254m (this is a simplification, I understand, as binary numbers don’t match perfectly to decimals). Any sizes larger than this, and I guess the numbers will start to truncate and become inaccurate.
I guess this is enough precision for most architectural scales. I would have liked an extra couple of digits to reassure me.
That said, I will give MathGeoLib a go. It definitely feels the most friendly to me.
4 months into learning C++, I’ve ended up putting together my own library for Vector maths that plugs in nicely with SketchUp. I realised that it wasn’t that hard to do, and in fact much quicker than using an external library for what I wanted to do. I was surprised how few functions were required to cover most vector calculations (+, -, *, /, dot product, cross product, covered most). Going through the code of MathsGeoLib really helped me as a reference.
I’ve included the text for the header file for my library below in case anyone is interested. I’d be happy to share once it’s more polished and complete. The great advantage of my custom library is being able to quickly start calculating using SketchUp’s native structs that hold geometric data:
e.g Vector3D a = Point3D(SUPoint3D c) - Point3D(SUPoint3D b)); // This needs 3 lines of code with MathGeoLib