libsurf
Programmer's Documentation

mappedcurve.h (r6227/r5902)
1 /* Copyright (C) 2017 David Eller <david@larosterna.com>
2  *
3  * Commercial License Usage
4  * Licensees holding valid commercial licenses may use this file in accordance
5  * with the terms contained in their respective non-exclusive license agreement.
6  * For further information contact david@larosterna.com .
7  *
8  * GNU General Public License Usage
9  * Alternatively, this file may be used under the terms of the GNU General
10  * Public License version 3.0 as published by the Free Software Foundation and
11  * appearing in the file gpl.txt included in the packaging of this file.
12  */
13 
14 #ifndef SURF_MAPPEDCURVE_H
15 #define SURF_MAPPEDCURVE_H
16 
17 #include "abstractcurve.h"
18 
33 class MappedCurve : public AbstractCurve
34 {
35 public:
36 
38  MappedCurve(const std::string &s = "") : AbstractCurve(s) {}
39 
41  explicit MappedCurve(const AbstractCurvePtr &acp, Real scale, Real offset=0.0);
42 
44  virtual ~MappedCurve() = default;
45 
47  virtual void init(const AbstractCurvePtr &acp, Real scale, Real offset=0.0);
48 
50  virtual MappedCurve *clone() const;
51 
53  virtual Vct3 eval(Real t) const;
54 
56  virtual Vct3 derive(Real t, uint k) const;
57 
59  virtual void apply();
60 
62  virtual void tgline(Real t, Vct3 & c, Vct3 & dc) const;
63 
65  virtual XmlElement toXml(bool share = false) const;
66 
68  virtual void fromXml(const XmlElement & xe);
69 
70 private:
71 
73  Real m_offset = 0.0;
74 
76  Real m_scale = 1.0;
77 
79  AbstractCurvePtr m_base;
80 };
81 
82 #endif // MAPPEDCURVE_H
Base class for all curve objects.
Definition: abstractcurve.h:31
AbstractCurvePtr m_base
base curve C(t) to be mapped
Definition: mappedcurve.h:79
void scale(Real xf, Real yf, Real zf)
virtual ~MappedCurve()=default
virtual destruction (can be base class)
Real m_offset
offset coefficient a in t = a + b*s
Definition: mappedcurve.h:73
virtual MappedCurve * clone() const
create a clone
Definition: mappedcurve.cpp:16
virtual void fromXml(const XmlElement &xe)
XML input.
Definition: mappedcurve.cpp:66
virtual Vct3 eval(Real t) const
evaluate spline curve
Definition: mappedcurve.cpp:25
virtual void tgline(Real t, Vct3 &c, Vct3 &dc) const
compute point and first derivative in one sweep
Definition: mappedcurve.cpp:38
virtual Vct3 derive(Real t, uint k) const
compute kth derivative
Definition: mappedcurve.cpp:31
MappedCurve(const std::string &s="")
empty default constructor
Definition: mappedcurve.h:38
Curve generated by linearly mapping the parameter space.
Definition: mappedcurve.h:33
virtual XmlElement toXml(bool share=false) const
XML output.
Definition: mappedcurve.cpp:52
Real m_scale
scale coefficient b in in t = a + b*s
Definition: mappedcurve.h:76
virtual void init(const AbstractCurvePtr &acp, Real scale, Real offset=0.0)
assign base curve, scaling and offset coefficients
Definition: mappedcurve.cpp:9
virtual void apply()
apply hard transformation
Definition: mappedcurve.cpp:45
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5