File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Copyright 2025 Lukas Hrazky
2+ //
3+ // This file is part of the Refloat VESC package.
4+ //
5+ // Refloat VESC package is free software: you can redistribute it and/or modify
6+ // it under the terms of the GNU General Public License as published by the
7+ // Free Software Foundation, either version 3 of the License, or (at your
8+ // option) any later version.
9+ //
10+ // Refloat VESC package is distributed in the hope that it will be useful, but
11+ // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12+ // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13+ // more details.
14+ //
15+ // You should have received a copy of the GNU General Public License along with
16+ // this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+ #include "transitions.h"
19+
20+ #define check_and_return (x ) \
21+ do { \
22+ if (x < 0.0f) { \
23+ return 0.0f; \
24+ } else if (x > 1.0f) { \
25+ return 1.0f; \
26+ } \
27+ } while (0)
28+
29+ float smoothstep (float x ) {
30+ check_and_return (x );
31+ return x * x * (3.0f - 2.0f * x );
32+ }
33+
34+ float smootherstep (float x ) {
35+ check_and_return (x );
36+ return x * x * x * (x * (x * 6.0f - 15.0f ) + 10.0f );
37+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2025 Lukas Hrazky
2+ //
3+ // This file is part of the Refloat VESC package.
4+ //
5+ // Refloat VESC package is free software: you can redistribute it and/or modify
6+ // it under the terms of the GNU General Public License as published by the
7+ // Free Software Foundation, either version 3 of the License, or (at your
8+ // option) any later version.
9+ //
10+ // Refloat VESC package is distributed in the hope that it will be useful, but
11+ // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12+ // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13+ // more details.
14+ //
15+ // You should have received a copy of the GNU General Public License along with
16+ // this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+ #pragma once
19+
20+ float smoothstep (float x );
21+
22+ float smootherstep (float x );
You can’t perform that action at this time.
0 commit comments