oysteinmyrmo / bezier Goto Github PK
View Code? Open in Web Editor NEWBezier is a single header only C++ library for Bezier curve calculations and manipulations.
License: MIT License
Bezier is a single header only C++ library for Bezier curve calculations and manipulations.
License: MIT License
bezier/include/bezier/bezier.h:62:9: error: array must be initialized with a brace-enclosed initializer
p = cubicBezier.valueAt(0); // (120, 60)
should be
p = cubicBezier.valueAt(0); // (120, 160)
Tests won't compile!
(I am new to C++. Am I doing something wrong?)
nacl@laptop:~/thinz/bezier-master$ cmake .
-- The C compiler identification is GNU 10.1.0
-- The CXX compiler identification is GNU 10.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nacl/thinz/bezier-master
nacl@laptop:~/thinz/bezier-master$ make
Scanning dependencies of target derivative-tests
[ 25%] Building CXX object tests/CMakeFiles/derivative-tests.dir/derivative-tests.cpp.o
In file included from /home/nacl/thinz/bezier-master/tests/derivative-tests.cpp:22:
/home/nacl/thinz/bezier-master/include/bezier.h: In member function ‘float Bezier::Vec2::operator[](size_t) const’:
/home/nacl/thinz/bezier-master/include/bezier.h:255:29: error: ‘stderr’ was not declared in this scope
255 | fprintf(stderr, "Erroneous axis: " BEZIER_SIZE_T_FORMAT ". Returning 0.\n", axis);
| ^~~~~~
/home/nacl/thinz/bezier-master/include/bezier.h:28:1: note: ‘stderr’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
27 | #include <array>
+++ |+#include <cstdio>
28 |
/home/nacl/thinz/bezier-master/include/bezier.h:255:21: error: ‘fprintf’ was not declared in this scope; did you mean ‘rintf’?
255 | fprintf(stderr, "Erroneous axis: " BEZIER_SIZE_T_FORMAT ". Returning 0.\n", axis);
| ^~~~~~~
| rintf
/home/nacl/thinz/bezier-master/include/bezier.h: In member function ‘float& Bezier::Vec2::operator[](size_t)’:
/home/nacl/thinz/bezier-master/include/bezier.h:270:29: error: ‘stderr’ was not declared in this scope
270 | fprintf(stderr, "Erroneous axis: " BEZIER_SIZE_T_FORMAT ". Returning x.\n", axis);
| ^~~~~~
/home/nacl/thinz/bezier-master/include/bezier.h:270:29: note: ‘stderr’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
/home/nacl/thinz/bezier-master/include/bezier.h:270:21: error: ‘fprintf’ was not declared in this scope; did you mean ‘rintf’?
270 | fprintf(stderr, "Erroneous axis: " BEZIER_SIZE_T_FORMAT ". Returning x.\n", axis);
| ^~~~~~~
| rintf
/home/nacl/thinz/bezier-master/include/bezier.h: At global scope:
/home/nacl/thinz/bezier-master/include/bezier.h:632:19: error: declaration of template parameter ‘N’ shadows template parameter
632 | template <size_t N>
| ^~~~~~
/home/nacl/thinz/bezier-master/include/bezier.h:628:15: note: template parameter ‘N’ declared here
628 | template <size_t N>
| ^~~~~~
tests/CMakeFiles/derivative-tests.dir/build.make:62: recipe for target 'tests/CMakeFiles/derivative-tests.dir/derivative-tests.cpp.o' failed
make[2]: *** [tests/CMakeFiles/derivative-tests.dir/derivative-tests.cpp.o] Error 1
CMakeFiles/Makefile2:87: recipe for target 'tests/CMakeFiles/derivative-tests.dir/all' failed
make[1]: *** [tests/CMakeFiles/derivative-tests.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2
When adding #include <cstdio>
to bezier.h :
nacl@laptop:~/thinz/bezier-master$ make
Scanning dependencies of target derivative-tests
[ 25%] Building CXX object tests/CMakeFiles/derivative-tests.dir/derivative-tests.cpp.o
In file included from /home/nacl/thinz/bezier-master/tests/derivative-tests.cpp:22:
/home/nacl/thinz/bezier-master/include/bezier.h:633:19: error: declaration of template parameter ‘N’ shadows template parameter
633 | template <size_t N>
| ^~~~~~
/home/nacl/thinz/bezier-master/include/bezier.h:629:15: note: template parameter ‘N’ declared here
629 | template <size_t N>
| ^~~~~~
tests/CMakeFiles/derivative-tests.dir/build.make:62: recipe for target 'tests/CMakeFiles/derivative-tests.dir/derivative-tests.cpp.o' failed
make[2]: *** [tests/CMakeFiles/derivative-tests.dir/derivative-tests.cpp.o] Error 1
CMakeFiles/Makefile2:87: recipe for target 'tests/CMakeFiles/derivative-tests.dir/all' failed
make[1]: *** [tests/CMakeFiles/derivative-tests.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2
I would like to calculate Bezier in the runtime as:
Bezier::Bezier<path.rows()> cubicBezier({ }); where path.rows() is the number of 2D point. However, it does not allow me to do so. Could you help about that issue? Can't we assign this in the runtime?
Thanks in advance
Hei Øystein!
Unnskyld, jeg vet dette er et gammelt prosjekt, man hvordan finner jeg midpointten av kurven?
If this functionality is not yet available, I'll figure it out and send a PR!
(Please excuse my Norsk, I am still learning!)
Rich
I created a cubic Bézier curve, how should I extract the points on the curve, I want to use it for path planning
It doesn't seem like there is any documentation for this library. I guess I'll just try to figure it out, but it would be great if you could add some documentation.
I see you have created a workflow file. This is very good :)
May I suggest you add a problem matcher. Then warnings will show in PRs like this https://github.com/githubdoe/DFTFringe/pull/60/files
For GCC this one works great https://github.com/ammaraskar/gcc-problem-matcher but you should probably have one per compiler
👍👍👍
your code is used in https://github.com/githubdoe/DFTFringe and I'm currently trying to fix all warning in the code.
When using newer compiler, I get following warning :
warning: implicitly-declared 'Bezier::Vec2& Bezier::Vec2::operator=(const Bezier::Vec2&)' is deprecated [-Wdeprecated-copy]
This is because the code does not respect the rule of 3/5/0
https://en.cppreference.com/w/cpp/language/rule_of_three
If you consider a fix I will happily integrate it to our code
how to find the 30% of the total line curve length.
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.