Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
ndcurves
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
loco-3d
ndcurves
Commits
39e5e9dc
Commit
39e5e9dc
authored
4 years ago
by
Pierre Fernbach
Browse files
Options
Downloads
Patches
Plain Diff
Curve conversion: check if the degree of the input is <= 3
parent
1fd24d45
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/curves/curve_conversion.h
+5
-1
5 additions, 1 deletion
include/curves/curve_conversion.h
with
5 additions
and
1 deletion
include/curves/curve_conversion.h
+
5
−
1
View file @
39e5e9dc
...
...
@@ -36,6 +36,8 @@ Polynomial polynomial_from_curve(const typename Polynomial::curve_abc_t& curve)
/// \return the equivalent cubic bezier curve.
template
<
typename
Bezier
>
Bezier
bezier_from_curve
(
const
typename
Bezier
::
curve_abc_t
&
curve
)
{
if
(
curve
.
degree
()
>
3
)
throw
std
::
invalid_argument
(
"bezier_from_curve is only implemented for curves of degree <= 3."
);
typedef
typename
Bezier
::
point_t
point_t
;
typedef
typename
Bezier
::
t_point_t
t_point_t
;
typedef
typename
Bezier
::
num_t
num_t
;
...
...
@@ -68,6 +70,8 @@ Bezier bezier_from_curve(const typename Bezier::curve_abc_t& curve) {
/// \return the equivalent cubic hermite spline.
template
<
typename
Hermite
>
Hermite
hermite_from_curve
(
const
typename
Hermite
::
curve_abc_t
&
curve
)
{
if
(
curve
.
degree
()
>
3
)
throw
std
::
invalid_argument
(
"hermite_from_curve is only implemented for curves of degree <= 3."
);
typedef
typename
Hermite
::
pair_point_tangent_t
pair_point_tangent_t
;
typedef
typename
Hermite
::
t_pair_point_tangent_t
t_pair_point_tangent_t
;
typedef
typename
Hermite
::
point_t
point_t
;
...
...
@@ -91,4 +95,4 @@ Hermite hermite_from_curve(const typename Hermite::curve_abc_t& curve) {
return
Hermite
(
control_points
.
begin
(),
control_points
.
end
(),
time_control_points
);
}
}
// namespace curves
#endif //_CLASS_CURVE_CONVERSION
\ No newline at end of file
#endif //_CLASS_CURVE_CONVERSION
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