My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rect3ddiagram.h
Go to the documentation of this file.
1 /***************************************************************************
2  rect3ddiagram.h
3  -----------------
4  begin : Sat Mar 5 2005
5  copyright : (C) 2005 by Michael Margraf
6  email : michael.margraf@alumni.tu-berlin.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef RECT3DDIAGRAM_H
19 #define RECT3DDIAGRAM_H
20 
21 #include "diagram.h"
22 
23 
24 struct tPoint3D {
25  int x, y;
26  int No, done;
27 };
28 
29 struct tPointZ {
30  float z;
31  int No, NoCross;
32 };
33 
34 struct tBound {
35  int min, max;
36 };
37 
38 
39 class Rect3DDiagram : public Diagram {
40 public:
41  Rect3DDiagram(int _cx=0, int _cy=0);
43 
44 
45  Diagram* newOne();
46  static Element* info(QString&, char* &, bool getNewOne=false);
47  int calcDiagram();
48  void calcLimits();
49  void calcCoordinate(double* &, double* &, double* &, float*, float*, Axis*);
50 
51  void createAxisLabels();
52  bool insideDiagram(float, float);
53 
54  tPoint3D *Mem; // memory for all points during hidden line algorithm
55  tPoint3D *pMem; // current position in "Mem"
56 
57 
58 protected:
59  void calcData(Graph*);
60 
61 private:
62  int calcAxis(Axis*, int, int, double, double, bool);
63  void createAxis(Axis*, bool, int, int, int, int);
64 
65  void calcCoefficients();
66  int calcCross(int*, int*);
67  double calcX_2D(double, double, double);
68  double calcY_2D(double, double, double);
69  double calcZ_2D(double, double, double);
70 
71  static int comparePoint3D(const void*, const void*);
72  static int comparePointZ(const void*, const void*);
73  bool isHidden(int, int, tBound*, char*);
74  void enlargeMemoryBlock(tPoint3D* &);
75  void calcLine(tPoint3D* &, tPoint3D* &, tBound*, char*);
76  void calcCoordinate3D(double, double, double, double, tPoint3D*, tPointZ*);
77  void removeHiddenLines(char*, tBound*);
78  void removeHiddenCross(int, int, int, int, char*, tBound*);
79 
80  float xorig, yorig; // where is the 3D origin with respect to cx/cy
81  double cxx, cxy, cxz, cyx, cyy, cyz, czx, czy, czz; // coefficients 3D -> 2D
82  double scaleX, scaleY;
83 };
84 
85 #endif