#include <visp3/ustk_core/usPolynomialCurve3D.h>
#include <vector>
#include <visp3/core/vpColVector.h>
#include <visp3/core/vpHomogeneousMatrix.h>
#include <visp3/core/vpMatrix.h>
int main()
{
std::cout << "Start testUsPolynomialCurve3D" << std::endl;
std::cout << "done: usPolynomialCurve3D default contructor" << std::endl;
std::cout << "done: usPolynomialCurve3D contructor with inital order" << std::endl;
std::cout << "done: usPolynomialCurve3D copy contructor" << std::endl;
curveDefault = curve;
std::cout << "done: usPolynomialCurve3D assignment operator" << std::endl;
std::cout << "done: usPolynomialCurve3D::setOrder" << std::endl;
std::cout << "done: usPolynomialCurve3D::getOrder" << std::endl;
std::cout << "done: usPolynomialCurve3D::setStartParameter" << std::endl;
std::cout << "done: usPolynomialCurve3D::getStartParameter" << std::endl;
std::cout << "done: usPolynomialCurve3D::setEndParameter" << std::endl;
std::cout << "done: usPolynomialCurve3D::getEndParameter" << std::endl;
std::cout << "done: usPolynomialCurve3D::setBoundaries" << std::endl;
vpMatrix M(3, 4, 0.1);
std::cout << "done: usPolynomialCurve3D::setPolynomialCoefficients" << std::endl;
std::cout << "done: usPolynomialCurve3D::getPolynomialCoefficients" << std::endl;
std::cout << "done: usPolynomialCurve3D::setParametricLength" << std::endl;
std::cout << "done: usPolynomialCurve3D::getParametricLength" << std::endl;
std::cout << "done: usPolynomialCurve3D::setLength" << std::endl;
std::cout << "done: usPolynomialCurve3D::getLength" << std::endl;
vpColVector point = curve.
getPoint(0.25);
std::cout << "done: usPolynomialCurve3D::getPoint" << std::endl;
vpColVector params(5, 0);
for (int i = 0; i < 5; i++)
params[i] = 0.1 * i;
std::cout << "done: usPolynomialCurve3D::getPoints" << std::endl;
std::cout << "done: usPolynomialCurve3D::getStartPoint" << std::endl;
std::cout << "done: usPolynomialCurve3D::getEndPoint" << std::endl;
std::cout << "done: usPolynomialCurve3D::getTangent" << std::endl;
std::cout << "done: usPolynomialCurve3D::getStartTangent" << std::endl;
std::cout << "done: usPolynomialCurve3D::getEndTangent" << std::endl;
std::cout << "done: usPolynomialCurve3D::.getDerivative" << std::endl;
std::vector<vpColVector> points1(3, vpColVector(3, 0));
points1.at(1)[0] = 1;
points1.at(2)[1] = 1;
std::vector<double> params1(3, 0);
for (int i = 0; i < 3; i++)
params1[i] = i;
std::vector<vpColVector> points2(4, vpColVector(3, 0));
points2.at(1)[0] = 1;
points2.at(2)[1] = 2;
points2.at(3)[2] = 1;
std::vector<double> params2(4, 0);
for (int i = 0; i < 4; i++)
params2[i] = i;
std::vector<vpColVector> points3(10, vpColVector(3, 0));
points3.at(1)[0] = 1;
points3.at(2)[1] = 2;
points3.at(3)[2] = 3;
points3.at(4)[1] = 1;
points3.at(5)[1] = 2;
points3.at(6)[2] = 3;
points3.at(7)[0] = 1;
points3.at(8)[0] = 2;
points3.at(9)[0] = 2;
points3.at(7)[1] = 2;
points3.at(8)[1] = 2;
points3.at(9)[2] = 2;
std::vector<double> params3(10, 0);
for (int i = 0; i < 10; i++)
params3[i] = i;
std::vector<double> weights3(10);
for (int i = 0; i < 10; i++)
weights3[i] = 1 + 0.2 * (i % 3 - 1);
vpMatrix point3M(3, 10);
for (int i = 0; i < 10; i++)
point3M.insert(points3.at(i), 0, i);
vpColVector params3V(10);
for (int i = 0; i < 10; i++)
params3V[i] = params3.at(i);
vpColVector weights3V(10);
for (int i = 0; i < 10; i++)
weights3V[i] = weights3.at(i);
std::cout << "done: case 1 usPolynomialCurve3D::defineFromPoints(const std::vector<vpColVector> &points, const "
"std::vector<double> ¶m, unsigned int order)"
<< std::endl;
std::cout << "done: case 2 usPolynomialCurve3D::defineFromPoints(const std::vector<vpColVector> &points, const "
"std::vector<double> ¶m, unsigned int order)"
<< std::endl;
std::cout << "done: case 3 usPolynomialCurve3D::defineFromPoints(const std::vector<vpColVector> &points, const "
"std::vector<double> ¶m, unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::defineFromPoints(const vpMatrix points, const vpColVector ¶m, unsigned "
"int order)"
<< std::endl;
std::cout
<< "done: usPolynomialCurve3D::defineFromPointsAuto(const std::vector<vpColVector> &points, unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::defineFromPointsAuto(const vpMatrix &points, unsigned int order)"
<< std::endl;
vpColVector direction(3, 0);
direction[0] = 1;
std::cout << "done: usPolynomialCurve3D::defineFromPointsAuto(const std::vector<vpColVector> &points, const "
"vpColVector &direction, unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::defineFromPointsAuto(const vpMatrix &points, const vpColVector &direction, "
"unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::defineFromWeightedPoints(const std::vector<vpColVector> &points, const "
"std::vector<double> ¶m, const std::vector<double> &weights, unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::defineFromWeightedPoints(const vpMatrix &points, const vpColVector ¶m, "
"const vpColVector &weights, unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::defineFromWeightedPointsAuto(const std::vector<vpColVector> &points, const "
"std::vector<double> &weights, unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::defineFromWeightedPointsAuto(const vpMatrix &points, const vpColVector "
"&weights, unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::defineFromWeightedPointsAuto(const std::vector<vpColVector> &points, const "
"std::vector<double> &weights, const vpColVector &direction, unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::defineFromWeightedPointsAuto(const vpMatrix &points, const vpColVector "
"&weights, const vpColVector &direction, unsigned int order)"
<< std::endl;
std::cout << "done: usPolynomialCurve3D::getCurvature" << std::endl;
std::cout << "done: usPolynomialCurve3D::getMeanAxisDeviation" << std::endl;
std::cout << "done: usPolynomialCurve3D::getControlPoints" << std::endl;
std::cout << "done: usPolynomialCurve3D::setControlPoints(const vpMatrix&)" << std::endl;
std::cout << "done: usPolynomialCurve3D::setControlPoints(double**)" << std::endl;
std::cout << "done: usPolynomialCurve3D::getRenderingPoints" << std::endl;
std::cout << "done: usPolynomialCurve3D::getSubPolynomialCurve" << std::endl;
std::cout << "done: case 1 usPolynomialCurve3D::getNewOrderPolynomialCurve" << std::endl;
std::cout << "done: case 2 usPolynomialCurve3D::getNewOrderPolynomialCurve" << std::endl;
std::cout << "done: usPolynomialCurve3D::changeCoefficientsToFitBoundaries" << std::endl;
std::cout << "done: usPolynomialCurve3D::reverse" << std::endl;
std::cout << "done: usPolynomialCurve3D::changeCoefficientsToFitMetricLength" << std::endl;
curve.
move(vpHomogeneousMatrix(0.5, -0.25, 0.1, 1, -1, 0.2));
std::cout << "done: usPolynomialCurve3D::move(const vpHomogeneousMatrix&)" << std::endl;
curve.
move(0.5, -0.25, 0.1, 1, -1, 0.2);
std::cout << "done: usPolynomialCurve3D::move(double,double,double,double,double,double)" << std::endl;
std::cout << "done: usPolynomialCurve3D::scale" << std::endl;
return 0;
}
vpColVector getDerivative(double parameter, unsigned int order) const
void defineFromPoints(const std::vector< vpColVector > &points, const std::vector< double > ¶m, unsigned int order=0)
vpMatrix getControlPoints() const
vpColVector getStartTangent() const
vpMatrix getRenderingPoints() const
usPolynomialCurve3D getSubPolynomialCurve(double startParameter, double endParameter) const
usPolynomialCurve3D getNewOrderPolynomialCurve(unsigned int order) const
void setStartParameter(double startParameter)
double getLength(int nbCountSeg=50) const
void defineFromWeightedPoints(const std::vector< vpColVector > &points, const std::vector< double > ¶m, const std::vector< double > &weights, unsigned int order=0)
vpColVector getTangent(double parameter) const
unsigned int getOrder() const
vpColVector getPoint(double parameter) const
double getMeanAxisDeviation(int nbCountSeg=50) const
double getStartParameter() const
vpMatrix getPoints(const vpColVector ¶meters) const
void setParametricLength(double length)
void setPolynomialCoefficients(const vpMatrix &polynomialCoefficients)
vpColVector getEndPoint() const
vpMatrix getPolynomialCoefficients() const
void setLength(double length, double precision=1e-4)
void setOrder(unsigned int order)
void move(const vpHomogeneousMatrix &H)
vpColVector getEndTangent() const
void defineFromWeightedPointsAuto(const std::vector< vpColVector > &points, const std::vector< double > &weights, unsigned int order=0)
void changeCoefficientsToFitMetricLength()
void setControlPoints(const vpMatrix &controlPoints)
void defineFromPointsAuto(const std::vector< vpColVector > &points, unsigned int order=0)
double getParametricLength() const
void changeCoefficientsToFitBoundaries(double startParameter, double endParameter)
void setEndParameter(double endParameter)
double getEndParameter() const
vpColVector getStartPoint() const
void setBoundaries(double startParameter, double endParamter)
double getCurvature(double param) const