Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef VORONOINAVIGATOR_H
00028 #define VORONOINAVIGATOR_H
00029
00030 #include <QGpCoreTools.h>
00031 #include "DinverCoreDLLExport.h"
00032 #include "ScaledModels.h"
00033 #include "PdfCurve.h"
00034 #include "Model.h"
00035
00036 namespace DinverCore {
00037
00038 class DINVERCORE_EXPORT VoronoiNavigator
00039 {
00040 TRANSLATIONS("VoronoiNavigator")
00041 public:
00042 VoronoiNavigator(const ScaledModels * m);
00043 ~VoronoiNavigator();
00044
00045 void cellLimits(int& xMin, int &xMax, int& iMin, int& iMax);
00046 PdfCurve intersections(double xMinLimit, double xMaxLimit);
00047
00048 inline void setCurrentPoint(int index);
00049 inline void setCurrentPoint(const int * coordinates);
00050
00051 int currentCell() const {return _currentCell;}
00052 QVector<int> cellAt(const int * p) const;
00053 QVector<int> cellAt(const double * p) const;
00054 int cellCount() const {return _cells->modelCount();}
00055
00056 void setCurrentAxis(int a);
00057 void incrementAxis();
00058 int currentAxis() const {return _currentAxis;}
00059
00060 void setValue(int v) {_currentPoint[ _currentAxis ]=v * _cells->scale(_currentAxis);}
00061 void setValue(double v) {_currentPoint[ _currentAxis ]=v * _cells->scale(_currentAxis);}
00062 void setCurrentCell(int index) {_currentCell=index;}
00063
00064 void checkAxisDistances();
00065 void printCurrentPoint();
00066 void checkCurrentPoint();
00067 private:
00068 void setCell(int * cells, int nCells);
00069 void lowerIntersections(PdfCurve& f, double xMinLimit, int * cells, int nCells, double invS2);
00070 void higherIntersections(PdfCurve& f, double xMaxLimit, int * cells, int nCells, double invS2);
00071
00072 const ScaledModels * _cells;
00073
00074 int _currentAxis;
00075 int _currentCell;
00076 double * _currentPoint;
00077
00078 double * _axisDistances;
00079 };
00080
00081 inline void VoronoiNavigator::setCurrentPoint(int index)
00082 {
00083 TRACE;
00084 _currentCell=index;
00085 int nd=_cells->parameterCount();
00086 for(int id=0; id < nd; id++ ) {
00087 _currentPoint[ id ]=_cells->v(id)[_currentCell];
00088 }
00089 }
00090
00091 inline void VoronoiNavigator::setCurrentPoint(const int * coordinates)
00092 {
00093 TRACE;
00094 _currentCell=-1;
00095 int nd=_cells->parameterCount();
00096 for(int id=0; id < nd; id++ ) {
00097 _currentPoint[ id ]=_cells->scale(id) * coordinates[id];
00098 }
00099 }
00100
00101 }
00102
00103 #endif // VORONOINAVIGATOR_H