The GMlib Project

GMlib is an in-house geometric modeling library developed at UiT - Narvik (formerly Narvik University College). It was started in 1994 as an educational tool for teaching coding in geometric modeling. Over the years, it has grown into a library used for both education and rapid prototyping of various geometric constructions, primarily Expo-Rational B-splines (or Blending Splines).

My involvement with the project began in 2008 as a part-time scientific assistant at Narvik University College. After completing my MSc studies, I was hired as an assistant professor and researcher in 2010, where I assumed the roles of maintainer and developer for the library.

Applications of blending splines in interactive geometric modeling

GMlib v1

The original library is primarily written in C++98, with various upgrades to support select C++11 features. It employs template metaprogramming to specify types and dimensions of generic containers and parameterized objects. Additionally, the library includes its own linear algebra core, application-specific containers, a scene graph structure, an OpenGL abstraction layer with a visualization framework for parametric objects, and a triangulation system framework with functionality supporting finite element method (FEM) analysis applications, among other features.

Applications of blending splines in interactive geometric modeling

The surrounding support software is based on the Qt application framework.

The library forms the basis for numerous articles in geometric modeling to date, particularly as the foundation for blending splines (or ERBS/GERBS). launch

GMlib v2

Unlike the original library, this version of GMlib uses the Qt application framework for all application, UX, and graphics-related components. This functionality is provided as an intermediary integration library. The library stack is written to support the latest C++ standards (currently C++20) and utilizes the Blaze C++ library for linear algebra, including vector and matrix representations. For mesh loading and topology structures, it uses the OpenMesh library.

Applications of blending splines in interactive geometric modeling

The primary application area of GMlib2 is prototyping constructions in differential geometry. Objects are organized hierarchically, and virtual data structures are shared across both objects and mathematical spaces. GMlib2 does not have a custom scene graph but supports object space chaining, enabling integration with any external scene graph.

GMlib 2 Background

Work on GMlib 2 began with the goal of creating a library that could use compile-time information to deduce details about embedded geometry constructions upon their creation. When these structures reach a certain level of complexity, the indexing rules needed for consistency become so intricate that they are often referred to as “index-magic” and are prone to human error in practical applications.

Applications of blending splines in interactive geometric modeling

This approach has proven to be both a significant challenge and a key factor in efficient prototyping of embedded geometrical objects. It enables consistent and safe handling of data indexing across various containers, object hierarchies, and both spatial and logical dimensions of embedded geometry, where relevant information is available at compile time. As a result, the compiler can report embedding errors at compile time rather than at runtime.

Sub-curve example

Example of parametric Hermite Curve defined in the parameter space (2D) of a torus and visualized in 3D.

Applications of blending splines in interactive geometric modeling

1  // Namespace shortening
2  namespace gm2  = gmlib2;
3  namespace gm2p = gm2::parametric;
4
5  // Construct helper types
6  using R3           = gm2::spaces::D3R3SpaceInfo⟨double⟩;

7  using ProjSpaceObj = gm2::ProjectiveSpaceObject⟨R3⟩;
8  using Torus        = gm2p::Torus⟨ProjSpaceObj⟩;
9  using SubCurve     = gm2p::SubCurveInSurface⟨gm2p::HermiteCurveP2V2, Torus, 
10                                              ProjSpaceObj⟩;
11 using SCPoint      = SubCurve::PSpaceObject_Point;
12 using SCVector     = SubCurve::PSpaceObject_Vector;
13
14 // Torus
15 auto torus = make_unique⟨Torus⟩( 3.0, 1.0, 1.0 );
16
17 // SubCurve in torus
18 auto const subcurve_p0 = SCPoint { 0.0,      0.0        };
19 auto const subcurve_p1 = SCPoint { 2 * M_PI, 1.5 * M_PI };
20 auto const subcurve_v0 = SCVector{ 20.0,     0.0        };
21 auto const subcurve_v1 = SCVector{ 2.0,      0.0        };

22 auto subcurve = make_unique⟨SubCurve⟩( torus.get(), 
23                                        subcurve_p0, subcurve_p1, 
24                                        subcurve_v0, subcurve_v1 );
                    

GMlib 2 Template Applications

The different GMlib versions comes with their own template applications. They are with environments specced with respect to educational purposes, prototyping, paper production, and legacy preferences.

GMlib 1 QmlDemo

  • GMlib 1 QmlDemo @ UiT (official) launch

GMlib 2 Template Demos

  • GMlib 2 Template Demos @ \me GitLab launch

Resources

GMlib is maintained by the R&D Simulations at UiT - Narvik.

The official repositories can be found at NeIC - Coderefinery.
  • GMlib repositories @ UiT (official) launch

A mirror of the repositories together with additional applications can be found at my GitLab repositories.