File indexing completed on 2024-04-21 03:40:38
0001 /************************************************************************************* 0002 * Copyright (C) 2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or * 0005 * modify it under the terms of the GNU General Public License * 0006 * as published by the Free Software Foundation; either version 2 * 0007 * of the License, or (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the Free Software * 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 0017 *************************************************************************************/ 0018 0019 0020 #ifndef ABSTRACTSURFACE_H 0021 #define ABSTRACTSURFACE_H 0022 0023 #include "abstractfunctiongraph.h" 0024 0025 #define CONSTRUCTORS(name) \ 0026 name (const Analitza::Expression &functionExpression, const QSharedPointer<Analitza::Variables>& variables) : AbstractSurface(functionExpression, variables) { } 0027 0028 namespace Analitza { 0029 0030 class AbstractSurface : public AbstractFunctionGraph //strategy pattern for curves 0031 { 0032 public: 0033 explicit AbstractSurface(const Analitza::Expression& e, const QSharedPointer<Analitza::Variables>& v = {}); 0034 ~AbstractSurface() override; 0035 0036 //Own 0037 virtual void update(const QVector3D & oppositecorner1, const QVector3D & oppositecorner2) = 0; 0038 0039 QVector<QVector3D> vertices; 0040 QVector<QVector3D> normals; 0041 QVector<unsigned int> indexes; 0042 0043 protected: 0044 virtual QVector3D fromParametricArgs(double u, double v); 0045 bool buildParametricSurface(); 0046 0047 private: 0048 AbstractSurface(); 0049 AbstractSurface(const AbstractSurface& other); 0050 0051 void doQuad(int n, int m, const QVector3D &p0, const QVector3D &p1, const QVector3D &p2, const QVector3D &p3); 0052 void doStrip(int n, const QVector3D &p0, const QVector3D &p1, const QVector3D &p2, const QVector3D &p3); 0053 void createFace( QVector3D *buffer ); 0054 }; 0055 0056 } 0057 0058 #endif // ABSTRACTSURFACE_H