Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
ndcurves
Commits
6dc8debd
Commit
6dc8debd
authored
Feb 08, 2019
by
Steve T
Committed by
stevet
Feb 08, 2019
Browse files
removed switch in operator()
parent
54643e34
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/hpp/spline/bezier_curve.h
View file @
6dc8debd
...
...
@@ -139,37 +139,10 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// \param t : the time when to evaluate the spine
/// \param return : the value x(t)
virtual
point_t
operator
()(
const
time_t
t
)
const
{
num_t
nT
=
t
/
T_
;
if
(
Safe
&!
(
0
<=
t
&&
t
<=
T_
))
{
throw
std
::
out_of_range
(
"can't evaluate bezier curve, out of range"
);
// TODO
}
else
{
num_t
dt
=
(
1
-
nT
);
switch
(
size_
)
{
case
1
:
return
mult_T_
*
pts_
[
0
];
case
2
:
return
mult_T_
*
(
pts_
[
0
]
*
dt
+
nT
*
pts_
[
1
]);
break
;
case
3
:
return
mult_T_
*
(
pts_
[
0
]
*
dt
*
dt
+
2
*
pts_
[
1
]
*
nT
*
dt
+
pts_
[
2
]
*
nT
*
nT
);
break
;
case
4
:
return
mult_T_
*
(
pts_
[
0
]
*
dt
*
dt
*
dt
+
3
*
pts_
[
1
]
*
nT
*
dt
*
dt
+
3
*
pts_
[
2
]
*
nT
*
nT
*
dt
+
pts_
[
3
]
*
nT
*
nT
*
nT
);
default
:
return
evalHorner
(
t
);
break
;
}
}
if
(
Safe
&!
(
0
<=
t
&&
t
<=
T_
))
throw
std
::
out_of_range
(
"can't evaluate bezier curve, out of range"
);
// TODO
return
evalHorner
(
t
);
}
/// \brief Computes the derivative curve at order N.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment