diff --git a/toonz/sources/tnzext/plasticdeformer.cpp b/toonz/sources/tnzext/plasticdeformer.cpp index 9c6a974..5fe0b02 100644 --- a/toonz/sources/tnzext/plasticdeformer.cpp +++ b/toonz/sources/tnzext/plasticdeformer.cpp @@ -36,14 +36,14 @@ which can be solved using the Lagrange Multipliers theorem:

\f$ - + \Rightarrow \left{ \begin{array}{c} H v + f = A^t \lambda A v + d = 0 \end{array} \right. \Rightarrow \left( \begin{array}{c} H \\ A \end{array} \begin{array}{c} -A^t \\ 0 \end{array} \right) - \left( \begin{array}{c} v \\ \lambda \end{array} \right) = + \left( \begin{array}{c} v \\ \lambda \end{array} \right) = \left( \begin{array}{c} -f \\ -d \end{array} \right) \f$

@@ -70,54 +70,15 @@ struct LinearConstraint { //------------------------------------------------------------------------------------------- -// Forced to implement a sloppy substitute to C++11's std::unique_ptr -- since we're still compiling -// C++03 on MAC... ARGH ! -template -class UniquePtr -{ - T *m_t; - -public: - UniquePtr() : m_t() {} - UniquePtr(T *t) : m_t(t) {} - ~UniquePtr() { D::destroy(m_t); } - - void reset(T *t = 0) - { - D::destroy(m_t); - m_t = t; - } - - const T *get() const { return m_t; } - T *get() { return m_t; } - - const T *operator->() const { return m_t; } - T *operator->() { return m_t; } - - const T &operator*() const { return *m_t; } - T &operator*() { return *m_t; } - - const T &operator[](size_t i) const { return m_t[i]; } - T &operator[](size_t i) { return m_t[i]; } -}; - -//------------------------------------------------------------------------------------------- - struct SuperFactors_free { - static inline void destroy(tlin::SuperFactors *f) { tlin::freeF(f); } -}; -struct freer { - static inline void destroy(void *d) { free(d); } -}; -struct deleter { - static inline void destroy(void *d) { delete d; } + void operator()(tlin::SuperFactors *f) { tlin::freeF(f); } }; //------------------------------------------------------------------------------------------- -typedef UniquePtr SuperFactorsPtr; -typedef UniquePtr DoublePtr; -typedef UniquePtr TPointDPtr; +using SuperFactorsPtr =std::unique_ptr; +using DoublePtr =std::unique_ptr; +using TPointDPtr =std::unique_ptr; } // namespace @@ -581,8 +542,8 @@ void PlasticDeformer::Imp::compileStep1(const std::vector &handle m_invC.reset(invC); // Reallocate arrays - m_q.reset((double *)malloc(cSize * sizeof(double))); - m_out.reset((double *)malloc(cSize * sizeof(double))); + m_q.reset(new double[cSize]); + m_out.reset(new double[cSize]); memset(m_q.get(), 0, 2 * vCount * sizeof(double)); // Initialize the system's known term with 0 } else