diff --git a/src/App/ComplexGeoData.h b/src/App/ComplexGeoData.h index 5e69badbf..8381417ea 100644 --- a/src/App/ComplexGeoData.h +++ b/src/App/ComplexGeoData.h @@ -153,6 +153,11 @@ protected: { return getTransform() * Base::Vector3d(vec.x,vec.y,vec.z); } + /// from local to outside + inline Base::Vector3d transformToOutside3d(const Base::Vector3d& vec) const + { + return getTransform() * vec; + } /// from local to inside inline Base::Vector3f transformToInside(const Base::Vector3d& vec) const @@ -162,6 +167,12 @@ protected: Base::Vector3d tmp = tmpM * vec; return Base::Vector3f((float)tmp.x,(float)tmp.y,(float)tmp.z); } + inline Base::Vector3d transformToInside3d(const Base::Vector3d& vec) const + { + Base::Matrix4D tmpM(getTransform()); + tmpM.inverse(); + return tmpM * vec; + } //Base::Matrix4D _Mtrx; }; @@ -169,4 +180,4 @@ protected: } //namespace App -#endif +#endif diff --git a/src/Mod/Points/App/Points.cpp b/src/Mod/Points/App/Points.cpp index 1156aea12..9ecdb826d 100644 --- a/src/Mod/Points/App/Points.cpp +++ b/src/Mod/Points/App/Points.cpp @@ -70,8 +70,8 @@ Data::Segment* PointKernel::getSubElement(const char* Type, unsigned long n) con void PointKernel::transformGeometry(const Base::Matrix4D &rclMat) { - std::vector& kernel = getBasicPoints(); - for (std::vector::iterator it = kernel.begin(); it != kernel.end(); ++it) + std::vector& kernel = getBasicPoints(); + for (std::vector::iterator it = kernel.begin(); it != kernel.end(); ++it) *it = rclMat * (*it); } @@ -94,7 +94,7 @@ void PointKernel::operator = (const PointKernel& Kernel) unsigned int PointKernel::getMemSize (void) const { - return _Points.size() * sizeof(Base::Vector3f); + return _Points.size() * sizeof(Base::Vector3d); } void PointKernel::Save (Base::Writer &writer) const @@ -111,8 +111,8 @@ void PointKernel::SaveDocFile (Base::Writer &writer) const Base::OutputStream str(writer.Stream()); uint32_t uCt = (uint32_t)size(); str << uCt; - // store the data without transforming it and save as float, not double - for (std::vector::const_iterator it = _Points.begin(); it != _Points.end(); ++it) { + // store the data without transforming it + for (std::vector::const_iterator it = _Points.begin(); it != _Points.end(); ++it) { str << it->x << it->y << it->z; } } @@ -141,6 +141,9 @@ void PointKernel::RestoreDocFile(Base::Reader &reader) str >> uCt; _Points.resize(uCt); for (unsigned long i=0; i < uCt; i++) { +// if doubleFileVersion +// double x, y, z +// else float x, y, z; str >> x >> y >> z; _Points[i].Set(x,y,z); @@ -176,7 +179,7 @@ void PointKernel::getFaces(std::vector &Points,std::vector::const_iterator index) +(const PointKernel* kernel, std::vector::const_iterator index) : _kernel(kernel), _p_it(index) { if(_p_it != kernel->_Points.end()) diff --git a/src/Mod/Points/App/Points.h b/src/Mod/Points/App/Points.h index 2da670a62..06efa3c4f 100644 --- a/src/Mod/Points/App/Points.h +++ b/src/Mod/Points/App/Points.h @@ -73,9 +73,9 @@ public: inline void setTransform(const Base::Matrix4D& rclTrf){_Mtrx = rclTrf;} inline Base::Matrix4D getTransform(void) const{return _Mtrx;} - std::vector& getBasicPoints() + std::vector& getBasicPoints() { return this->_Points; } - const std::vector& getBasicPoints() const + const std::vector& getBasicPoints() const { return this->_Points; } void getFaces(std::vector &Points,std::vector &Topo, float Accuracy, uint16_t flags=0) const; @@ -99,11 +99,11 @@ public: private: Base::Matrix4D _Mtrx; - std::vector _Points; + std::vector _Points; public: - typedef std::vector::difference_type difference_type; - typedef std::vector::size_type size_type; + typedef std::vector::difference_type difference_type; + typedef std::vector::size_type size_type; /// number of points stored size_type size(void) const {return this->_Points.size();} @@ -118,28 +118,28 @@ public: /// get the points inline const Base::Vector3d getPoint(const int idx) const { - return transformToOutside(_Points[idx]); + return transformToOutside3d(_Points[idx]); } /// set the points inline void setPoint(const int idx,const Base::Vector3d& point) { - _Points[idx] = transformToInside(point); + _Points[idx] = transformToInside3d(point); } /// insert the points inline void push_back(const Base::Vector3d& point) { - _Points.push_back(transformToInside(point)); + _Points.push_back(transformToInside3d(point)); } class PointsExport const_point_iterator { public: - typedef std::vector::const_iterator iter_type; + typedef std::vector::const_iterator iter_type; typedef iter_type::difference_type difference_type; typedef iter_type::iterator_category iterator_category; typedef const Base::Vector3d* pointer; typedef const Base::Vector3d& reference; typedef Base::Vector3d value_type; - const_point_iterator(const PointKernel*, std::vector::const_iterator index); + const_point_iterator(const PointKernel*, std::vector::const_iterator index); const_point_iterator(const const_point_iterator& pi); //~const_point_iterator(); @@ -161,7 +161,7 @@ public: void dereference(); const PointKernel* _kernel; Base::Vector3d _point; - std::vector::const_iterator _p_it; + std::vector::const_iterator _p_it; }; typedef const_point_iterator const_iterator; diff --git a/src/Mod/Points/App/PointsGrid.cpp b/src/Mod/Points/App/PointsGrid.cpp index 9bc45d623..6525df931 100644 --- a/src/Mod/Points/App/PointsGrid.cpp +++ b/src/Mod/Points/App/PointsGrid.cpp @@ -204,7 +204,7 @@ unsigned long PointsGrid::InSide (const Base::BoundBox3d &rclBB, std::vector &raulElements, const Base::Vector3d &rclOrg, float fMaxDist, bool bDelDoubles) const +unsigned long PointsGrid::InSide (const Base::BoundBox3d &rclBB, std::vector &raulElements, const Base::Vector3d &rclOrg, double fMaxDist, bool bDelDoubles) const { unsigned long i, j, k, ulMinX, ulMinY, ulMinZ, ulMaxX, ulMaxY, ulMaxZ; double fGridDiag = GetBoundBox(0, 0, 0).CalcDiagonalLength(); diff --git a/src/Mod/Points/App/PointsGrid.h b/src/Mod/Points/App/PointsGrid.h index f827be764..30ef0cc82 100644 --- a/src/Mod/Points/App/PointsGrid.h +++ b/src/Mod/Points/App/PointsGrid.h @@ -84,7 +84,7 @@ public: virtual unsigned long InSide (const Base::BoundBox3d &rclBB, std::set &raulElementss) const; /** Searches for elements lying in the intersection area of the grid and the bounding box. */ virtual unsigned long InSide (const Base::BoundBox3d &rclBB, std::vector &raulElements, - const Base::Vector3d &rclOrg, float fMaxDist, bool bDelDoubles = true) const; + const Base::Vector3d &rclOrg, double fMaxDist, bool bDelDoubles = true) const; /** Searches for the nearest grids that contain elements from a point, the result are grid indices. */ void SearchNearestFromPoint (const Base::Vector3d &rclPt, std::set &rclInd) const; //@} diff --git a/src/Mod/Points/App/Properties.cpp b/src/Mod/Points/App/Properties.cpp index aba32ce2c..ee8af76ca 100644 --- a/src/Mod/Points/App/Properties.cpp +++ b/src/Mod/Points/App/Properties.cpp @@ -159,10 +159,10 @@ void PropertyCurvatureList::setValues(const std::vector& lValues) hasSetValue(); } -std::vector PropertyCurvatureList::getCurvature( int mode ) const +std::vector PropertyCurvatureList::getCurvature( int mode ) const { const std::vector& fCurvInfo = getValues(); - std::vector fValues; + std::vector fValues; fValues.reserve(fCurvInfo.size()); // Mean curvature diff --git a/src/Mod/Points/App/Properties.h b/src/Mod/Points/App/Properties.h index fa4aa46d4..6832f5427 100644 --- a/src/Mod/Points/App/Properties.h +++ b/src/Mod/Points/App/Properties.h @@ -101,7 +101,7 @@ public: /** Curvature information. */ struct PointsExport CurvatureInfo { - float fMaxCurvature, fMinCurvature; + double fMaxCurvature, fMinCurvature; Base::Vector3f cMaxCurvDir, cMinCurvDir; }; @@ -128,7 +128,7 @@ public: int getSize(void) const {return _lValueList.size();} void setValue(const CurvatureInfo&); void setValues(const std::vector&); - std::vector getCurvature( int tMode) const; + std::vector getCurvature( int tMode) const; /// index operator const CurvatureInfo& operator[] (const int idx) const {return _lValueList.operator[] (idx);} diff --git a/src/Mod/Points/Gui/ViewProvider.cpp b/src/Mod/Points/Gui/ViewProvider.cpp index cbf165d1b..bc0cb3040 100644 --- a/src/Mod/Points/Gui/ViewProvider.cpp +++ b/src/Mod/Points/Gui/ViewProvider.cpp @@ -469,9 +469,9 @@ void ViewProviderPointsBuilder::createPoints(const App::Property* prop, SoCoordi // get all points int idx=0; - const std::vector& kernel = cPts.getBasicPoints(); - for (std::vector::const_iterator it = kernel.begin(); it != kernel.end(); ++it, idx++) { - coords->point.set1Value(idx, it->x, it->y, it->z); + const std::vector& kernel = cPts.getBasicPoints(); + for (std::vector::const_iterator it = kernel.begin(); it != kernel.end(); ++it, idx++) { + coords->point.set1Value(idx, (float)it->x, (float)it->y, (float)it->z); } points->numPoints = cPts.size();