Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpNurbs.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * This class implements the Non Uniform Rational B-Spline (NURBS)
32 */
33
34#ifndef vpNurbs_H
35#define vpNurbs_H
36
43#include <visp3/core/vpBSpline.h>
44#include <visp3/core/vpImagePoint.h>
45#include <visp3/core/vpList.h>
46#include <visp3/core/vpMath.h>
47#include <visp3/core/vpMatrix.h>
48#include <visp3/me/vpMeSite.h>
49
50#include <list>
51
92class VISP_EXPORT vpNurbs : public vpBSpline
93{
94protected:
96 std::vector<double> weights;
97
98protected:
129 static vpMatrix computeCurveDers(double l_u, unsigned int l_i, unsigned int l_p, unsigned int l_der,
130 std::vector<double> &l_knots, std::vector<vpImagePoint> &l_controlPoints,
131 std::vector<double> &l_weights);
132
155 vpMatrix computeCurveDers(double u, unsigned int der);
156
157public:
164 vpNurbs();
165
169 vpNurbs(const vpNurbs &nurbs);
170
174 virtual ~vpNurbs();
175
182 inline void get_weights(std::list<double> &list) const
183 {
184 list.clear();
185 for (unsigned int i = 0; i < weights.size(); i++)
186 list.push_back(*(&(weights[0]) + i));
187 }
188
194 inline void set_weights(const std::list<double> &list)
195 {
196 weights.clear();
197 for (std::list<double>::const_iterator it = list.begin(); it != list.end(); ++it) {
198 weights.push_back(*it);
199 }
200 }
201
218 static vpImagePoint computeCurvePoint(double l_u, unsigned int l_i, unsigned int l_p, std::vector<double> &l_knots,
219 std::vector<vpImagePoint> &l_controlPoints, std::vector<double> &l_weights);
220
231
252 static vpImagePoint *computeCurveDersPoint(double l_u, unsigned int l_i, unsigned int l_p, unsigned int l_der,
253 std::vector<double> &l_knots, std::vector<vpImagePoint> &l_controlPoints,
254 std::vector<double> &l_weights);
255
269 vpImagePoint *computeCurveDersPoint(double u, unsigned int der);
270
288 static void curveKnotIns(double l_u, unsigned int l_k, unsigned int l_s, unsigned int l_r, unsigned int l_p,
289 std::vector<double> &l_knots, std::vector<vpImagePoint> &l_controlPoints,
290 std::vector<double> &l_weights);
291
304 void curveKnotIns(double u, unsigned int s = 0, unsigned int r = 1);
305
320 static void refineKnotVectCurve(double *l_x, unsigned int l_r, unsigned int l_p, std::vector<double> &l_knots,
321 std::vector<vpImagePoint> &l_controlPoints, std::vector<double> &l_weights);
322
333 void refineKnotVectCurve(double *x, unsigned int r);
334
361 static unsigned int removeCurveKnot(double l_u, unsigned int l_r, unsigned int l_num, double l_TOL, unsigned int l_s,
362 unsigned int l_p, std::vector<double> &l_knots,
363 std::vector<vpImagePoint> &l_controlPoints, std::vector<double> &l_weights);
364
386 unsigned int removeCurveKnot(double l_u, unsigned int l_r, unsigned int l_num, double l_TOL);
387
401 static void globalCurveInterp(std::vector<vpImagePoint> &l_crossingPoints, unsigned int l_p,
402 std::vector<double> &l_knots, std::vector<vpImagePoint> &l_controlPoints,
403 std::vector<double> &l_weights);
404
415 void globalCurveInterp(vpList<vpMeSite> &l_crossingPoints);
416
427 void globalCurveInterp(const std::list<vpImagePoint> &l_crossingPoints);
428
439 void globalCurveInterp(const std::list<vpMeSite> &l_crossingPoints);
440
448 void globalCurveInterp();
449
467 static void globalCurveApprox(std::vector<vpImagePoint> &l_crossingPoints, unsigned int l_p, unsigned int l_n,
468 std::vector<double> &l_knots, std::vector<vpImagePoint> &l_controlPoints,
469 std::vector<double> &l_weights);
485 void globalCurveApprox(vpList<vpMeSite> &l_crossingPoints, unsigned int n);
486
501 void globalCurveApprox(const std::list<vpImagePoint> &l_crossingPoints, unsigned int n);
502
518 void globalCurveApprox(const std::list<vpMeSite> &l_crossingPoints, unsigned int n);
519
529 void globalCurveApprox(unsigned int n);
530};
531
532#endif
Class that provides tools to compute and manipulate a B-Spline curve.
Definition vpBSpline.h:106
static vpImagePoint computeCurvePoint(double l_u, unsigned int l_i, unsigned int l_p, std::vector< double > &l_knots, std::vector< vpImagePoint > &l_controlPoints)
static vpImagePoint * computeCurveDers(double l_u, unsigned int l_i, unsigned int l_p, unsigned int l_der, std::vector< double > &l_knots, std::vector< vpImagePoint > &l_controlPoints)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Provide simple list management.
Definition vpList.h:108
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:152
Class that provides tools to compute and manipulate a Non Uniform Rational B-Spline curve.
Definition vpNurbs.h:93
void get_weights(std::list< double > &list) const
Definition vpNurbs.h:182
std::vector< double > weights
Vector which contains the weights associated to each control Points.
Definition vpNurbs.h:96
void set_weights(const std::list< double > &list)
Definition vpNurbs.h:194