Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/diagrams/rect3ddiagram.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                               rect3ddiagram.h
00003                              -----------------
00004     begin                : Sat Mar 5 2005
00005     copyright            : (C) 2005 by Michael Margraf
00006     email                : michael.margraf@alumni.tu-berlin.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef RECT3DDIAGRAM_H
00019 #define RECT3DDIAGRAM_H
00020 
00021 #include "diagram.h"
00022 
00023 
00024 struct tPoint3D {
00025   int   x, y;
00026   int   No, done;
00027 };
00028 
00029 struct tPointZ {
00030   float z;
00031   int   No, NoCross;
00032 };
00033 
00034 struct tBound {
00035   int min, max;
00036 };
00037 
00038 
00039 class Rect3DDiagram : public Diagram  {
00040 public:
00041   Rect3DDiagram(int _cx=0, int _cy=0);
00042  ~Rect3DDiagram();
00043 
00044 
00045   Diagram* newOne();
00046   static Element* info(QString&, char* &, bool getNewOne=false);
00047   int  calcDiagram();
00048   void calcLimits();
00049   void calcCoordinate(const double*, const double*, const double*, float*, float*, Axis const*) const;
00050   void finishMarkerCoordinates(float&, float&) const;
00051 
00052   void createAxisLabels();
00053   bool insideDiagram(float, float) const;
00054 
00055   tPoint3D *Mem;   // memory for all points during hidden line algorithm
00056   tPoint3D *pMem;  // current position in "Mem"
00057 
00058 
00059 protected:
00060   void calcData(Graph*);
00061 
00062 private:
00063   int  calcAxis(Axis*, int, int, double, double, bool);
00064   void createAxis(Axis*, bool, int, int, int, int);
00065 
00066   void   calcCoefficients();
00067   int    calcCross(int*, int*);
00068   double calcX_2D(double, double, double) const;
00069   double calcY_2D(double, double, double) const;
00070   double calcZ_2D(double, double, double) const;
00071 
00072   static int comparePoint3D(const void*, const void*);
00073   static int comparePointZ(const void*, const void*);
00074   bool isHidden(int, int, tBound*, char*);
00075   void enlargeMemoryBlock(tPoint3D* &);
00076   void calcLine(tPoint3D* &, tPoint3D* &, tBound*, char*);
00077   void calcCoordinate3D(double, double, double, double, tPoint3D*, tPointZ*);
00078   void removeHiddenLines(char*, tBound*);
00079   void removeHiddenCross(int, int, int, int, char*, tBound*);
00080 
00081   float  xorig, yorig; // where is the 3D origin with respect to cx/cy
00082   double cxx, cxy, cxz, cyx, cyy, cyz, czx, czy, czz; // coefficients 3D -> 2D
00083   double scaleX, scaleY;
00084 };
00085 
00086 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines