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
73fee04e
Commit
73fee04e
authored
5 years ago
by
JasonChmn
Browse files
Options
Downloads
Patches
Plain Diff
Edit doc deCastelJau algorithm in bezier curve
parent
9e512773
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/curves/bezier_curve.h
+11
-3
11 additions, 3 deletions
include/curves/bezier_curve.h
with
11 additions
and
3 deletions
include/curves/bezier_curve.h
+
11
−
3
View file @
73fee04e
...
...
@@ -218,7 +218,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// Warning: the horner scheme is about 100 times faster than this method.<br>
/// This method will probably be removed in the future as the computation of bernstein polynomial is very costly.
/// \param t : time when to evaluate the curve.
/// \return \f$x(t)\f$
,
point corresponding on curve at time t.
/// \return \f$x(t)\f$ point corresponding on curve at time t.
///
point_t
evalBernstein
(
const
Numeric
t
)
const
{
...
...
@@ -241,7 +241,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// Using Horner's method, the polynom is transformed into : <br>
/// \f$x(t) = a_0 + t(a_1 + t(a_2+t(...))\f$ with N additions and multiplications.
/// \param t : time when to evaluate the curve.
/// \return \f$x(t)\f$
,
point corresponding on curve at time t.
/// \return \f$x(t)\f$ point corresponding on curve at time t.
///
point_t
evalHorner
(
const
Numeric
t
)
const
{
...
...
@@ -264,8 +264,11 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
const
t_point_t
&
waypoints
()
const
{
return
pts_
;}
/// \brief Evaluate the curve value at time t using deCasteljau algorithm.
/// The algorithm will compute the \f$N-1\f$ centroids of parameters \f${t,1-t}\f$ of consecutive \f$N\f$ control points
/// of bezier curve, and perform it iteratively until getting one point in the list which will be the evaluation of bezier
/// curve at time \f$t\f$.
/// \param t : time when to evaluate the curve.
/// \return \f$x(t)\f$
,
point corresponding on curve at time t.
/// \return \f$x(t)\f$ point corresponding on curve at time t.
///
point_t
evalDeCasteljau
(
const
Numeric
t
)
const
{
// normalize time :
...
...
@@ -277,11 +280,16 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
return
pts
[
0
]
*
mult_T_
;
}
t_point_t
deCasteljauReduction
(
const
Numeric
t
)
const
{
return
deCasteljauReduction
(
waypoints
(),
t
/
T_
);
}
/// \brief Compute de Casteljau's reduction of the given list of points at time t.
/// For the list \f$pts\f$ of N points, compute a new list of points of size N-1 :<br>
/// \f$<br>( pts[0]*(1-t)+pts[1], pts[1]*(1-t)+pts[2], ..., pts[0]*(N-2)+pts[N-1] )\f$<br>
/// with t the time when to evaluate bezier curve.<br>\
/// The new list contains centroid of parameters \f${t,1-t}\f$ of consecutive points in the list.
/// \param pts : list of points.
/// \param u : NORMALIZED time when to evaluate the curve.
/// \return Reduced list of point (size of pts - 1).
...
...
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