3 #ifndef __base_splines_hpp
4 #define __base_splines_hpp
9 #include "parspline.hpp"
13 #define U3D_EPSILON 1.e-6
14 #define EQUAL_REALS(a,b) ( (fabs((a)-(b)) < U3D_EPSILON ? true : false) )
18 #define U3D_BASE_MSG_LEN 2048
25 static void info(
const char* format, ...);
28 static void warning(
const char* format, ...);
31 static void error(
const char* format, ...);
34 static void debug(
const char* format, ...);
96 void setXYZ (
double x,
double y,
double z);
102 void setY (
double y);
105 void setZ (
double z);
120 : fX(0.0), fY(0.0), fZ(0.0)
126 : fX(p.getX()), fY(p.getY()), fZ(p.getZ())
132 : fX(x), fY(y), fZ(z)
196 typedef vector<Spl_U3dPoint*> Spl_U3dPointsAr;
197 typedef vector<Spl_U3dPointsAr> Spl_U3dPointsMatrix;
212 typedef std::vector<double> Spl_U3dMathDArray;
215 typedef std::vector<Spl_U3dMathDArray> Spl_U3dMathDMatrix;
230 static void matrix4x4Mul(
const double (&m1)[4][4],
const double (&m2)[4][4],
double (&m3)[4][4],
231 bool tr1 =
false,
bool tr2 =
false);
234 static void matrix2vec4x4Mul(
const double (&m)[4][4],
const double (&u)[4],
double (&v)[4],
238 static void vec2matrix4x4Mul(
const double (&u)[4],
const double (&m)[4][4],
double (&v)[4],
244 double &k,
double &b) {
245 k = (y1 - y2) / (x1 - x2);
249 static int solveSquareEq(
double a,
double b,
double c,
double &x1,
double &x2);
259 #define U3D_MATH_BSPL_PARAM_PREC 1.e-10
280 virtual double getB(
int i,
double t)
const;
283 virtual void info()
const;
287 {
return m_is_constructed;}
290 const double (&
get()
const)[4][4];
319 void reconstruct(
double beta1,
double beta2);
340 void reconstruct(
double t);
401 double get(
double p)
const;
404 double getSp(
double p)
const;
407 double getSpp(
double p)
const;
419 double getMaxLineDeviation(
double k,
double b,
double p1,
double p2);
422 double getLineDeviation(
double k,
double b,
double p);
439 typedef vector<Spl_U3dSimpleBspl3Curve*> Spl_U3dSimpleBspl3CurveAr;
457 double get(
double p,
double q)
const;
460 double getSp(
double p,
double q)
const;
463 double getSq(
double p,
double q)
const;
466 double getSpp(
double p,
double q)
const;
469 double getSqq(
double p,
double q)
const;
472 double getSpq(
double p,
double q)
const;
483 double calc(
double *pp,
double *qq)
const;
508 double get(
double p,
double q,
double r)
const;
513 double m_rt[4][4][4];
522 double calc(
double *pp,
double *qq,
double *rr)
const;
539 double get(
double p)
const;
584 bool getCurvature(
double p,
double &c);
587 int getControlPointsNum()
const;
591 bool getControlPoint(
int ind,
Spl_U3dPoint &point)
const;
601 bool remove(
int ind);
616 bool getLineSegments(
double ds, std::vector<double> &segs);
619 bool getLineDeviations(
double p1,
double p2,
double p,
Spl_U3dPoint &dev);
623 bool getMaxLineDeviation(
double p1,
double p2,
double &md);
659 bool check_add_bps(
const Spl_U3dPointsAr &ps);
662 bool find_element(
double p,
int &nn,
double &pp)
const;
675 Spl_U3dPoint &dev,
double &smx,
double &smy,
double &smz) {
676 get_line_distance(p, n, kP, bP, dev);
677 if (dev.
getX() > smx)
679 if (dev.
getY() > smy)
681 if (dev.
getZ() > smz)
687 void next_segment (
double p1,
double p2, std::vector<double> &segs);
701 BaseSpline2D(
double *xx,
double *zz,
double *ddx,
double *ddz,
double *ccurv,
bool *flag,
int nn);
709 virtual int IntervalSmoothParSpline(
int N1,
double *x1,
double *z1,
bool *flag,
int N2,
double *xf,
double *zf,
void devs_update(double p, int n, Spl_U3dPoint &kP, Spl_U3dPoint &bP, Spl_U3dPoint &dev, double &smx, double &smy, double &smz)
Definition: base_splines.hpp:674
virtual ~Spl_U3dSimpleBspl3Surface()
Definition: base_splines.hpp:454
const Spl_U3dBspl3AbstractMatrix * m_bm
Definition: base_splines.hpp:477
static int solveSquareEq(double a, double b, double c, double &x1, double &x2)
Definition: base_splines.hpp:265
Definition: base_splines.hpp:529
Spl_U3dPoint()
Definition: base_splines.hpp:119
Spl_U3dBspl3AbstractMatrix()
Definition: base_splines.hpp:270
Spl_U3dPointsAr m_ps
Definition: base_splines.hpp:645
static void matrix2vec4x4Mul(const double(&m)[4][4], const double(&u)[4], double(&v)[4], bool tr=false)
Spl_U3dBspl3AbstractMatrix * m_bm
Definition: base_splines.hpp:642
Definition: base_splines.hpp:632
static void vec2matrix4x4Mul(const double(&u)[4], const double(&m)[4][4], double(&v)[4], bool tr=false)
Definition: base_splines.hpp:693
bool isReady() const
Definition: base_splines.hpp:609
const Spl_U3dBspl3AbstractMatrix * m_bm
Definition: base_splines.hpp:516
Definition: base_splines.hpp:218
Definition: base_splines.hpp:324
virtual ~Spl_U3dSimpleBspl3Surf3d()
Definition: base_splines.hpp:505
virtual ~Spl_U3dBspl3BezierMatrix()
Definition: base_splines.hpp:377
void getCoeffs(double(&c)[4]) const
Definition: base_splines.hpp:410
virtual ~Spl_U3dBspl3AbstractMatrix()
Definition: base_splines.hpp:276
double fX
Definition: base_splines.hpp:112
double getZ() const
Definition: base_splines.hpp:165
Definition: base_splines.hpp:495
static double scalarMul(const Spl_U3dPoint &p1, const Spl_U3dPoint &p2)
double getX() const
Definition: base_splines.hpp:153
Definition: geometry.H:16
static double m_d_prec
Definition: base_splines.hpp:252
Definition: base_splines.hpp:444
void setY(double y)
Definition: base_splines.hpp:185
bool isConstructed() const
Definition: base_splines.hpp:286
Definition: base_splines.hpp:388
static void getLineCoeffs(double x1, double y1, double x2, double y2, double &k, double &b)
Definition: base_splines.hpp:243
Definition: objectar.hpp:57
Definition: base_splines.hpp:40
bool m_is_ready
Definition: base_splines.hpp:648
double getY() const
Definition: base_splines.hpp:159
bool m_is_constructed
Definition: base_splines.hpp:295
virtual ~Spl_U3dSimpleBspl3Curve()
Definition: base_splines.hpp:398
void setZ(double z)
Definition: base_splines.hpp:191
Definition: base_splines.hpp:560
static double compositionMul(const Spl_U3dPoint &p1, const Spl_U3dPoint &p2, const Spl_U3dPoint &p3)
Definition: parspline.hpp:14
Definition: base_splines.hpp:303
const Spl_U3dBspl3AbstractMatrix * m_bm
Definition: base_splines.hpp:427
virtual ~Spl_U3dBspl3BSMatrix()
Definition: base_splines.hpp:356
Definition: base_splines.hpp:345
virtual ~Spl_U3dBspl3BetaMatrix()
Definition: base_splines.hpp:314
virtual ~Spl_U3dBspl3CRomMatrix()
Definition: base_splines.hpp:335
bool m_is_interpolated
Definition: base_splines.hpp:547
Definition: objectar.hpp:55
std::vector< Bspl3dCurve > m_bspls
Definition: base_splines.hpp:639
void setXYZ(double x, double y, double z)
Definition: base_splines.hpp:171
Definition: base_splines.hpp:21
Spl_U3dPoint & operator=(const Spl_U3dPoint &p)
Definition: base_splines.hpp:144
Spl_U3dSimpleBspl3CurveAr m_spline
Definition: base_splines.hpp:544
Spl_U3dSimpleBspl3Curve * x
Definition: base_splines.hpp:635
static void matrix4x4Mul(const double(&m1)[4][4], const double(&m2)[4][4], double(&m3)[4][4], bool tr1=false, bool tr2=false)
void setX(double x)
Definition: base_splines.hpp:179
Definition: base_splines.hpp:366