|
 |
Unsure if we'd like to use external libraries, or roll our own, so that there
are no future licensing issues...
For a full C++ implementation of NURBS (Non-Uniform Rational B-Splines), there
are several well-maintained libraries you can explore. Here's a breakdown of the
most notable ones, including the files typically involved and example code
snippets:
✅ Recommended Library: TinyNURBS
GitHub: tinynurbs
License: BSD-3-Clause
Features: [github.com]
Header-only C++14 library
Supports rational and non-rational curves/surfaces
Knot insertion, evaluation, derivatives
OBJ I/O support
Key Files:
Dependencies:
https://github.com/g-truc/glm (OpenGL Mathematics library)
Example Usage:
C++#include <tinynurbs/curve.h>#include <glm/glm.hpp>tinynurbs::Curve<float>
crv;crv.control_points = {glm::vec3(-1, 0, 0), glm::vec3(0, 1, 0), glm::vec3(1,
0, 0)};crv.knots = {0, 0, 0, 1, 1, 1};crv.degree = 2;if
(!tinynurbs::curveIsValid(crv)) { std::cerr << "Invalid curve configuration!"
<< std::endl;}glm::vec3 pt = tinynurbs::curvePoint(crv, 0.5f);Show more lines
🧠 Advanced Option: libnurbs
Docs: libnurbs on DeepWiki
License: Modified BSD
Features: [deepwiki.com]
Full NURBS curve and surface evaluation
Knot insertion/removal
Degree elevation/reduction
Parameter search via BFGS
Serialization and visualization tools
Key Files:
🧰 Legacy Option: NURBS++
Website: libnurbs.sourceforge.net
License: LGPL
Includes: [libnurbs.s...eforge.net]
Matrix and numerical libraries
NURBS curve/surface manipulation
Older codebase, but still functional
Post a reply to this message
|
 |