Mod/Points moved from float -> double
This commit is contained in:
parent
e233f0cb6d
commit
4dcc5eb6cb
|
@ -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
|
||||
|
|
|
@ -70,8 +70,8 @@ Data::Segment* PointKernel::getSubElement(const char* Type, unsigned long n) con
|
|||
|
||||
void PointKernel::transformGeometry(const Base::Matrix4D &rclMat)
|
||||
{
|
||||
std::vector<Base::Vector3f>& kernel = getBasicPoints();
|
||||
for (std::vector<Base::Vector3f>::iterator it = kernel.begin(); it != kernel.end(); ++it)
|
||||
std::vector<Base::Vector3d>& kernel = getBasicPoints();
|
||||
for (std::vector<Base::Vector3d>::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<Base::Vector3f>::const_iterator it = _Points.begin(); it != _Points.end(); ++it) {
|
||||
// store the data without transforming it
|
||||
for (std::vector<Base::Vector3d>::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<Base::Vector3d> &Points,std::vector<Facet
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
PointKernel::const_point_iterator::const_point_iterator
|
||||
(const PointKernel* kernel, std::vector<Base::Vector3f>::const_iterator index)
|
||||
(const PointKernel* kernel, std::vector<Base::Vector3d>::const_iterator index)
|
||||
: _kernel(kernel), _p_it(index)
|
||||
{
|
||||
if(_p_it != kernel->_Points.end())
|
||||
|
|
|
@ -73,9 +73,9 @@ public:
|
|||
|
||||
inline void setTransform(const Base::Matrix4D& rclTrf){_Mtrx = rclTrf;}
|
||||
inline Base::Matrix4D getTransform(void) const{return _Mtrx;}
|
||||
std::vector<Base::Vector3f>& getBasicPoints()
|
||||
std::vector<Base::Vector3d>& getBasicPoints()
|
||||
{ return this->_Points; }
|
||||
const std::vector<Base::Vector3f>& getBasicPoints() const
|
||||
const std::vector<Base::Vector3d>& getBasicPoints() const
|
||||
{ return this->_Points; }
|
||||
void getFaces(std::vector<Base::Vector3d> &Points,std::vector<Facet> &Topo,
|
||||
float Accuracy, uint16_t flags=0) const;
|
||||
|
@ -99,11 +99,11 @@ public:
|
|||
|
||||
private:
|
||||
Base::Matrix4D _Mtrx;
|
||||
std::vector<Base::Vector3f> _Points;
|
||||
std::vector<Base::Vector3d> _Points;
|
||||
|
||||
public:
|
||||
typedef std::vector<Base::Vector3f>::difference_type difference_type;
|
||||
typedef std::vector<Base::Vector3f>::size_type size_type;
|
||||
typedef std::vector<Base::Vector3d>::difference_type difference_type;
|
||||
typedef std::vector<Base::Vector3d>::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<Base::Vector3f>::const_iterator iter_type;
|
||||
typedef std::vector<Base::Vector3d>::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<Base::Vector3f>::const_iterator index);
|
||||
const_point_iterator(const PointKernel*, std::vector<Base::Vector3d>::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<Base::Vector3f>::const_iterator _p_it;
|
||||
std::vector<Base::Vector3d>::const_iterator _p_it;
|
||||
};
|
||||
|
||||
typedef const_point_iterator const_iterator;
|
||||
|
|
|
@ -204,7 +204,7 @@ unsigned long PointsGrid::InSide (const Base::BoundBox3d &rclBB, std::vector<uns
|
|||
return raulElements.size();
|
||||
}
|
||||
|
||||
unsigned long PointsGrid::InSide (const Base::BoundBox3d &rclBB, std::vector<unsigned long> &raulElements, const Base::Vector3d &rclOrg, float fMaxDist, bool bDelDoubles) const
|
||||
unsigned long PointsGrid::InSide (const Base::BoundBox3d &rclBB, std::vector<unsigned long> &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();
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
virtual unsigned long InSide (const Base::BoundBox3d &rclBB, std::set<unsigned long> &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<unsigned long> &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<unsigned long> &rclInd) const;
|
||||
//@}
|
||||
|
|
|
@ -159,10 +159,10 @@ void PropertyCurvatureList::setValues(const std::vector<CurvatureInfo>& lValues)
|
|||
hasSetValue();
|
||||
}
|
||||
|
||||
std::vector<float> PropertyCurvatureList::getCurvature( int mode ) const
|
||||
std::vector<double> PropertyCurvatureList::getCurvature( int mode ) const
|
||||
{
|
||||
const std::vector<Points::CurvatureInfo>& fCurvInfo = getValues();
|
||||
std::vector<float> fValues;
|
||||
std::vector<double> fValues;
|
||||
fValues.reserve(fCurvInfo.size());
|
||||
|
||||
// Mean curvature
|
||||
|
|
|
@ -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<CurvatureInfo>&);
|
||||
std::vector<float> getCurvature( int tMode) const;
|
||||
std::vector<double> getCurvature( int tMode) const;
|
||||
|
||||
/// index operator
|
||||
const CurvatureInfo& operator[] (const int idx) const {return _lValueList.operator[] (idx);}
|
||||
|
|
|
@ -469,9 +469,9 @@ void ViewProviderPointsBuilder::createPoints(const App::Property* prop, SoCoordi
|
|||
|
||||
// get all points
|
||||
int idx=0;
|
||||
const std::vector<Base::Vector3f>& kernel = cPts.getBasicPoints();
|
||||
for (std::vector<Base::Vector3f>::const_iterator it = kernel.begin(); it != kernel.end(); ++it, idx++) {
|
||||
coords->point.set1Value(idx, it->x, it->y, it->z);
|
||||
const std::vector<Base::Vector3d>& kernel = cPts.getBasicPoints();
|
||||
for (std::vector<Base::Vector3d>::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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user