vrcore  0.45
visuReal Messkern
 All Classes Files Functions Variables
SolidModel.h
Go to the documentation of this file.
1 #pragma once
2 
10  {
11  protected:
12 
13  int idxPivotPoint;
14  cv::Mat mtx;
15  SolidPoint pivotPoint;
16  void takePoint (SolidPoint &pt, SolidPointVector &points);
17  void takePoint (size_t idx, SolidPointVector &points);
18  void takeZeroPoint (SolidPoint &pt, SolidPointVector &points);
19  void takeZeroPoint (size_t idx, SolidPointVector &points);
20 
21  double deg2Rad (double deg) const { return dPi * deg / 180.; }
22  void xAxis (double si, double co);
23  void yAxis (double si, double co);
24  void zAxis (double si, double co);
25  void takePivotPoint (SolidPointVector &points) { takePoint (pivotPoint, points); }
26  void takeZeroPoint (SolidPointVector &points);
27  void doXRotation (double rAngle, SolidPointVector &points);
28  void doYRotation (double rAngle, SolidPointVector &points);
29  void doZRotation (double rAngle, SolidPointVector &points);
30  void rotateXAxis (double rAngle, SolidPointVector &points);
31  void rotateYAxis (double rAngle, SolidPointVector &points);
32  void rotateZAxis (double rAngle, SolidPointVector &points);
33 
34  SolidHandler (int idxPivot);
35 
36  public:
37  void scale (double scale, SolidPointVector &points, bool bPivot = true);
38  void scale (double horzScale, double vertScale, SolidPointVector &points, bool bPivot = true);
39  void move (double dx, double dy, double dz, SolidPointVector &points);
40  double getNorm (size_t idxPt1, size_t idxPt2, SolidPointVector &points);
41  double getPlanarNorm (size_t idxPt1, size_t idxPt2, SolidPointVector &points);
42  double getPlanarNorm (double x1, double y1, double x2, double y2) { return sqrt (pow (x1 - x2, 2) + pow (y1 - y2, 2)); }
43  double getPlanarRotation (size_t idxPt1, size_t idxPt2, SolidPointVector &points);
44 
45  };
46 
53 class SolidModel : public SolidHandler
54  {
55  protected:
56  SolidPointVector pointVector;
57 
58  void setPointValues (size_t idx, double x, double y, double z);
59  void setPointValues (size_t idx, SolidPoint point);
60 
61  SolidModel (int idxPivot);
62 
63  public:
64  void scale (double fScale) { SolidHandler::scale (fScale, pointVector); }
65  void scale (double horzScale, double vertScale){ SolidHandler::scale (horzScale, vertScale, pointVector); }
66  void move (double dx, double dy, double dz) { SolidHandler::move (dx, dy, dz, pointVector); }
67  void movePointTo (size_t idx, double x, double y, double z);
68  void rotateXAxis (double rAngle) { SolidHandler::rotateXAxis (rAngle, pointVector); }
69  void rotateYAxis (double rAngle) { SolidHandler::rotateYAxis (rAngle, pointVector); }
70  void rotateZAxis (double rAngle) { SolidHandler::rotateZAxis (rAngle, pointVector); }
71 
72 
73  void getPointsRef (SolidPointVector** pointsRef) { *pointsRef = &pointVector;
74  // dieser Zuweisungsoperator erzeugt eine tiefe kopie .
75  }
76  void getPointsCopy (SolidPointVector &pointsCopy);
77  double getScaledValue (double value) { return value * getScaleFactor (); }
78  bool isValidIndex (size_t index) { return index < pointVector.size (); }
79  bool setHorzValue (size_t index, double value) { if (index < pointVector.size ()) { pointVector [index].y = value; return true; } return false; }
80  bool setVertValue (size_t index, double value) { if (index < pointVector.size ()) { pointVector [index].x = value; return true; } return false; }
81  bool setPlanarValues (size_t index, double horz, double vert)
82  { if (index < pointVector.size ()) { pointVector [index].y = horz; pointVector [index].x = vert; return true; } return false; }
83  bool getPlanarValues (size_t index, double &horz, double &vert)
84  { if (index < pointVector.size ()) { horz = pointVector [index].y; vert = pointVector [index].x; return true; } return false; }
85  double getHorzValue (size_t index) { return index < pointVector.size () ? pointVector [index].y : 0; }
86  double getVertValue (size_t index) { return index < pointVector.size () ? pointVector [index].x : 0; }
87  bool setPoint (size_t index, SolidPoint &pt) { if (index < pointVector.size ()) { pointVector.at (index) = pt; return true; } return false; }
88  bool getPoint (size_t index, SolidPoint &pt) { if (index < pointVector.size ()) { pt = pointVector.at (index); return true; } return false; }
89  double getNorm (size_t idxPt1, size_t idxPt2) { return SolidHandler::getNorm (idxPt1, idxPt2, pointVector); }
90  double getPlanarNorm (size_t idxPt1, size_t idxPt2) { return SolidHandler::getPlanarNorm (idxPt1, idxPt2, pointVector); }
91  double getPlanarRotation (size_t idxPt1, size_t idxPt2) { return SolidHandler::getPlanarRotation (idxPt1, idxPt2, pointVector); }
92  void setPlanarPivotValues (double horz, double vert) { setPlanarValues (idxPivotPoint, horz, vert); }
93  void minMaxPointValues (size_t idx, SolidPoint &minPt, SolidPoint &maxPt);
94  virtual double getScaleFactor () = 0;
95  virtual void resetModel () = 0;
96  };
Definition: SolidModel.h:9
Definition: SolidModel.h:53