Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
curves
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jason Chemin
curves
Commits
a0527d5d
Commit
a0527d5d
authored
8 years ago
by
Steve Tonneau
Committed by
Steve Tonneau
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cubic_spline inherits spline_curve
parent
d1757d2a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/spline/cubic_function.h
+24
-34
24 additions, 34 deletions
include/spline/cubic_function.h
with
24 additions
and
34 deletions
include/spline/cubic_function.h
+
24
−
34
View file @
a0527d5d
...
...
@@ -16,7 +16,7 @@
#include
"MathDefs.h"
#include
"curve
_abc
.h"
#include
"
spline_
curve.h"
#include
<stdexcept>
...
...
@@ -28,23 +28,30 @@ namespace spline
/// x(t) = a + b(t - t_min_) + c(t - t_min_)^2 + d(t - t_min_)^3
///
template
<
typename
Time
=
double
,
typename
Numeric
=
Time
,
std
::
size_t
Dim
=
3
,
bool
Safe
=
false
,
typename
Point
=
Eigen
::
Matrix
<
Numeric
,
Dim
,
1
>
>
struct
cubic_function
:
public
curve
_abc
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
>
,
typename
Point
=
Eigen
::
Matrix
<
Numeric
,
Dim
,
1
>
,
typename
T_Point
=
std
::
vector
<
Point
,
Eigen
::
aligned_allocator
<
Point
>
>
>
struct
cubic_function
:
public
spline_
curve
<
Time
,
Numeric
,
Dim
,
3
,
Safe
,
Point
,
T_
Point
>
{
typedef
Point
point_t
;
typedef
T_Point
t_point_t
;
typedef
Time
time_t
;
typedef
Numeric
num_t
;
typedef
Numeric
num_t
;
typedef
spline_curve
<
Time
,
Numeric
,
Dim
,
3
,
Safe
,
Point
,
T_Point
>
spline_curve_t
;
/* Constructors - destructors */
public:
///\brief Constructor
cubic_function
(
point_t
const
&
a
,
point_t
const
&
b
,
point_t
const
&
c
,
point_t
const
&
d
,
time_t
min
,
time_t
max
)
:
a_
(
a
),
b_
(
b
),
c_
(
c
),
d_
(
d
),
t_min_
(
min
),
t_max_
(
max
)
{
if
(
t_min_
>
t_max_
&&
Safe
)
{
std
::
out_of_range
(
"TODO"
);
}
}
:
spline_curve_t
(
makeVector
(
a
,
b
,
c
,
d
),
min
,
max
)
{}
///\brief Constructor
cubic_function
(
const
T_Point
&
coefficients
,
time_t
min
,
time_t
max
)
:
spline_curve_t
(
coefficients
,
min
,
max
)
{}
///\brief Constructor
template
<
typename
In
>
cubic_function
(
In
zeroOrderCoefficient
,
In
out
,
time_t
min
,
time_t
max
)
:
spline_curve_t
(
zeroOrderCoefficient
,
out
,
min
,
max
)
{}
///\brief Destructor
~
cubic_function
()
...
...
@@ -57,32 +64,15 @@ struct cubic_function : public curve_abc<Time, Numeric, Dim, Safe, Point>
cubic_function
&
operator
=
(
const
cubic_function
&
);
/* Constructors - destructors */
/*Operations*/
public
:
/// \brief Evaluation of the cubic spline at time t.
/// \param t : the time when to evaluate the spine
/// \param return : the value x(t)
virtual
point_t
operator
()(
time_t
t
)
const
/*Operations*/
T_Point
makeVector
(
point_t
const
&
a
,
point_t
const
&
b
,
point_t
const
&
c
,
point_t
const
&
d
)
{
if
((
t
<
t_min_
||
t
>
t_max_
)
&&
Safe
){
throw
std
::
out_of_range
(
"TODO"
);}
time_t
const
dt
(
t
-
t_min_
);
return
a_
+
b_
*
dt
+
c_
*
dt
*
dt
+
d_
*
dt
*
dt
*
dt
;
T_Point
res
;
res
.
push_back
(
a
);
res
.
push_back
(
b
);
res
.
push_back
(
c
);
res
.
push_back
(
d
);
return
res
;
}
/*Operations*/
/*Helpers*/
public
:
/// \brief Returns the minimum time for wich curve is defined
num_t
virtual
min
()
const
{
return
t_min_
;}
/// \brief Returns the maximum time for wich curve is defined
num_t
virtual
max
()
const
{
return
t_max_
;}
/*Helpers*/
/*Attributes*/
public
:
const
point_t
a_
,
b_
,
c_
,
d_
;
const
time_t
t_min_
,
t_max_
;
/*Attributes*/
/*Operations*/
};
//class CubicFunction
}
#endif //_STRUCT_CUBICFUNCTION
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment