Hello community,

here is the log from the commit of package analitza for openSUSE:Factory 
checked in at 2016-08-31 00:06:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/analitza (Old)
 and      /work/SRC/openSUSE:Factory/.analitza.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "analitza"

Changes:
--------
--- /work/SRC/openSUSE:Factory/analitza/analitza.changes        2016-07-24 
19:44:05.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.analitza.new/analitza.changes   2016-08-31 
00:06:05.000000000 +0200
@@ -1,0 +2,16 @@
+Fri Aug 12 10:01:05 UTC 2016 - [email protected]
+
+- Update to KDE Applications 16.08.0
+   * KDE Applications 16.08.0
+   * https://www.kde.org/announcements/announce-applications-16.08.0.php
+
+
+-------------------------------------------------------------------
+Mon Aug  8 14:29:08 UTC 2016 - [email protected]
+
+- Update to KDE Applications 16.07.90
+   * KDE Applications 16.07.90 (16.08-RC)
+   * https://www.kde.org/announcements/announce-applications-16.07.90.php
+
+
+-------------------------------------------------------------------

Old:
----
  analitza-16.04.3.tar.xz

New:
----
  analitza-16.08.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ analitza.spec ++++++
--- /var/tmp/diff_new_pack.7s2Zxu/_old  2016-08-31 00:06:06.000000000 +0200
+++ /var/tmp/diff_new_pack.7s2Zxu/_new  2016-08-31 00:06:06.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           analitza
-Version:        16.04.3
+Version:        16.08.0
 Release:        0
 Summary:        A library to add mathematical features to programs
 License:        LGPL-2.1+

++++++ analitza-16.04.3.tar.xz -> analitza-16.08.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/CMakeLists.txt 
new/analitza-16.08.0/CMakeLists.txt
--- old/analitza-16.04.3/CMakeLists.txt 2016-03-22 00:37:30.000000000 +0100
+++ new/analitza-16.08.0/CMakeLists.txt 2016-07-03 18:37:28.000000000 +0200
@@ -14,10 +14,10 @@
 include(FeatureSummary)
 include(ECMAddAppIcon)
 include(ECMSetupVersion)
+include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
 include(ECMAddTests)
 include(ECMPackageConfigHelpers)
 include(KDEInstallDirs)
-include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
 include(KDECMakeSettings)
 include(GenerateExportHeader)
 include(CheckIncludeFiles)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitza/commands/eigencommands.h 
new/analitza-16.08.0/analitza/commands/eigencommands.h
--- old/analitza-16.04.3/analitza/commands/eigencommands.h      2016-03-22 
00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitza/commands/eigencommands.h      2016-07-03 
18:37:28.000000000 +0200
@@ -24,7 +24,7 @@
 
 namespace Analitza {
 class Expression;
-};
+}
 
 class EigenvaluesCommand: public Analitza::FunctionDefinition
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitza/tests/analitzatest.cpp 
new/analitza-16.08.0/analitza/tests/analitzatest.cpp
--- old/analitza-16.04.3/analitza/tests/analitzatest.cpp        2016-03-22 
00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitza/tests/analitzatest.cpp        2016-07-03 
18:37:28.000000000 +0200
@@ -76,6 +76,9 @@
     QTest::newRow("val.e0") << "12.0e-02" << Cn(12e-2);
     QTest::newRow("vale") << "12e-2" << Cn(12e-2);
     QTest::newRow("val") << "12e2" << Cn(12e2);
+
+    QTest::newRow("factorial5") << "factorial(5)" << Cn(120);
+    QTest::newRow("factorial12") << "factorial(12)" << 
Cn(12*11*10*9*8*7*6*5*4*3*2*1);
     
     QTest::newRow("simple addition") << "2+2" << Cn(4.);
     QTest::newRow("simple power") << "2**99" << Cn(pow(2., 99.));
@@ -445,7 +448,11 @@
            << QStringLiteral("pu:=n->sum(  
comb(n,i)*p^(n-i)*(1-p)*sum(x:x=0..i)  :i=0..(floor((n-1)/2)))")
            << QStringLiteral("pu(5)");
     
+#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
+    QTest::newRow("bug241047") << script << "2.97495e-5";
+#else
     QTest::newRow("bug241047") << script << "2.97495e-05";
+#endif
     
     script.clear();
     script << QStringLiteral("comb:=(n, 
i)->factorial(n)/(factorial(i)*factorial(n-i))")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitzaplot/CMakeLists.txt 
new/analitza-16.08.0/analitzaplot/CMakeLists.txt
--- old/analitza-16.04.3/analitzaplot/CMakeLists.txt    2016-03-22 
00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/CMakeLists.txt    2016-07-03 
18:37:28.000000000 +0200
@@ -35,6 +35,7 @@
     private/abstractspacecurve.cpp
     private/abstractsurface.cpp
     private/functiongraphfactory.cpp
+    private/export3d.cpp
 
     private/backends/cartesiansurface.cpp
     private/backends/implicitcurve.cpp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/analitza-16.04.3/analitzaplot/examples/export3dplotdemo.cpp 
new/analitza-16.08.0/analitzaplot/examples/export3dplotdemo.cpp
--- old/analitza-16.04.3/analitzaplot/examples/export3dplotdemo.cpp     
2016-03-22 00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/examples/export3dplotdemo.cpp     
2016-07-03 18:37:28.000000000 +0200
@@ -42,8 +42,9 @@
     QGuiApplication app(argc, argv);
     QCommandLineParser parser;
     parser.addPositionalArgument(QStringLiteral("expression"), 
QGuiApplication::translate("option description", "Expression to plot"), 
QStringLiteral("expression..."));
-    parser.addOption(QCommandLineOption(QStringLiteral("output"), 
QGuiApplication::translate("option description", "Created filename"), 
QStringLiteral("output.x3d")));
+    parser.addPositionalArgument(QStringLiteral("output"), 
QGuiApplication::translate("option description", "Created filename"), 
QStringLiteral("output.x3d"));
     parser.addOption(QCommandLineOption(QStringLiteral("interval"), 
QGuiApplication::translate("option description", "Specifies an interval"), 
QStringLiteral("var=num..num")));
+    parser.addHelpOption();
 
     parser.process(app);
     PlotsModel model;
@@ -64,7 +65,10 @@
         intervals[interval.left(equalIdx)] = qMakePair<double, double>(from, 
to);
     }
 
-    foreach(const QString& input, parser.positionalArguments()) {
+    QStringList args = parser.positionalArguments();
+    const QString output = args.takeLast();
+
+    foreach(const QString& input, args) {
         Expression exp(input);
         if(!exp.isCorrect()) {
             std::cerr << "Incorrect expression: " << qPrintable(input) << 
std::endl;
@@ -86,7 +90,7 @@
     }
     ExportPlotter3D plotter(&model);
     plotter.updatePlots(QModelIndex(), 0, model.rowCount()-1);
-    plotter.exportSurfaces(parser.value(QStringLiteral("output")));
+    plotter.exportSurfaces(output);
 
     return 0;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitzaplot/plotitem.h 
new/analitza-16.08.0/analitzaplot/plotitem.h
--- old/analitza-16.04.3/analitzaplot/plotitem.h        2016-03-22 
00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/plotitem.h        2016-07-03 
18:37:28.000000000 +0200
@@ -23,6 +23,7 @@
 #include <QStringList>
 #include <QSet>
 #include <QColor>
+#include <QVariant>
 
 #include "analitzaplotexport.h"
 #include "plottingenums.h"
@@ -84,4 +85,6 @@
 
 }
 
+Q_DECLARE_METATYPE(Analitza::PlotItem*);
+
 #endif // ANALITZAPLOT_PLOTITEM_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitzaplot/plotsmodel.cpp 
new/analitza-16.08.0/analitzaplot/plotsmodel.cpp
--- old/analitza-16.04.3/analitzaplot/plotsmodel.cpp    2016-03-22 
00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/plotsmodel.cpp    2016-07-03 
18:37:28.000000000 +0200
@@ -33,8 +33,6 @@
 
 using namespace Analitza;
 
-Q_DECLARE_METATYPE(PlotItem*)
-
 PlotsModel::PlotsModel(QObject* parent)
     : QAbstractListModel(parent)
     , m_resolution(500)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitzaplot/plotter2d.cpp 
new/analitza-16.08.0/analitzaplot/plotter2d.cpp
--- old/analitza-16.04.3/analitzaplot/plotter2d.cpp     2016-03-22 
00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/plotter2d.cpp     2016-07-03 
18:37:28.000000000 +0200
@@ -38,8 +38,6 @@
 
 using namespace Analitza;
 
-Q_DECLARE_METATYPE(PlotItem*)
-
 // #define DEBUG_GRAPH
 
 QColor const Plotter2D::m_axeColor(100,100,255); //TODO convert from const to 
param/attr and make setAxisColor(Qt::oriantation, qcolor)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitzaplot/plotter3d.cpp 
new/analitza-16.08.0/analitzaplot/plotter3d.cpp
--- old/analitza-16.04.3/analitzaplot/plotter3d.cpp     2016-03-22 
00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/plotter3d.cpp     2016-07-03 
18:37:28.000000000 +0200
@@ -28,7 +28,7 @@
 
 #include <cmath>
 #include <QDebug>
-#include <QFile>
+#include "private/export3d.h"
 
 #ifdef __APPLE__
 #include <OpenGL/gl.h>
@@ -44,8 +44,6 @@
 using namespace std;
 using namespace Analitza;
 
-Q_DECLARE_METATYPE(PlotItem*)
-
 void qgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble 
zFar)
 {
     const GLdouble ymax = zNear * tan(fovy * M_PI / 360.0);
@@ -303,82 +301,12 @@
     glDisable(GL_LIGHT0);
 }
 
-template <typename T>
-static QByteArray fromNumbers(const QVector<T>& input)
-{
-    QByteArray ret;
-    foreach(qreal r, input) {
-        ret += QByteArray::number(r)+QByteArrayLiteral(" ");
-    }
-    ret.chop(1);
-    return ret;
-}
-
-static QByteArray fromNumbers(const QVector<QVector3D>& input)
-{
-    QByteArray ret;
-    foreach(const QVector3D &r, input) {
-        ret += QByteArray::number(r.x())+QByteArrayLiteral(" ");
-        ret += QByteArray::number(r.y())+QByteArrayLiteral(" ");
-        ret += QByteArray::number(r.z())+QByteArrayLiteral(" ");
-    }
-    ret.chop(1);
-    return ret;
-}
-
-static QVector<int> makeTriangles(const QVector<uint>& input)
-{
-    QVector<int> ret;
-    int i = 0;
-    foreach(uint val, input) {
-        ret += val;
-        if(i==2) {
-            ret += -1;
-            i = 0;
-        } else
-            ++i;
-    }
-    ret += -1;
-    return ret;
-}
-
 void Plotter3D::exportSurfaces(const QString& path) const
 {
-    QFile f(path);
-    bool b = f.open(QIODevice::WriteOnly | QIODevice::Text);
-    Q_ASSERT(b);
-    f.write(QByteArrayLiteral("<?xml version='1.0' encoding='UTF-8'?>\n"
-    "<!DOCTYPE X3D PUBLIC 'ISO//Web3D//DTD X3D 3.2//EN' 
'http://www.web3d.org/specifications/x3d-3.2.dtd'>\n"
-    "<X3D profile='Interchange' version='3.2' 
xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' "
-        
"xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.2.xsd'>\n"
-        "<Scene>\n"));
-    for (int i = 0; i < m_model->rowCount(); ++i)
-    {
-        PlotItem *item = itemAt(i);
-
-        Surface *surf = dynamic_cast<Surface*>(item);
-        if (!surf || !surf->isVisible())
-            continue;
-
-        f.write(QByteArrayLiteral(
-            "<Shape>\n"
-                "<Appearance><Material diffuseColor='1 0 0' specularColor='0.8 
0.7 0.5'/></Appearance>\n"
-                "<IndexedFaceSet solid='false' normalPerVertex='false' 
coordIndex='"));
-        f.write(fromNumbers(makeTriangles(surf->indexes())));
-        f.write(QByteArrayLiteral("'>\n"
-                    "<Coordinate point='"));
-        f.write(fromNumbers(surf->vertices()));
-        f.write(QByteArrayLiteral("'/>\n"
-        "<Normal vector='"));
-        f.write(fromNumbers(surf->normals()));
-        f.write(QByteArrayLiteral(
-                "'/>\n"
-                "</IndexedFaceSet>\n"
-            "</Shape>\n"));
-    }
-    f.write(QByteArrayLiteral(
-        "</Scene>\n"
-    "</X3D>\n"));
+    if (path.endsWith(".stl", Qt::CaseInsensitive))
+        Export3D::exportSTL(path, m_model);
+    else
+        Export3D::exportX3D(path, m_model);
 }
 
 void Plotter3D::updatePlots(const QModelIndex & parent, int s, int e)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitzaplot/plotter3d_es.cpp 
new/analitza-16.08.0/analitzaplot/plotter3d_es.cpp
--- old/analitza-16.04.3/analitzaplot/plotter3d_es.cpp  2016-03-22 
00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/plotter3d_es.cpp  2016-07-03 
18:37:28.000000000 +0200
@@ -25,6 +25,7 @@
 
 #include "plotsmodel.h"
 #include "private/utils/mathutils.h"
+#include "private/export3d.h"
 
 #include <cmath>
 #include <QDebug>
@@ -40,8 +41,6 @@
 using namespace std;
 using namespace Analitza;
 
-Q_DECLARE_METATYPE(PlotItem*)
-
 const GLubyte Plotter3DES::XAxisArrowColor[] = {250 -1 , 1, 1};
 const GLubyte Plotter3DES::YAxisArrowColor[] = {1, 255 - 1, 1};
 const GLubyte Plotter3DES::ZAxisArrowColor[] = {1, 1, 255 - 1};
@@ -212,82 +211,9 @@
     program.release();
 }
 
-template <typename T>
-QByteArray fromNumbers(const QVector<T>& input)
-{
-    QByteArray ret;
-    foreach(qreal r, input) {
-        ret += QByteArray::number(r)+QByteArrayLiteral(" ");
-    }
-    ret.chop(1);
-    return ret;
-}
-
-QByteArray fromNumbers(const QVector<QVector3D>& input)
-{
-    QByteArray ret;
-    foreach(const QVector3D& r, input) {
-        ret += QByteArray::number(r.x())+QByteArrayLiteral(" ");
-        ret += QByteArray::number(r.y())+QByteArrayLiteral(" ");
-        ret += QByteArray::number(r.z())+QByteArrayLiteral(" ");
-    }
-    ret.chop(1);
-    return ret;
-}
-
-static QVector<int> makeTriangles(const QVector<uint>& input)
-{
-    QVector<int> ret;
-    int i = 0;
-    foreach(uint val, input) {
-        ret += val;
-        if(i==2) {
-            ret += -1;
-            i = 0;
-        } else
-            ++i;
-    }
-    ret += -1;
-    return ret;
-}
-
 void Plotter3DES::exportSurfaces(const QString& path) const
 {
-    QFile f(path);
-    bool b = f.open(QIODevice::WriteOnly | QIODevice::Text);
-    Q_ASSERT(b);
-    f.write(QByteArrayLiteral("<?xml version='1.0' encoding='UTF-8'?>\n"
-    "<!DOCTYPE X3D PUBLIC 'ISO//Web3D//DTD X3D 3.2//EN' 
'http://www.web3d.org/specifications/x3d-3.2.dtd'>\n"
-    "<X3D profile='Interchange' version='3.2' 
xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' "
-        
"xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.2.xsd'>\n"
-        "<Scene>\n"));
-    for (int i = 0; i < m_model->rowCount(); ++i)
-    {
-        PlotItem *item = itemAt(i);
-
-        Surface *surf = dynamic_cast<Surface*>(item);
-        if (!surf || !surf->isVisible())
-            continue;
-
-        f.write(QByteArrayLiteral(
-            "<Shape>\n"
-                "<Appearance><Material diffuseColor='1 0 0' specularColor='0.8 
0.7 0.5'/></Appearance>\n"
-                "<IndexedFaceSet solid='false' normalPerVertex='false' 
coordIndex='"));
-        f.write(fromNumbers(makeTriangles(surf->indexes())));
-        f.write(QByteArrayLiteral("'>\n"
-                    "<Coordinate point='"));
-        f.write(fromNumbers(surf->vertices()));
-        f.write(QByteArrayLiteral("'/>\n"
-        "<Normal vector='"));
-        f.write(fromNumbers(surf->normals()));
-        f.write(QByteArrayLiteral(
-                "'/>\n"
-                "</IndexedFaceSet>\n"
-            "</Shape>\n"));
-    }
-    f.write(QByteArrayLiteral(
-        "</Scene>\n"
-    "</X3D>\n"));
+    Export3D::exportX3D(path, m_model);
 }
 
 void Plotter3DES::updatePlots(const QModelIndex & parent, int s, int e)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/analitza-16.04.3/analitzaplot/private/abstractsurface.cpp 
new/analitza-16.08.0/analitzaplot/private/abstractsurface.cpp
--- old/analitza-16.04.3/analitzaplot/private/abstractsurface.cpp       
2016-03-22 00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/private/abstractsurface.cpp       
2016-07-03 18:37:28.000000000 +0200
@@ -85,27 +85,23 @@
 
 void AbstractSurface::doQuad(int n, int m, const QVector3D &p0,  const 
QVector3D &p1,  const QVector3D &p2,  const QVector3D &p3)
 {
-    int i;
-
-    QVector3D A, B, C, D;   
-
-    for (i=0; i<m; i++)
+    for (int i=0; i<m; i++)
     {
-        A = QVector3D((p0.x()*(float)(m-i) + p1.x()*(float)i)/(float)m, 
-                      (p0.y()*(float)(m-i) + p1.y()*(float)i)/(float)m,
-                      (p0.z()*(float)(m-i) + p1.z()*(float)i)/(float)m);
+        const QVector3D A((p0.x()*(float)(m-i) + p1.x()*(float)i)/(float)m,
+                          (p0.y()*(float)(m-i) + p1.y()*(float)i)/(float)m,
+                          (p0.z()*(float)(m-i) + p1.z()*(float)i)/(float)m);
         
-        B = QVector3D((p0.x()*(float)(m-i-1) + p1.x()*(float)(i+1))/(float)m,
-                      (p0.y()*(float)(m-i-1) + p1.y()*(float)(i+1))/(float)m,
-                      (p0.z()*(float)(m-i-1) + p1.z()*(float)(i+1))/(float)m);
-
-        C = QVector3D((p2.x()*(float)(m-i)   + p3.x()*(float)i)/(float)m,
-                      (p2.y()*(float)(m-i)   + p3.y()*(float)i)/(float)m,
-                      (p2.z()*(float)(m-i)   + p3.z()*(float)i)/(float)m);
-
-        D = QVector3D((p2.x()*(float)(m-i-1) + p3.x()*(float)(i+1))/(float)m, 
-                      (p2.y()*(float)(m-i-1) + p3.y()*(float)(i+1))/(float)m,
-                      (p2.z()*(float)(m-i-1) + p3.z()*(float)(i+1))/(float)m);
+        const QVector3D B((p0.x()*(float)(m-i-1) + 
p1.x()*(float)(i+1))/(float)m,
+                          (p0.y()*(float)(m-i-1) + 
p1.y()*(float)(i+1))/(float)m,
+                          (p0.z()*(float)(m-i-1) + 
p1.z()*(float)(i+1))/(float)m);
+
+        const QVector3D C((p2.x()*(float)(m-i)   + p3.x()*(float)i)/(float)m,
+                          (p2.y()*(float)(m-i)   + p3.y()*(float)i)/(float)m,
+                          (p2.z()*(float)(m-i)   + p3.z()*(float)i)/(float)m);
+
+        const QVector3D D((p2.x()*(float)(m-i-1) + 
p3.x()*(float)(i+1))/(float)m,
+                          (p2.y()*(float)(m-i-1) + 
p3.y()*(float)(i+1))/(float)m,
+                          (p2.z()*(float)(m-i-1) + 
p3.z()*(float)(i+1))/(float)m);
         
         doStrip(n, A, B, C, D);
     }
@@ -113,18 +109,18 @@
 
 void AbstractSurface::doStrip(int n, const QVector3D &p0,  const QVector3D 
&p1,  const QVector3D &p2,  const QVector3D &p3)
 {
-    QVector3D A, B, buffer[3];
+    QVector3D buffer[3];
     QVector3D theStrip[MAXSTRIP][2];
 
     for (int i=0; i<=n; i++)
     {
-        A = QVector3D((p0.x()*(float)(n-i) + p2.x()*(float)i)/(float)n,
-                      (p0.y()*(float)(n-i) + p2.y()*(float)i)/(float)n,
-                      (p0.z()*(float)(n-i) + p2.z()*(float)i)/(float)n);
-
-        B = QVector3D((p1.x()*(float)(n-i) + p3.x()*(float)i)/(float)n, 
-                      (p1.y()*(float)(n-i) + p3.y()*(float)i)/(float)n,
-                      (p1.z()*(float)(n-i) + p3.z()*(float)i)/(float)n);
+        const QVector3D A((p0.x()*(float)(n-i) + p2.x()*(float)i)/(float)n,
+                          (p0.y()*(float)(n-i) + p2.y()*(float)i)/(float)n,
+                          (p0.z()*(float)(n-i) + p2.z()*(float)i)/(float)n);
+
+        const QVector3D B((p1.x()*(float)(n-i) + p3.x()*(float)i)/(float)n,
+                          (p1.y()*(float)(n-i) + p3.y()*(float)i)/(float)n,
+                          (p1.z()*(float)(n-i) + p3.z()*(float)i)/(float)n);
 
         theStrip[i][0] = A;
         theStrip[i][1] = B;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitzaplot/private/export3d.cpp 
new/analitza-16.08.0/analitzaplot/private/export3d.cpp
--- old/analitza-16.04.3/analitzaplot/private/export3d.cpp      1970-01-01 
01:00:00.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/private/export3d.cpp      2016-07-03 
18:37:28.000000000 +0200
@@ -0,0 +1,167 @@
+/*************************************************************************************
+ *  Copyright (C) 2016 Aleix Pol Gonzalez <[email protected]>                   
      *
+ *                                                                             
      *
+ *  This program is free software; you can redistribute it and/or              
      *
+ *  modify it under the terms of the GNU General Public License                
      *
+ *  as published by the Free Software Foundation; either version 2             
      *
+ *  of the License, or (at your option) any later version.                     
      *
+ *                                                                             
      *
+ *  This program is distributed in the hope that it will be useful,            
      *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of             
      *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
      *
+ *  GNU General Public License for more details.                               
      *
+ *                                                                             
      *
+ *  You should have received a copy of the GNU General Public License          
      *
+ *  along with this program; if not, write to the Free Software                
      *
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA   *
+ 
*************************************************************************************/
+
+#include "export3d.h"
+
+#include <QFile>
+#include <QDebug>
+#include <QVector3D>
+#include <cmath>
+
+#include "surface.h"
+#include "plotitem.h"
+#include "plotsmodel.h"
+
+using namespace Analitza;
+
+template <typename T>
+static QByteArray fromNumbers(const QVector<T>& input)
+{
+    QByteArray ret;
+    foreach(qreal r, input) {
+        ret += QByteArray::number(r)+' ';
+    }
+    ret.chop(1);
+    return ret;
+}
+
+static QByteArray fromVector3D(const QVector3D &r)
+{
+    return QByteArray::number(r.x())+' '
+         + QByteArray::number(r.y())+' '
+         + QByteArray::number(r.z());
+}
+
+static QByteArray fromNumbers(const QVector<QVector3D>& input)
+{
+    QByteArray ret;
+    foreach(const QVector3D &r, input) {
+        ret += fromVector3D(r);
+    }
+    ret.chop(1);
+    return ret;
+}
+
+static QVector<int> makeTriangles(const QVector<uint>& input)
+{
+    QVector<int> ret;
+    int i = 0;
+    foreach(uint val, input) {
+        ret += val;
+        if(i==2) {
+            ret += -1;
+            i = 0;
+        } else
+            ++i;
+    }
+    ret += -1;
+    return ret;
+}
+
+void Export3D::exportX3D(const QString& path, QAbstractItemModel* model)
+{
+    QFile f(path);
+    if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
+        qWarning() << "couldn't open" << path;
+        return;
+    }
+
+    f.write(QByteArrayLiteral("<?xml version='1.0' encoding='UTF-8'?>\n"
+    "<!DOCTYPE X3D PUBLIC 'ISO//Web3D//DTD X3D 3.2//EN' 
'http://www.web3d.org/specifications/x3d-3.2.dtd'>\n"
+    "<X3D profile='Interchange' version='3.2' 
xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' "
+        
"xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.2.xsd'>\n"
+        "<Scene>\n"));
+    for (int i = 0; i < model->rowCount(); ++i)
+    {
+        const QModelIndex pi = model->index(i, 0);
+
+        if (!pi.isValid())
+            continue;
+
+        PlotItem* item = pi.data(PlotsModel::PlotRole).value<PlotItem*>();
+
+        Surface *surf = dynamic_cast<Surface*>(item);
+        if (!surf || !surf->isVisible())
+            continue;
+
+        f.write(QByteArrayLiteral(
+            "<Shape>\n"
+                "<Appearance><Material diffuseColor='1 0 0' specularColor='0.8 
0.7 0.5'/></Appearance>\n"
+                "<IndexedFaceSet solid='false' normalPerVertex='false' 
coordIndex='"));
+        f.write(fromNumbers(makeTriangles(surf->indexes())));
+        f.write(QByteArrayLiteral("'>\n"
+                    "<Coordinate point='"));
+        f.write(fromNumbers(surf->vertices()));
+        f.write(QByteArrayLiteral("'/>\n"
+        "<Normal vector='"));
+        f.write(fromNumbers(surf->normals()));
+        f.write(QByteArrayLiteral(
+                "'/>\n"
+                "</IndexedFaceSet>\n"
+            "</Shape>\n"));
+    }
+    f.write(QByteArrayLiteral(
+        "</Scene>\n"
+    "</X3D>\n"));
+}
+
+void Export3D::exportSTL(const QString& path, QAbstractItemModel* model)
+{
+    QFile f(path);
+    if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
+        qWarning() << "couldn't open" << path;
+        return;
+    }
+
+    f.write(QByteArrayLiteral("solid myplot\n"));
+    for (int i = 0; i < model->rowCount(); ++i)
+    {
+        const QModelIndex pi = model->index(i, 0);
+
+        if (!pi.isValid())
+            continue;
+
+        PlotItem* item = pi.data(PlotsModel::PlotRole).value<PlotItem*>();
+
+        Surface *surf = dynamic_cast<Surface*>(item);
+        if (!surf || !surf->isVisible())
+            continue;
+
+        const auto normals = surf->normals();
+        const auto vertices = surf->vertices();
+        const auto indexes = surf->indexes();
+
+        for (int i = 0, c = indexes.count()/3; i<c; ++i) {
+//             f.write("  facet normal " + fromVector3D(normals[i]) + '\n');
+            const QVector3D v1 = vertices[indexes[i*3 + 0]]
+                          , v2 = vertices[indexes[i*3 + 1]]
+                          , v3 = vertices[indexes[i*3 + 2]];
+
+            //TODO: should be using the normals from Surface
+            f.write("  facet normal " + fromVector3D(QVector3D::normal(v1, v2, 
v3)) + '\n');
+            f.write("     outer loop\n");
+            f.write("       vertex " + fromVector3D(v1) + '\n');
+            f.write("       vertex " + fromVector3D(v2) + '\n');
+            f.write("       vertex " + fromVector3D(v3) + '\n');
+            f.write("     endloop\n");
+            f.write("  endfacet\n");
+        }
+        f.write("\n");
+    }
+    f.write("endsolid myplot\n");
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitzaplot/private/export3d.h 
new/analitza-16.08.0/analitzaplot/private/export3d.h
--- old/analitza-16.04.3/analitzaplot/private/export3d.h        1970-01-01 
01:00:00.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/private/export3d.h        2016-07-03 
18:37:28.000000000 +0200
@@ -0,0 +1,31 @@
+/*************************************************************************************
+ *  Copyright (C) 2016 Aleix Pol Gonzalez <[email protected]>                   
      *
+ *                                                                             
      *
+ *  This program is free software; you can redistribute it and/or              
      *
+ *  modify it under the terms of the GNU General Public License                
      *
+ *  as published by the Free Software Foundation; either version 2             
      *
+ *  of the License, or (at your option) any later version.                     
      *
+ *                                                                             
      *
+ *  This program is distributed in the hope that it will be useful,            
      *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of             
      *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
      *
+ *  GNU General Public License for more details.                               
      *
+ *                                                                             
      *
+ *  You should have received a copy of the GNU General Public License          
      *
+ *  along with this program; if not, write to the Free Software                
      *
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA   *
+ 
*************************************************************************************/
+
+#include <QString>
+
+/*
+ * Contains exporting algorithms, potentially an intermediate step in a 
refactoring
+ */
+
+class QAbstractItemModel;
+
+namespace Export3D
+{
+void exportX3D(const QString &path, QAbstractItemModel* model);
+void exportSTL(const QString &path, QAbstractItemModel* model);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/analitza-16.04.3/analitzaplot/tests/CMakeLists.txt 
new/analitza-16.08.0/analitzaplot/tests/CMakeLists.txt
--- old/analitza-16.04.3/analitzaplot/tests/CMakeLists.txt      2016-03-22 
00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/tests/CMakeLists.txt      2016-07-03 
18:37:28.000000000 +0200
@@ -7,3 +7,11 @@
 
     LINK_LIBRARIES Qt5::Xml Qt5::Test Qt5::Gui Analitza AnalitzaPlot 
AnalitzaGui
 )
+
+function(test_export name expression)
+    add_test(NAME "export-test-${name}-stl" COMMAND export3dplotdemo 
"${expression}" "output-${name}.stl" ${ARGN})
+    add_test(NAME "export-test-${name}-x3d" COMMAND export3dplotdemo 
"${expression}" "output-${name}.x3d" ${ARGN})
+endfunction()
+
+test_export(sin "sin x*sin y")
+test_export(fancy "piecewise { x^2+y^2+z^2<35 ? 
2-(cos(x+(1+5^0.5)/2*y)+cos(x-(1+5^0.5)/2*y)+cos(y+(1+5^0.5)/2*z)+cos(y-(1+5^0.5)/2*z)+cos(z-(1+5^0.5)/2*x)+cos(z+(1+5^0.5)/2*x)),
 ? 1 }=0")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/analitza-16.04.3/analitzaplot/tests/plotsdictionarymodeltest.cpp 
new/analitza-16.08.0/analitzaplot/tests/plotsdictionarymodeltest.cpp
--- old/analitza-16.04.3/analitzaplot/tests/plotsdictionarymodeltest.cpp        
2016-03-22 00:37:30.000000000 +0100
+++ new/analitza-16.08.0/analitzaplot/tests/plotsdictionarymodeltest.cpp        
2016-07-03 18:37:28.000000000 +0200
@@ -30,8 +30,6 @@
 
 QTEST_MAIN( PlotsDictionaryModelTest )
 
-Q_DECLARE_METATYPE(PlotItem*)
-
 PlotsDictionaryModelTest::PlotsDictionaryModelTest(QObject *parent)
     : QObject(parent)
 {}


Reply via email to