ncar / bspline Goto Github PK
View Code? Open in Web Editor NEWCubic B-Spline implementation in C++ templates
License: Other
Cubic B-Spline implementation in C++ templates
License: Other
BSpline and BSplineBase have destructors defined, but do not have all copy/move/assignment operators defined.
Putting splines into a container that may choose to copy them therefore is dangerous, as copying a BSpline will leave the copy with a deleted spline if the original spline object goes out of scope.
Refer to this:
https://en.cppreference.com/w/cpp/language/rule_of_three
I suggest replacing the use of raw pointers for BSplineBase::base and BSpline::s with std::unique_ptr, and then defining copy and move constructors and assignment operators. Any operator not explicitly defined would then be implicitly deleted as a result of holding a std::unique_ptr, so a compile time error would be generated for unsupported copy/move/assignment operations instead of a runtime segfault/access violation.
Hi There,
I try to test the bspline algorithm from this project.
I tested with visual studio 2013, it works.
Now I try to compline it with g++ (g++ (GCC) 6.1.1 20160501) in linux OS. It did compile.
Please help. Appreciate it very much.
Sam
Hereby the error msg from the compiler.
**>
**> g++ -c -Wall -march=armv7-a -O2 -DNDEBUG -MMD -I Src -I Src/bspline Src/bspline/BSplineLib.cpp -o obj/Src/bspline/BSplineLib.o
mkdir -p obj/Src/bspline/
g++ -c -Wall -march=armv7-a -O2 -DNDEBUG -MMD -I Src -I Src/bspline Src/bspline/BSpline.cpp -o obj/Src/bspline/BSpline.o
Src/bspline/BSpline.cpp: In member function 'bool BSpline::solve(const T*)':
Src/bspline/BSpline.cpp:110:18: error: 'my' has not been declared
for (m = my::max(0, mx-1); m <= my::min(mx+2, M); ++m) {
^~
Src/bspline/BSpline.cpp:110:41: error: 'my' has not been declared
for (m = my::max(0, mx-1); m <= my::min(mx+2, M); ++m) {
^~****
I suggest adding topics such as spline
, splines
, b-spline
in the About section at https://github.com/NCAR/bspline.
float* x = new float[8] { 0.f, 5.f, 10.f, 15.f, 20.f, 25.f, 30.f, 35.f};
float* y = new float[8]{ 2.f, 4.f, 6.f, 8.f, 0.f, 6.f, 9.f, 4.f};
BSpline<float> bSpline(x, 8, y, 30.0);
bool ok = bSpline.ok();
float rez = bSpline.evaluate(2.f);
ok
is false
whenever I put anything other then 0 for wl
and whenever ok
is false
, rez
is 0.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.