diff --git a/src/Base/BoundBox.h b/src/Base/BoundBox.h index 74b464fa2c2d..48285fc07a74 100644 --- a/src/Base/BoundBox.h +++ b/src/Base/BoundBox.h @@ -84,9 +84,9 @@ class BoundBox3 /** Checks for intersection. */ inline bool operator && (const BoundBox3<_Precision> &rcBB) const; /** Checks for intersection. */ - inline bool Intersect (const BoundBox2D &rcBB) const; + inline bool Intersect (const BoundBox2d &rcBB) const; /** Checks for intersection. */ - inline bool operator && (const BoundBox2D &rcBB) const; + inline bool operator && (const BoundBox2d &rcBB) const; /** Computes the intersection between two bounding boxes. * The result is also a bounding box. */ @@ -112,7 +112,7 @@ class BoundBox3 /** Checks if this 2D box lies inside the box. * @note It's up to the client programmer to make sure that both bounding boxes are valid. */ - inline bool IsInBox (const BoundBox2D &rcbb) const; + inline bool IsInBox (const BoundBox2d &rcbb) const; /** Checks whether the bounding box is valid. */ bool IsValid (void) const; //@} @@ -167,7 +167,7 @@ class BoundBox3 */ Vector3<_Precision> ClosestPoint (const Vector3<_Precision> &rclPt) const; /** Projects the box onto a plane and returns a 2D box. */ - BoundBox2D ProjectBox(const ViewProjMethod *rclP) const; + BoundBox2d ProjectBox(const ViewProjMethod *rclP) const; /** Transform the corners of this box with the given matrix and create a new bounding box. * @note It's up to the client programmer to make sure that this bounding box is valid. */ @@ -299,17 +299,17 @@ bool BoundBox3<_Precision>::operator && (const BoundBox3<_Precision> &rcBB) cons } template -inline bool BoundBox3<_Precision>::Intersect (const BoundBox2D &rcBB) const +inline bool BoundBox3<_Precision>::Intersect (const BoundBox2d &rcBB) const { - if (rcBB.fMaxX < this->MinX || rcBB.fMinX > this->MaxX) + if (rcBB.MaxX < this->MinX || rcBB.MinX > this->MaxX) return false; - if (rcBB.fMaxY < this->MinY || rcBB.fMinY > this->MaxY) + if (rcBB.MaxY < this->MinY || rcBB.MinY > this->MaxY) return false; return true; } template -inline bool BoundBox3<_Precision>::operator && (const BoundBox2D &rcBB) const +inline bool BoundBox3<_Precision>::operator && (const BoundBox2d &rcBB) const { return Intersect(rcBB); } @@ -391,11 +391,11 @@ inline bool BoundBox3<_Precision>::IsInBox (const BoundBox3<_Precision> &rcBB) c } template -inline bool BoundBox3<_Precision>::IsInBox (const BoundBox2D &rcBB) const +inline bool BoundBox3<_Precision>::IsInBox (const BoundBox2d &rcBB) const { - if (rcBB.fMinX < this->MinX || rcBB.fMaxX > this->MaxX) + if (rcBB.MinX < this->MinX || rcBB.MaxX > this->MaxX) return false; - if (rcBB.fMinY < this->MinY || rcBB.fMaxY > this->MaxY) + if (rcBB.MinY < this->MinY || rcBB.MaxY > this->MaxY) return false; return true; } @@ -872,14 +872,14 @@ inline Vector3<_Precision> BoundBox3<_Precision>::ClosestPoint (const Vector3<_P } template -inline BoundBox2D BoundBox3<_Precision>::ProjectBox(const ViewProjMethod *pclP) const +inline BoundBox2d BoundBox3<_Precision>::ProjectBox(const ViewProjMethod *pclP) const { - BoundBox2D clBB2D; + BoundBox2d clBB2D; clBB2D.SetVoid(); for (int i = 0; i < 8; i++) { Vector3<_Precision> clTrsPt = (*pclP)(CalcPoint(i)); - clBB2D.Add(Vector2D(clTrsPt.x, clTrsPt.y)); + clBB2D.Add(Vector2d(clTrsPt.x, clTrsPt.y)); } return clBB2D; diff --git a/src/Base/Tools2D.cpp b/src/Base/Tools2D.cpp index ca7c844956df..b2703207daec 100644 --- a/src/Base/Tools2D.cpp +++ b/src/Base/Tools2D.cpp @@ -33,7 +33,7 @@ using namespace Base; -double Vector2D::GetAngle (const Vector2D &rclVect) const +double Vector2d::GetAngle (const Vector2d &rclVect) const { double fDivid, fNum; @@ -54,83 +54,83 @@ double Vector2D::GetAngle (const Vector2D &rclVect) const return -FLOAT_MAX; // division by zero } -void Vector2D::ProjectToLine (const Vector2D &rclPt, const Vector2D &rclLine) +void Vector2d::ProjectToLine (const Vector2d &rclPt, const Vector2d &rclLine) { double l = rclLine.Length(); double t1 = (rclPt * rclLine) / l; - Vector2D clNormal = rclLine; + Vector2d clNormal = rclLine; clNormal.Normalize(); clNormal.Scale(t1); *this = clNormal; } /********************************************************/ -/** BOUNDBOX2D ********************************************/ +/** BOUNDBOX2d ********************************************/ -bool BoundBox2D::Intersect(const Line2D &rclLine) const +bool BoundBox2d::Intersect(const Line2d &rclLine) const { - Line2D clThisLine; - Vector2D clVct; + Line2d clThisLine; + Vector2d clVct; // first line - clThisLine.clV1.fX = fMinX; - clThisLine.clV1.fY = fMinY; - clThisLine.clV2.fX = fMaxX; - clThisLine.clV2.fY = fMinY; + clThisLine.clV1.x = MinX; + clThisLine.clV1.y = MinY; + clThisLine.clV2.x = MaxX; + clThisLine.clV2.y = MinY; if (clThisLine.IntersectAndContain (rclLine, clVct)) return true; // second line clThisLine.clV1 = clThisLine.clV2; - clThisLine.clV2.fX = fMaxX; - clThisLine.clV2.fY = fMaxY; + clThisLine.clV2.x = MaxX; + clThisLine.clV2.y = MaxY; if (clThisLine.IntersectAndContain (rclLine, clVct)) return true; // third line clThisLine.clV1 = clThisLine.clV2; - clThisLine.clV2.fX = fMinX; - clThisLine.clV2.fY = fMaxY; + clThisLine.clV2.x = MinX; + clThisLine.clV2.y = MaxY; if (clThisLine.IntersectAndContain (rclLine, clVct)) return true; // fourth line clThisLine.clV1 = clThisLine.clV2; - clThisLine.clV2.fX = fMinX; - clThisLine.clV2.fY = fMinY; + clThisLine.clV2.x = MinX; + clThisLine.clV2.y = MinY; if (clThisLine.IntersectAndContain (rclLine, clVct)) return true; return false; } -bool BoundBox2D::Intersect(const BoundBox2D &rclBB) const +bool BoundBox2d::Intersect(const BoundBox2d &rclBB) const { //// compare bb2-points to this -//if (Contains (Vector2D (rclBB.fMinX, rclBB.fMinY))) return true; -//if (Contains (Vector2D (rclBB.fMaxX, rclBB.fMinY))) return true; -//if (Contains (Vector2D (rclBB.fMaxX, rclBB.fMaxY))) return true; -//if (Contains (Vector2D (rclBB.fMinX, rclBB.fMaxY))) return true; +//if (Contains (Vector2d (rclBB.fMinX, rclBB.fMinY))) return true; +//if (Contains (Vector2d (rclBB.fMaxX, rclBB.fMinY))) return true; +//if (Contains (Vector2d (rclBB.fMaxX, rclBB.fMaxY))) return true; +//if (Contains (Vector2d (rclBB.fMinX, rclBB.fMaxY))) return true; // //// compare this-points to bb2 -//if (rclBB.Contains (Vector2D (fMinX, fMinY))) return true; -//if (rclBB.Contains (Vector2D (fMaxX, fMinY))) return true; -//if (rclBB.Contains (Vector2D (fMaxX, fMaxY))) return true; -//if (rclBB.Contains (Vector2D (fMinX, fMaxY))) return true; - - if (fMinX < rclBB.fMaxX && - rclBB.fMinX < fMaxX && - fMinY < rclBB.fMaxY && - rclBB.fMinY < fMaxY ) +//if (rclBB.Contains (Vector2d (fMinX, fMinY))) return true; +//if (rclBB.Contains (Vector2d (fMaxX, fMinY))) return true; +//if (rclBB.Contains (Vector2d (fMaxX, fMaxY))) return true; +//if (rclBB.Contains (Vector2d (fMinX, fMaxY))) return true; + + if (MinX < rclBB.MaxX && + rclBB.MinX < MaxX && + MinY < rclBB.MaxY && + rclBB.MinY < MaxY ) return true; else // no intersection return false; } -bool BoundBox2D::Intersect(const Polygon2D &rclPoly) const +bool BoundBox2d::Intersect(const Polygon2d &rclPoly) const { unsigned long i; - Line2D clLine; + Line2d clLine; // points contained in boundbox for (i = 0; i < rclPoly.GetCtVectors(); i++) @@ -138,10 +138,10 @@ bool BoundBox2D::Intersect(const Polygon2D &rclPoly) const return true; /***** RETURN INTERSECTION *********/ // points contained in polygon - if (rclPoly.Contains (Vector2D (fMinX, fMinY)) || - rclPoly.Contains (Vector2D (fMaxX, fMinY)) || - rclPoly.Contains (Vector2D (fMaxX, fMaxY)) || - rclPoly.Contains (Vector2D (fMinX, fMaxY))) + if (rclPoly.Contains (Vector2d (MinX, MinY)) || + rclPoly.Contains (Vector2d (MaxX, MinY)) || + rclPoly.Contains (Vector2d (MaxX, MaxY)) || + rclPoly.Contains (Vector2d (MinX, MaxY))) return true; /***** RETURN INTERSECTION *********/ // test intersections of bound-lines @@ -165,73 +165,73 @@ bool BoundBox2D::Intersect(const Polygon2D &rclPoly) const return false; } -bool BoundBox2D::Contains (const Vector2D &rclV) const +bool BoundBox2d::Contains (const Vector2d &rclV) const { return - (rclV.fX >= fMinX) && (rclV.fX <= fMaxX) && - (rclV.fY >= fMinY) && (rclV.fY <= fMaxY); + (rclV.x >= MinX) && (rclV.x <= MaxX) && + (rclV.y >= MinY) && (rclV.y <= MaxY); } /********************************************************/ /** LINE2D **********************************************/ -BoundBox2D Line2D::CalcBoundBox (void) const +BoundBox2d Line2d::CalcBoundBox (void) const { - BoundBox2D clBB; - clBB.fMinX = std::min (clV1.fX, clV2.fX); - clBB.fMinY = std::min (clV1.fY, clV2.fY); - clBB.fMaxX = std::max (clV1.fX, clV2.fX); - clBB.fMaxY = std::max (clV1.fY, clV2.fY); + BoundBox2d clBB; + clBB.MinX = std::min (clV1.x, clV2.x); + clBB.MinY = std::min (clV1.y, clV2.y); + clBB.MaxX = std::max (clV1.x, clV2.x); + clBB.MaxY = std::max (clV1.y, clV2.y); return clBB; } -bool Line2D::Intersect (const Line2D& rclLine, Vector2D &rclV) const +bool Line2d::Intersect (const Line2d& rclLine, Vector2d &rclV) const { double m1, m2, b1, b2; // calc coefficients - if (fabs (clV2.fX - clV1.fX) > 1e-10) - m1 = (clV2.fY - clV1.fY) / (clV2.fX - clV1.fX); + if (fabs (clV2.x - clV1.x) > 1e-10) + m1 = (clV2.y - clV1.y) / (clV2.x - clV1.x); else m1 = FLOAT_MAX; - if (fabs (rclLine.clV2.fX - rclLine.clV1.fX) > 1e-10) - m2 = (rclLine.clV2.fY - rclLine.clV1.fY) / (rclLine.clV2.fX - rclLine.clV1.fX); + if (fabs (rclLine.clV2.x - rclLine.clV1.x) > 1e-10) + m2 = (rclLine.clV2.y - rclLine.clV1.y) / (rclLine.clV2.x - rclLine.clV1.x); else m2 = FLOAT_MAX; if (m1 == m2) /****** RETURN ERR (parallel lines) *************/ return false; - b1 = clV1.fY - m1 * clV1.fX; - b2 = rclLine.clV1.fY - m2 * rclLine.clV1.fX; + b1 = clV1.y - m1 * clV1.x; + b2 = rclLine.clV1.y - m2 * rclLine.clV1.x; // calc intersection if (m1 == FLOAT_MAX) { - rclV.fX = clV1.fX; - rclV.fY = m2 * rclV.fX + b2; + rclV.x = clV1.x; + rclV.y = m2 * rclV.x + b2; } else if (m2 == FLOAT_MAX) { - rclV.fX = rclLine.clV1.fX; - rclV.fY = m1 * rclV.fX + b1; + rclV.x = rclLine.clV1.x; + rclV.y = m1 * rclV.x + b1; } else { - rclV.fX = (b2 - b1) / (m1 - m2); - rclV.fY = m1 * rclV.fX + b1; + rclV.x = (b2 - b1) / (m1 - m2); + rclV.y = m1 * rclV.x + b1; } return true; /*** RETURN true (intersection) **********/ } -bool Line2D::Intersect (const Vector2D &rclV, double eps) const +bool Line2d::Intersect (const Vector2d &rclV, double eps) const { - double dxc = rclV.fX - clV1.fX; - double dyc = rclV.fY - clV1.fY; + double dxc = rclV.x - clV1.x; + double dyc = rclV.y - clV1.y; - double dxl = clV2.fX - clV1.fX; - double dyl = clV2.fY - clV1.fY; + double dxl = clV2.x - clV1.x; + double dyl = clV2.y - clV1.y; double cross = dxc * dyl - dyc * dxl; @@ -247,14 +247,14 @@ bool Line2D::Intersect (const Vector2D &rclV, double eps) const return true; } -Vector2D Line2D::FromPos (double fDistance) const +Vector2d Line2d::FromPos (double fDistance) const { - Vector2D clDir(clV2 - clV1); + Vector2d clDir(clV2 - clV1); clDir.Normalize(); - return Vector2D(clV1.fX + (clDir.fX * fDistance), clV1.fY + (clDir.fY * fDistance)); + return Vector2d(clV1.x + (clDir.x * fDistance), clV1.y + (clDir.y * fDistance)); } -bool Line2D::IntersectAndContain (const Line2D& rclLine, Vector2D &rclV) const +bool Line2d::IntersectAndContain (const Line2d& rclLine, Vector2d &rclV) const { bool rc = Intersect (rclLine, rclV); if (rc) @@ -263,18 +263,18 @@ bool Line2D::IntersectAndContain (const Line2D& rclLine, Vector2D &rclV) const } /********************************************************/ -/** POLYGON2D ********************************************/ +/** POLYGON2d ********************************************/ -BoundBox2D Polygon2D::CalcBoundBox (void) const +BoundBox2d Polygon2d::CalcBoundBox (void) const { unsigned long i; - BoundBox2D clBB; + BoundBox2d clBB; for (i = 0; i < _aclVct.size(); i++) { - clBB.fMinX = std::min (clBB.fMinX, _aclVct[i].fX); - clBB.fMinY = std::min (clBB.fMinY, _aclVct[i].fY); - clBB.fMaxX = std::max (clBB.fMaxX, _aclVct[i].fX); - clBB.fMaxY = std::max (clBB.fMaxY, _aclVct[i].fY); + clBB.MinX = std::min (clBB.MinX, _aclVct[i].x); + clBB.MinY = std::min (clBB.MinY, _aclVct[i].y); + clBB.MaxX = std::max (clBB.MaxX, _aclVct[i].x); + clBB.MaxY = std::max (clBB.MaxY, _aclVct[i].y); } return clBB; } @@ -314,7 +314,7 @@ static short _CalcTorsion (double *pfLine, double fX, double fY) return 0; } -bool Polygon2D::Contains (const Vector2D &rclV) const +bool Polygon2d::Contains (const Vector2d &rclV) const { // Ermittelt mit dem Verfahren der Windungszahl, ob ein Punkt innerhalb // eines Polygonzugs enthalten ist. @@ -333,29 +333,29 @@ bool Polygon2D::Contains (const Vector2D &rclV) const if (i == GetCtVectors() - 1) { // Polygon automatisch schliessen - pfTmp[0] = _aclVct[i].fX; - pfTmp[1] = _aclVct[i].fY; - pfTmp[2] = _aclVct[0].fX; - pfTmp[3] = _aclVct[0].fY; + pfTmp[0] = _aclVct[i].x; + pfTmp[1] = _aclVct[i].y; + pfTmp[2] = _aclVct[0].x; + pfTmp[3] = _aclVct[0].y; } else { // uebernehmen Punkt i und i+1 - pfTmp[0] = _aclVct[i].fX; - pfTmp[1] = _aclVct[i].fY; - pfTmp[2] = _aclVct[i + 1].fX; - pfTmp[3] = _aclVct[i + 1].fY; + pfTmp[0] = _aclVct[i].x; + pfTmp[1] = _aclVct[i].y; + pfTmp[2] = _aclVct[i + 1].x; + pfTmp[3] = _aclVct[i + 1].y; } // Schnitt-Test durchfuehren und Windungszaehler berechnen - sTorsion += _CalcTorsion (pfTmp, rclV.fX, rclV.fY); + sTorsion += _CalcTorsion (pfTmp, rclV.x, rclV.y); } // Windungszaehler auswerten return sTorsion != 0; } -void Polygon2D::Intersect (const Polygon2D &rclPolygon, std::list &rclResultPolygonList) const +void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list &rclResultPolygonList) const { // trimmen des uebergebenen Polygons mit dem aktuellen, Ergebnis ist eine Liste von Polygonen (Untermenge des uebergebenen Polygons) // das eigene (Trim-) Polygon ist geschlossen @@ -366,7 +366,7 @@ void Polygon2D::Intersect (const Polygon2D &rclPolygon, std::list &rc // position of first points (in or out of polygon) bool bInner = Contains(rclPolygon[0]); - Polygon2D clResultPolygon; + Polygon2d clResultPolygon; if (bInner == true) // add first point if inner trim-polygon clResultPolygon.Add(rclPolygon[0]); @@ -375,19 +375,19 @@ void Polygon2D::Intersect (const Polygon2D &rclPolygon, std::list &rc size_t ulTrimCt = GetCtVectors(); for (size_t ulVec = 0; ulVec < (ulPolyCt-1); ulVec++) { - Vector2D clPt0 = rclPolygon[ulVec]; - Vector2D clPt1 = rclPolygon[ulVec+1]; - Line2D clLine(clPt0, clPt1); + Vector2d clPt0 = rclPolygon[ulVec]; + Vector2d clPt1 = rclPolygon[ulVec+1]; + Line2d clLine(clPt0, clPt1); // try to intersect with each line of the trim-polygon std::set afIntersections; // set of intersections (sorted by line parameter) - Vector2D clTrimPt2; // second line point + Vector2d clTrimPt2; // second line point for (size_t i = 0; i < ulTrimCt; i++) { clTrimPt2 = At((i + 1) % ulTrimCt); - Line2D clToTrimLine(At(i), clTrimPt2); + Line2d clToTrimLine(At(i), clTrimPt2); - Vector2D clV; + Vector2d clV; if (clLine.IntersectAndContain(clToTrimLine, clV) == true) { // save line parameter of intersection point @@ -401,7 +401,7 @@ void Polygon2D::Intersect (const Polygon2D &rclPolygon, std::list &rc for (std::set::iterator pF = afIntersections.begin(); pF != afIntersections.end(); ++pF) { // intersection point - Vector2D clPtIS = clLine.FromPos(*pF); + Vector2d clPtIS = clLine.FromPos(*pF); if (bInner == true) { clResultPolygon.Add(clPtIS); @@ -431,16 +431,16 @@ void Polygon2D::Intersect (const Polygon2D &rclPolygon, std::list &rc rclResultPolygonList.push_back(clResultPolygon); } -bool Polygon2D::Intersect (const Vector2D &rclV, double eps) const +bool Polygon2d::Intersect (const Vector2d &rclV, double eps) const { if (_aclVct.size() < 2) return false; size_t numPts = GetCtVectors(); for (size_t i = 0; i < numPts; i++) { - Vector2D clPt0 = (*this)[i]; - Vector2D clPt1 = (*this)[(i+1)%numPts]; - Line2D clLine(clPt0, clPt1); + Vector2d clPt0 = (*this)[i]; + Vector2d clPt1 = (*this)[(i+1)%numPts]; + Line2d clLine(clPt0, clPt1); if (clLine.Intersect(rclV, eps)) return true; } diff --git a/src/Base/Tools2D.h b/src/Base/Tools2D.h index 3fc82a14550e..dc148d6722be 100644 --- a/src/Base/Tools2D.h +++ b/src/Base/Tools2D.h @@ -35,247 +35,246 @@ namespace Base { -class Vector2D; -class BoundBox2D; -class Line2D; -class Polygon2D; +class Vector2d; +class BoundBox2d; +class Line2d; +class Polygon2d; /** * The vector class for 2D calculations. */ -class BaseExport Vector2D +class BaseExport Vector2d { public: - double fX, fY; + double x, y; - inline Vector2D (void); - inline Vector2D (float x, float y); - inline Vector2D (double x, double y); - inline Vector2D (const Vector2D &rclVct); + inline Vector2d (void); + inline Vector2d (float x, float y); + inline Vector2d (double x, double y); + inline Vector2d (const Vector2d &rclVct); // methods inline double Length (void) const; // operators - inline Vector2D& operator= (const Vector2D &rclVct); - inline double operator* (const Vector2D &rclVct) const; - inline bool operator== (const Vector2D &rclVct) const; - inline Vector2D operator+ (const Vector2D &rclVct) const; - inline Vector2D operator- (const Vector2D &rclVct) const; - inline Vector2D operator/ (double c) const; + inline Vector2d& operator= (const Vector2d &rclVct); + inline double operator* (const Vector2d &rclVct) const; + inline bool operator== (const Vector2d &rclVct) const; + inline Vector2d operator+ (const Vector2d &rclVct) const; + inline Vector2d operator- (const Vector2d &rclVct) const; + inline Vector2d operator/ (double c) const; inline void Set (double fPX, double fPY); inline void Scale (double fS); inline void Normalize (void); - double GetAngle (const Vector2D &rclVect) const; - void ProjectToLine (const Vector2D &rclPt, const Vector2D &rclLine); + double GetAngle (const Vector2d &rclVect) const; + void ProjectToLine (const Vector2d &rclPt, const Vector2d &rclLine); }; -/** BoundBox2D ********************************************/ +/** BoundBox2d ********************************************/ /** * Two dimensional bounding box. */ -class BaseExport BoundBox2D +class BaseExport BoundBox2d { public: - double fMinX, fMinY, fMaxX, fMaxY; + double MinX, MinY, MaxX, MaxY; - inline BoundBox2D (void); - inline BoundBox2D (const BoundBox2D &rclBB); - inline BoundBox2D (double fX1, double fY1, double fX2, double fY2); + inline BoundBox2d (void); + inline BoundBox2d (const BoundBox2d &rclBB); + inline BoundBox2d (double fX1, double fY1, double fX2, double fY2); inline bool IsValid (void); // operators - inline BoundBox2D& operator= (const BoundBox2D& rclBB); - inline bool operator== (const BoundBox2D& rclBB) const; - bool Intersect(const Line2D &rclLine) const; - bool Intersect(const BoundBox2D &rclBB) const; - bool Intersect(const Polygon2D &rclPoly) const; - inline void Add(const Vector2D &rclVct); + inline BoundBox2d& operator= (const BoundBox2d& rclBB); + inline bool operator== (const BoundBox2d& rclBB) const; + bool Intersect(const Line2d &rclLine) const; + bool Intersect(const BoundBox2d &rclBB) const; + bool Intersect(const Polygon2d &rclPoly) const; + inline void Add(const Vector2d &rclVct); - void SetVoid (void) { fMinX = fMinY = DOUBLE_MAX; fMaxX = fMaxY = -DOUBLE_MAX; } + void SetVoid (void) { MinX = MinY = DOUBLE_MAX; MaxX = MaxY = -DOUBLE_MAX; } // misc - bool Contains (const Vector2D &rclV) const; + bool Contains (const Vector2d &rclV) const; }; -/** Line2D ********************************************/ +/** Line2d ********************************************/ /** * 2D line class. */ -class BaseExport Line2D +class BaseExport Line2d { public: - Vector2D clV1, clV2; + Vector2d clV1, clV2; - Line2D (void) {} - inline Line2D (const Line2D &rclLine); - inline Line2D (const Vector2D &rclV1, const Vector2D &rclV2); + Line2d (void) {} + inline Line2d (const Line2d &rclLine); + inline Line2d (const Vector2d &rclV1, const Vector2d &rclV2); // methods inline double Length (void) const; - BoundBox2D CalcBoundBox (void) const; + BoundBox2d CalcBoundBox (void) const; // operators - inline Line2D& operator= (const Line2D& rclLine); - inline bool operator== (const Line2D& rclLine) const; + inline Line2d& operator= (const Line2d& rclLine); + inline bool operator== (const Line2d& rclLine) const; // misc - inline bool Contains (const Vector2D &rclV) const; - bool Intersect (const Line2D& rclLine, Vector2D &rclV) const; - bool Intersect (const Vector2D &rclV, double eps) const; - bool IntersectAndContain (const Line2D& rclLine, Vector2D &rclV) const; - Vector2D FromPos (double fDistance) const; + inline bool Contains (const Vector2d &rclV) const; + bool Intersect (const Line2d& rclLine, Vector2d &rclV) const; + bool Intersect (const Vector2d &rclV, double eps) const; + bool IntersectAndContain (const Line2d& rclLine, Vector2d &rclV) const; + Vector2d FromPos (double fDistance) const; }; -/** Polygon2D ********************************************/ +/** Polygon2d ********************************************/ /** * 2D polygon class. */ -class BaseExport Polygon2D +class BaseExport Polygon2d { public: - Polygon2D (void) {} - inline Polygon2D (const Polygon2D &rclPoly); - virtual ~Polygon2D () {} + Polygon2d (void) {} + inline Polygon2d (const Polygon2d &rclPoly); + virtual ~Polygon2d () {} - inline Polygon2D& operator = (const Polygon2D &rclP); + inline Polygon2d& operator = (const Polygon2d &rclP); // admin-interface inline size_t GetCtVectors (void) const; - inline bool Add (const Vector2D &rclVct); - inline Vector2D& operator[] (size_t ulNdx) const; - inline Vector2D& At (size_t ulNdx) const; + inline bool Add (const Vector2d &rclVct); + inline Vector2d& operator[] (size_t ulNdx) const; + inline Vector2d& At (size_t ulNdx) const; inline bool Delete (size_t ulNdx); inline void DeleteAll (void); // misc - BoundBox2D CalcBoundBox (void) const; - bool Contains (const Vector2D &rclV) const; - void Intersect (const Polygon2D &rclPolygon, std::list &rclResultPolygonList) const; - bool Intersect (const Vector2D &rclV, double eps) const; + BoundBox2d CalcBoundBox (void) const; + bool Contains (const Vector2d &rclV) const; + void Intersect (const Polygon2d &rclPolygon, std::list &rclResultPolygonList) const; + bool Intersect (const Vector2d &rclV, double eps) const; private: - std::vector _aclVct; + std::vector _aclVct; }; /** INLINES ********************************************/ -inline Vector2D::Vector2D (void) -: fX(0.0), fY(0.0) +inline Vector2d::Vector2d (void) +: x(0.0), y(0.0) { } -inline Vector2D::Vector2D (float x, float y) -: fX (x), fY (y) +inline Vector2d::Vector2d (float x, float y) +: x(x), y(y) { } -inline Vector2D::Vector2D (double x, double y) -: fX(x), - fY(y) +inline Vector2d::Vector2d (double x, double y) +: x(x), y(y) { } -inline Vector2D::Vector2D (const Vector2D &rclVct) -: fX(rclVct.fX), fY(rclVct.fY) +inline Vector2d::Vector2d (const Vector2d &rclVct) +: x(rclVct.x), y(rclVct.y) { } -inline double Vector2D::Length (void) const +inline double Vector2d::Length (void) const { - return sqrt ((fX * fX) + (fY * fY)); + return sqrt ((x * x) + (y * y)); } -inline Vector2D& Vector2D::operator= (const Vector2D &rclVct) +inline Vector2d& Vector2d::operator= (const Vector2d &rclVct) { - fX = rclVct.fX; - fY = rclVct.fY; + x = rclVct.x; + y = rclVct.y; return *this; } -inline bool Vector2D::operator== (const Vector2D &rclVct) const +inline bool Vector2d::operator== (const Vector2d &rclVct) const { - return (fX == rclVct.fX) && (fY == rclVct.fY); + return (x == rclVct.x) && (y == rclVct.y); } -inline Vector2D Vector2D::operator+ (const Vector2D &rclVct) const +inline Vector2d Vector2d::operator+ (const Vector2d &rclVct) const { - return Vector2D(fX + rclVct.fX, fY + rclVct.fY); + return Vector2d(x + rclVct.x, y + rclVct.y); } -inline Vector2D Vector2D::operator- (const Vector2D &rclVct) const +inline Vector2d Vector2d::operator- (const Vector2d &rclVct) const { - return Vector2D(fX - rclVct.fX, fY - rclVct.fY); + return Vector2d(x - rclVct.x, y - rclVct.y); } -inline double Vector2D::operator* (const Vector2D &rclVct) const +inline double Vector2d::operator* (const Vector2d &rclVct) const { - return (fX * rclVct.fX) + (fY * rclVct.fY); + return (x * rclVct.x) + (y * rclVct.y); } -inline Vector2D Vector2D::operator/ (double c) const +inline Vector2d Vector2d::operator/ (double c) const { - return Vector2D(fX / c, fY / c); + return Vector2d(x / c, y / c); } -inline void Vector2D::Scale (double fS) +inline void Vector2d::Scale (double fS) { - fX *= fS; - fY *= fS; + x *= fS; + y *= fS; } -inline void Vector2D::Normalize (void) +inline void Vector2d::Normalize (void) { double fLen = Length(); if (fLen != 0.0f) { - fX /= fLen; - fY /= fLen; + x /= fLen; + y /= fLen; } } -inline void Vector2D::Set (double fPX, double fPY) +inline void Vector2d::Set (double fPX, double fPY) { - fX = fPX; - fY = fPY; + x = fPX; + y = fPY; } -inline Polygon2D::Polygon2D (const Polygon2D &rclPoly) +inline Polygon2d::Polygon2d (const Polygon2d &rclPoly) { *this = rclPoly; } -inline Polygon2D& Polygon2D::operator = (const Polygon2D &rclP) +inline Polygon2d& Polygon2d::operator = (const Polygon2d &rclP) { _aclVct = rclP._aclVct; return *this; } -inline void Polygon2D::DeleteAll (void) +inline void Polygon2d::DeleteAll (void) { _aclVct.clear(); } -inline size_t Polygon2D::GetCtVectors (void) const +inline size_t Polygon2d::GetCtVectors (void) const { return _aclVct.size (); } -inline bool Polygon2D::Add (const Vector2D &rclVct) +inline bool Polygon2d::Add (const Vector2d &rclVct) { _aclVct.push_back (rclVct); return true; } -inline bool Polygon2D::Delete (size_t ulNdx) +inline bool Polygon2d::Delete (size_t ulNdx) { if ( ulNdx < _aclVct.size() ) { - std::vector::iterator it = _aclVct.begin() + ulNdx; + std::vector::iterator it = _aclVct.begin() + ulNdx; _aclVct.erase ( it ); return true; } @@ -283,101 +282,101 @@ inline bool Polygon2D::Delete (size_t ulNdx) return false; } -inline Vector2D& Polygon2D::operator[] (size_t ulNdx) const +inline Vector2d& Polygon2d::operator[] (size_t ulNdx) const { - return (Vector2D&) _aclVct[ulNdx]; + return (Vector2d&) _aclVct[ulNdx]; } -inline Vector2D& Polygon2D::At (size_t ulNdx) const +inline Vector2d& Polygon2d::At (size_t ulNdx) const { - return (Vector2D&) _aclVct[ulNdx]; + return (Vector2d&) _aclVct[ulNdx]; } -inline Line2D::Line2D (const Line2D &rclLine) +inline Line2d::Line2d (const Line2d &rclLine) : clV1 (rclLine.clV1), clV2 (rclLine.clV2) { } -inline Line2D::Line2D (const Vector2D &rclV1, const Vector2D &rclV2) +inline Line2d::Line2d (const Vector2d &rclV1, const Vector2d &rclV2) : clV1 (rclV1), clV2 (rclV2) { } -inline double Line2D::Length (void) const +inline double Line2d::Length (void) const { return (clV2 - clV1).Length (); } -inline Line2D& Line2D::operator= (const Line2D& rclLine) +inline Line2d& Line2d::operator= (const Line2d& rclLine) { clV1 = rclLine.clV1; clV2 = rclLine.clV2; return *this; } -inline bool Line2D::operator== (const Line2D& rclLine) const +inline bool Line2d::operator== (const Line2d& rclLine) const { return (clV1 == rclLine.clV1) && (clV2 == rclLine.clV2); } -inline bool Line2D::Contains (const Vector2D &rclV) const +inline bool Line2d::Contains (const Vector2d &rclV) const { return CalcBoundBox ().Contains (rclV); } -inline BoundBox2D::BoundBox2D (void) +inline BoundBox2d::BoundBox2d (void) { - fMinX = fMinY = DOUBLE_MAX; - fMaxX = fMaxY = - DOUBLE_MAX; + MinX = MinY = DOUBLE_MAX; + MaxX = MaxY = - DOUBLE_MAX; } -inline BoundBox2D::BoundBox2D (const BoundBox2D &rclBB) - : fMinX (rclBB.fMinX), - fMinY (rclBB.fMinY), - fMaxX (rclBB.fMaxX), - fMaxY (rclBB.fMaxY) +inline BoundBox2d::BoundBox2d (const BoundBox2d &rclBB) + : MinX (rclBB.MinX), + MinY (rclBB.MinY), + MaxX (rclBB.MaxX), + MaxY (rclBB.MaxY) { } -inline BoundBox2D::BoundBox2D (double fX1, double fY1, double fX2, double fY2) +inline BoundBox2d::BoundBox2d (double fX1, double fY1, double fX2, double fY2) { - fMinX = std::min( fX1, fX2 ); - fMaxX = std::max( fX1, fX2 ); - fMinY = std::min( fY1, fY2 ); - fMaxY = std::max( fY1, fY2 ); + MinX = std::min( fX1, fX2 ); + MaxX = std::max( fX1, fX2 ); + MinY = std::min( fY1, fY2 ); + MaxY = std::max( fY1, fY2 ); } -inline bool BoundBox2D::IsValid (void) +inline bool BoundBox2d::IsValid (void) { - return (fMaxX >= fMinX) && (fMaxY >= fMinY); + return (MaxX >= MinX) && (MaxY >= MinY); } -inline BoundBox2D& BoundBox2D::operator= (const BoundBox2D& rclBB) +inline BoundBox2d& BoundBox2d::operator= (const BoundBox2d& rclBB) { - fMinX = rclBB.fMinX; - fMinY = rclBB.fMinY; - fMaxX = rclBB.fMaxX; - fMaxY = rclBB.fMaxY; + MinX = rclBB.MinX; + MinY = rclBB.MinY; + MaxX = rclBB.MaxX; + MaxY = rclBB.MaxY; return *this; } -inline bool BoundBox2D::operator== (const BoundBox2D& rclBB) const +inline bool BoundBox2d::operator== (const BoundBox2d& rclBB) const { return - (fMinX == rclBB.fMinX) && - (fMinY == rclBB.fMinY) && - (fMaxX == rclBB.fMaxX) && - (fMaxY == rclBB.fMaxY); + (MinX == rclBB.MinX) && + (MinY == rclBB.MinY) && + (MaxX == rclBB.MaxX) && + (MaxY == rclBB.MaxY); } -inline void BoundBox2D::Add(const Vector2D &rclVct) +inline void BoundBox2d::Add(const Vector2d &rclVct) { - fMinX = std::min(fMinX, rclVct.fX); - fMinY = std::min(fMinY, rclVct.fY); - fMaxX = std::max(fMaxX, rclVct.fX); - fMaxY = std::max(fMaxY, rclVct.fY); + MinX = std::min(MinX, rclVct.x); + MinY = std::min(MinY, rclVct.y); + MaxX = std::max(MaxX, rclVct.x); + MaxY = std::max(MaxY, rclVct.y); } } // namespace Base diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index c3f11bac6601..62b0d64be9ce 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -2272,14 +2272,14 @@ static void selectionCallback(void * ud, SoEventCallback * cb) SoCamera* cam = view->getSoRenderManager()->getCamera(); SbViewVolume vv = cam->getViewVolume(); Gui::ViewVolumeProjection proj(vv); - Base::Polygon2D polygon; + Base::Polygon2d polygon; if (picked.size() == 2) { SbVec2f pt1 = picked[0]; SbVec2f pt2 = picked[1]; - polygon.Add(Base::Vector2D(pt1[0], pt1[1])); - polygon.Add(Base::Vector2D(pt1[0], pt2[1])); - polygon.Add(Base::Vector2D(pt2[0], pt2[1])); - polygon.Add(Base::Vector2D(pt2[0], pt1[1])); + polygon.Add(Base::Vector2d(pt1[0], pt1[1])); + polygon.Add(Base::Vector2d(pt1[0], pt2[1])); + polygon.Add(Base::Vector2d(pt2[0], pt2[1])); + polygon.Add(Base::Vector2d(pt2[0], pt1[1])); // when selecting from right to left then select by intersection // oterwise if the center is inside the rectangle @@ -2288,7 +2288,7 @@ static void selectionCallback(void * ud, SoEventCallback * cb) } else { for (std::vector::const_iterator it = picked.begin(); it != picked.end(); ++it) - polygon.Add(Base::Vector2D((*it)[0],(*it)[1])); + polygon.Add(Base::Vector2d((*it)[0],(*it)[1])); } App::Document* doc = App::GetApplication().getActiveDocument(); @@ -2315,12 +2315,12 @@ static void selectionCallback(void * ud, SoEventCallback * cb) if (selectionMode == CENTER) { Base::Vector3d pt2d; pt2d = proj(bbox.GetCenter()); - if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y))) { + if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y))) { Gui::Selection().addSelection(doc->getName(), (*it)->getNameInDocument()); } } else { - Base::BoundBox2D bbox2 = bbox.ProjectBox(&proj); + Base::BoundBox2d bbox2 = bbox.ProjectBox(&proj); if (bbox2.Intersect(polygon)) { Gui::Selection().addSelection(doc->getName(), (*it)->getNameInDocument()); } diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp index 15a3ffc35b78..4ca785c732c4 100644 --- a/src/Mod/Fem/Gui/Command.cpp +++ b/src/Mod/Fem/Gui/Command.cpp @@ -906,9 +906,9 @@ void DefineNodesCallback(void * ud, SoEventCallback * n) SoCamera* cam = view->getSoRenderManager()->getCamera(); SbViewVolume vv = cam->getViewVolume(); Gui::ViewVolumeProjection proj(vv); - Base::Polygon2D polygon; + Base::Polygon2d polygon; for (std::vector::const_iterator it = clPoly.begin(); it != clPoly.end(); ++it) - polygon.Add(Base::Vector2D((*it)[0],(*it)[1])); + polygon.Add(Base::Vector2d((*it)[0],(*it)[1])); std::vector docObj = Gui::Selection().getObjectsOfType(Fem::FemMeshObject::getClassTypeId()); @@ -925,7 +925,7 @@ void DefineNodesCallback(void * ud, SoEventCallback * n) const SMDS_MeshNode* aNode = aNodeIter->next(); Base::Vector3f vec(aNode->X(),aNode->Y(),aNode->Z()); pt2d = proj(vec); - if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y)) == true) + if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y)) == true) IntSet.insert(aNode->GetID()); } diff --git a/src/Mod/Fem/Gui/TaskAnalysisInfo.h b/src/Mod/Fem/Gui/TaskAnalysisInfo.h index 7add923dd3cd..a40d02ac3bbb 100644 --- a/src/Mod/Fem/Gui/TaskAnalysisInfo.h +++ b/src/Mod/Fem/Gui/TaskAnalysisInfo.h @@ -34,7 +34,7 @@ class Ui_TaskAnalysisInfo; class SoEventCallback; namespace Base { - class Polygon2D; + class Polygon2d; } namespace App { class Property; diff --git a/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp b/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp index c49b8fef584a..62bf4425c174 100644 --- a/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp +++ b/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp @@ -151,15 +151,15 @@ void TaskCreateNodeSet::DefineNodesCallback(void * ud, SoEventCallback * n) SoCamera* cam = view->getSoRenderManager()->getCamera(); SbViewVolume vv = cam->getViewVolume(); Gui::ViewVolumeProjection proj(vv); - Base::Polygon2D polygon; + Base::Polygon2d polygon; for (std::vector::const_iterator it = clPoly.begin(); it != clPoly.end(); ++it) - polygon.Add(Base::Vector2D((*it)[0],(*it)[1])); + polygon.Add(Base::Vector2d((*it)[0],(*it)[1])); taskBox->DefineNodes(polygon,proj,clip_inner); } -void TaskCreateNodeSet::DefineNodes(const Base::Polygon2D &polygon,const Gui::ViewVolumeProjection &proj,bool inner) +void TaskCreateNodeSet::DefineNodes(const Base::Polygon2d &polygon,const Gui::ViewVolumeProjection &proj,bool inner) { const SMESHDS_Mesh* data = const_cast(pcObject->FemMesh.getValue()->FemMesh.getValue().getSMesh())->GetMeshDS(); @@ -173,7 +173,7 @@ void TaskCreateNodeSet::DefineNodes(const Base::Polygon2D &polygon,const Gui::Vi const SMDS_MeshNode* aNode = aNodeIter->next(); Base::Vector3f vec(aNode->X(),aNode->Y(),aNode->Z()); pt2d = proj(vec); - if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y)) == inner) + if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y)) == inner) tempSet.insert(aNode->GetID()); } diff --git a/src/Mod/Fem/Gui/TaskCreateNodeSet.h b/src/Mod/Fem/Gui/TaskCreateNodeSet.h index d42712bb06b6..741e0935a721 100644 --- a/src/Mod/Fem/Gui/TaskCreateNodeSet.h +++ b/src/Mod/Fem/Gui/TaskCreateNodeSet.h @@ -34,7 +34,7 @@ class Ui_TaskCreateNodeSet; class SoEventCallback; namespace Base { -class Polygon2D; +class Polygon2d; } namespace App { class Property; @@ -69,7 +69,7 @@ private Q_SLOTS: protected: Fem::FemSetNodesObject *pcObject; static void DefineNodesCallback(void * ud, SoEventCallback * n); - void DefineNodes(const Base::Polygon2D &polygon,const Gui::ViewVolumeProjection &proj,bool); + void DefineNodes(const Base::Polygon2d &polygon,const Gui::ViewVolumeProjection &proj,bool); protected: virtual void onSelectionChanged(const Gui::SelectionChanges& msg); diff --git a/src/Mod/Fem/Gui/TaskDriver.h b/src/Mod/Fem/Gui/TaskDriver.h index 2f4a8efd954a..28d3d334562e 100644 --- a/src/Mod/Fem/Gui/TaskDriver.h +++ b/src/Mod/Fem/Gui/TaskDriver.h @@ -34,7 +34,7 @@ class Ui_TaskDriver; class SoEventCallback; namespace Base { -class Polygon2D; +class Polygon2d; } namespace App { class Property; diff --git a/src/Mod/Fem/Gui/TaskTetParameter.h b/src/Mod/Fem/Gui/TaskTetParameter.h index a36b67a2c0a5..f56ea9a10dc7 100644 --- a/src/Mod/Fem/Gui/TaskTetParameter.h +++ b/src/Mod/Fem/Gui/TaskTetParameter.h @@ -31,7 +31,7 @@ class Ui_TaskTetParameter; class SoEventCallback; namespace Base { -class Polygon2D; +class Polygon2d; } namespace App { class Property; diff --git a/src/Mod/Mesh/App/Core/Algorithm.cpp b/src/Mod/Mesh/App/Core/Algorithm.cpp index 4eb21decbc97..1120d5a5ff6d 100644 --- a/src/Mod/Mesh/App/Core/Algorithm.cpp +++ b/src/Mod/Mesh/App/Core/Algorithm.cpp @@ -39,8 +39,8 @@ using namespace MeshCore; using Base::BoundBox3f; -using Base::BoundBox2D; -using Base::Polygon2D; +using Base::BoundBox2d; +using Base::Polygon2d; bool MeshAlgorithm::IsVertexVisible (const Base::Vector3f &rcVertex, const Base::Vector3f &rcView, const MeshFacetGrid &rclGrid) const @@ -1075,7 +1075,7 @@ int MeshAlgorithm::Surround(const Base::BoundBox3f& rBox, const Base::Vector3f& return -1; } -void MeshAlgorithm::CheckFacets(const MeshFacetGrid& rclGrid, const Base::ViewProjMethod* pclProj, const Base::Polygon2D& rclPoly, +void MeshAlgorithm::CheckFacets(const MeshFacetGrid& rclGrid, const Base::ViewProjMethod* pclProj, const Base::Polygon2d& rclPoly, bool bInner, std::vector &raulFacets) const { std::vector::iterator it; @@ -1088,7 +1088,7 @@ void MeshAlgorithm::CheckFacets(const MeshFacetGrid& rclGrid, const Base::ViewPr if (bInner) { BoundBox3f clBBox3d; - BoundBox2D clViewBBox, clPolyBBox; + BoundBox2d clViewBBox, clPolyBBox; std::vector aulAllElements; //B-Box des Polygons @@ -1121,7 +1121,7 @@ void MeshAlgorithm::CheckFacets(const MeshFacetGrid& rclGrid, const Base::ViewPr { clPt2d = pclProj->operator()(rclFacet._aclPoints[j]); clGravityOfFacet += clPt2d; - if (rclPoly.Contains(Base::Vector2D(clPt2d.x, clPt2d.y)) == bInner) + if (rclPoly.Contains(Base::Vector2d(clPt2d.x, clPt2d.y)) == bInner) { raulFacets.push_back(*it); bNoPointInside = false; @@ -1134,7 +1134,7 @@ void MeshAlgorithm::CheckFacets(const MeshFacetGrid& rclGrid, const Base::ViewPr { clGravityOfFacet *= 1.0f/3.0f; - if (rclPoly.Contains(Base::Vector2D(clGravityOfFacet.x, clGravityOfFacet.y)) == bInner) + if (rclPoly.Contains(Base::Vector2d(clGravityOfFacet.x, clGravityOfFacet.y)) == bInner) raulFacets.push_back(*it); } @@ -1150,7 +1150,7 @@ void MeshAlgorithm::CheckFacets(const MeshFacetGrid& rclGrid, const Base::ViewPr for (int j=0; j<3; j++) { clPt2d = pclProj->operator()(clIter->_aclPoints[j]); - if (rclPoly.Contains(Base::Vector2D(clPt2d.x, clPt2d.y)) == bInner) + if (rclPoly.Contains(Base::Vector2d(clPt2d.x, clPt2d.y)) == bInner) { raulFacets.push_back(clIter.Position()); break; @@ -1161,7 +1161,7 @@ void MeshAlgorithm::CheckFacets(const MeshFacetGrid& rclGrid, const Base::ViewPr } } -void MeshAlgorithm::CheckFacets(const Base::ViewProjMethod* pclProj, const Base::Polygon2D& rclPoly, +void MeshAlgorithm::CheckFacets(const Base::ViewProjMethod* pclProj, const Base::Polygon2d& rclPoly, bool bInner, std::vector &raulFacets) const { const MeshPointArray& p = _rclMesh.GetPoints(); @@ -1171,7 +1171,7 @@ void MeshAlgorithm::CheckFacets(const Base::ViewProjMethod* pclProj, const Base: for (MeshFacetArray::_TConstIterator it = f.begin(); it != f.end(); ++it,++index) { for (int i = 0; i < 3; i++) { pt2d = (*pclProj)(p[it->_aulPoints[i]]); - if (rclPoly.Contains(Base::Vector2D(pt2d.x, pt2d.y)) == bInner) { + if (rclPoly.Contains(Base::Vector2d(pt2d.x, pt2d.y)) == bInner) { raulFacets.push_back(index); break; } diff --git a/src/Mod/Mesh/App/Core/Algorithm.h b/src/Mod/Mesh/App/Core/Algorithm.h index 685dcb89ca77..f4ff6e8b5b4d 100644 --- a/src/Mod/Mesh/App/Core/Algorithm.h +++ b/src/Mod/Mesh/App/Core/Algorithm.h @@ -36,7 +36,7 @@ namespace Base{ class ViewProjMethod; - class Polygon2D; + class Polygon2d; } namespace MeshCore { @@ -225,12 +225,12 @@ class MeshExport MeshAlgorithm * bInner is \a false then all facets with at least one corner outside the polygon get deleted. * This algorithm is optimized by using a grid. */ - void CheckFacets (const MeshFacetGrid &rclGrid, const Base::ViewProjMethod* pclProj, const Base::Polygon2D& rclPoly, + void CheckFacets (const MeshFacetGrid &rclGrid, const Base::ViewProjMethod* pclProj, const Base::Polygon2d& rclPoly, bool bInner, std::vector &rclRes) const; /** * Does the same as the above method unless that it doesn't use a grid. */ - void CheckFacets (const Base::ViewProjMethod* pclProj, const Base::Polygon2D& rclPoly, + void CheckFacets (const Base::ViewProjMethod* pclProj, const Base::Polygon2d& rclPoly, bool bInner, std::vector &rclRes) const; /** * Determines all facets of the given array \a raclFacetIndices that lie at the edge or that diff --git a/src/Mod/Mesh/App/Core/MeshKernel.cpp b/src/Mod/Mesh/App/Core/MeshKernel.cpp index 8c4ad2a23cae..f84965840546 100644 --- a/src/Mod/Mesh/App/Core/MeshKernel.cpp +++ b/src/Mod/Mesh/App/Core/MeshKernel.cpp @@ -698,7 +698,7 @@ void MeshKernel::RemoveInvalids () } void MeshKernel::CutFacets(const MeshFacetGrid& rclGrid, const Base::ViewProjMethod* pclProj, - const Base::Polygon2D& rclPoly, bool bCutInner, std::vector &raclFacets) + const Base::Polygon2d& rclPoly, bool bCutInner, std::vector &raclFacets) { std::vector aulFacets; @@ -711,7 +711,7 @@ void MeshKernel::CutFacets(const MeshFacetGrid& rclGrid, const Base::ViewProjMet } void MeshKernel::CutFacets(const MeshFacetGrid& rclGrid, const Base::ViewProjMethod* pclProj, - const Base::Polygon2D& rclPoly, bool bInner, std::vector &raclCutted) + const Base::Polygon2d& rclPoly, bool bInner, std::vector &raclCutted) { MeshAlgorithm(*this).CheckFacets(rclGrid, pclProj, rclPoly, bInner, raclCutted); DeleteFacets(raclCutted); diff --git a/src/Mod/Mesh/App/Core/MeshKernel.h b/src/Mod/Mesh/App/Core/MeshKernel.h index 1100c94a24c8..6c09c2e2e19d 100644 --- a/src/Mod/Mesh/App/Core/MeshKernel.h +++ b/src/Mod/Mesh/App/Core/MeshKernel.h @@ -35,7 +35,7 @@ #include namespace Base{ - class Polygon2D; + class Polygon2d; class ViewProjMethod; } @@ -408,13 +408,13 @@ class MeshExport MeshKernel * The facets to be deleted are returned with their geometric reprsentation. * @see CheckFacets(). */ - void CutFacets (const MeshFacetGrid& rclGrid, const Base::ViewProjMethod *pclP, const Base::Polygon2D& rclPoly, + void CutFacets (const MeshFacetGrid& rclGrid, const Base::ViewProjMethod *pclP, const Base::Polygon2d& rclPoly, bool bCutInner, std::vector &raclFacets); /** * Does basically the same as method above unless that the facets to be deleted are returned with their * index number in the facet array of the mesh structure. */ - void CutFacets (const MeshFacetGrid& rclGrid, const Base::ViewProjMethod* pclP, const Base::Polygon2D& rclPoly, + void CutFacets (const MeshFacetGrid& rclGrid, const Base::ViewProjMethod* pclP, const Base::Polygon2d& rclPoly, bool bCutInner, std::vector &raclCutted); //@} diff --git a/src/Mod/Mesh/App/Core/Trim.cpp b/src/Mod/Mesh/App/Core/Trim.cpp index 3d22d2e5dcc5..b07ad82d1ca7 100644 --- a/src/Mod/Mesh/App/Core/Trim.cpp +++ b/src/Mod/Mesh/App/Core/Trim.cpp @@ -31,7 +31,7 @@ using namespace MeshCore; MeshTrimming::MeshTrimming(MeshKernel &rclM, const Base::ViewProjMethod* pclProj, - const Base::Polygon2D& rclPoly) + const Base::Polygon2d& rclPoly) : myMesh(rclM), myInner(true), myProj(pclProj), myPoly(rclPoly) { } @@ -61,7 +61,7 @@ void MeshTrimming::CheckFacets(const MeshFacetGrid& rclGrid, std::vector aulAllElements; // BBox of polygon @@ -105,16 +105,16 @@ bool MeshTrimming::HasIntersection(const MeshGeomFacet& rclFacet) const { int i; unsigned long j; - Base::Polygon2D clPoly; - Base::Line2D clFacLine, clPolyLine; - Base::Vector2D S; + Base::Polygon2d clPoly; + Base::Line2d clFacLine, clPolyLine; + Base::Vector2d S; // is corner of facet inside the polygon for (i=0; i<3; i++) { Base::Vector3f clPt2d = myProj->operator ()(rclFacet._aclPoints[i]); - if (myPoly.Contains(Base::Vector2D(clPt2d.x, clPt2d.y)) == myInner) + if (myPoly.Contains(Base::Vector2d(clPt2d.x, clPt2d.y)) == myInner) return true; else - clPoly.Add(Base::Vector2D(clPt2d.x, clPt2d.y)); + clPoly.Add(Base::Vector2d(clPt2d.x, clPt2d.y)); } // is corner of polygon inside the facet @@ -147,7 +147,7 @@ bool MeshTrimming::PolygonContainsCompleteFacet(bool bInner, unsigned long ulInd for (int i=0; i<3; i++) { const MeshPoint &rclFacPt = myMesh._aclPointArray[rclFacet._aulPoints[i]]; Base::Vector3f clPt = (*myProj)(rclFacPt); - if (myPoly.Contains(Base::Vector2D(clPt.x, clPt.y)) != bInner) + if (myPoly.Contains(Base::Vector2d(clPt.x, clPt.y)) != bInner) return false; } @@ -156,28 +156,28 @@ bool MeshTrimming::PolygonContainsCompleteFacet(bool bInner, unsigned long ulInd bool MeshTrimming::IsPolygonPointInFacet(unsigned long ulIndex, Base::Vector3f& clPoint) { - Base::Vector2D A, B, C, P; + Base::Vector2d A, B, C, P; float u,v,w, fDetPAC, fDetPBC, fDetPAB, fDetABC; - Base::Polygon2D clFacPoly; + Base::Polygon2d clFacPoly; const MeshGeomFacet &rclFacet = myMesh.GetFacet(ulIndex); for (int i=0; i<3; i++) { Base::Vector3f clPt = (*myProj)(rclFacet._aclPoints[i]); - clFacPoly.Add(Base::Vector2D(clPt.x, clPt.y)); + clFacPoly.Add(Base::Vector2d(clPt.x, clPt.y)); } A = clFacPoly[0]; B = clFacPoly[1]; C = clFacPoly[2]; - fDetABC = (float)(A.fX*B.fY+A.fY*C.fX+B.fX*C.fY-(B.fY*C.fX+A.fY*B.fX+A.fX*C.fY)); + fDetABC = (float)(A.x*B.y+A.y*C.x+B.x*C.y-(B.y*C.x+A.y*B.x+A.x*C.y)); for (unsigned long j=0; j calculate the corresponding 3d-point if (clFacPoly.Contains(myPoly[j])) { P = myPoly[j]; - fDetPAC = (float)(A.fX*P.fY+A.fY*C.fX+P.fX*C.fY-(P.fY*C.fX+A.fY*P.fX+A.fX*C.fY)); - fDetPBC = (float)(P.fX*B.fY+P.fY*C.fX+B.fX*C.fY-(B.fY*C.fX+P.fY*B.fX+P.fX*C.fY)); - fDetPAB = (float)(A.fX*B.fY+A.fY*P.fX+B.fX*P.fY-(B.fY*P.fX+A.fY*B.fX+A.fX*P.fY)); + fDetPAC = (float)(A.x*P.y+A.y*C.x+P.x*C.y-(P.y*C.x+A.y*P.x+A.x*C.y)); + fDetPBC = (float)(P.x*B.y+P.y*C.x+B.x*C.y-(B.y*C.x+P.y*B.x+P.x*C.y)); + fDetPAB = (float)(A.x*B.y+A.y*P.x+B.x*P.y-(B.y*P.x+A.y*B.x+A.x*P.y)); u = fDetPBC / fDetABC; v = fDetPAC / fDetABC; w = fDetPAB / fDetABC; @@ -198,8 +198,8 @@ bool MeshTrimming::IsPolygonPointInFacet(unsigned long ulIndex, Base::Vector3f& bool MeshTrimming::GetIntersectionPointsOfPolygonAndFacet(unsigned long ulIndex, int& iSide, std::vector& raclPoints) const { MeshGeomFacet clFac(myMesh.GetFacet(ulIndex)); - Base::Vector2D S; - Base::Line2D clFacLine, clPolyLine; + Base::Vector2d S; + Base::Line2d clFacLine, clPolyLine; int iIntersections=0; int iIntsctWithEdge0=0, iIntsctWithEdge1=0, iIntsctWithEdge2=0; @@ -211,15 +211,15 @@ bool MeshTrimming::GetIntersectionPointsOfPolygonAndFacet(unsigned long ulIndex, if (iIntersections == 4) break; - Base::Vector2D P3(myPoly[i]), P4(myPoly[(i+1)%myPoly.GetCtVectors()]); + Base::Vector2d P3(myPoly[i]), P4(myPoly[(i+1)%myPoly.GetCtVectors()]); clPolyLine.clV1 = P3; clPolyLine.clV2 = P4; for (int j=0; j<3; j++) { Base::Vector3f clP1((*myProj)(clFac._aclPoints[j])); Base::Vector3f clP2((*myProj)(clFac._aclPoints[(j+1)%3])); - Base::Vector2D P1(clP1.x, clP1.y); - Base::Vector2D P2(clP2.x, clP2.y); + Base::Vector2d P1(clP1.x, clP1.y); + Base::Vector2d P2(clP2.x, clP2.y); clFacLine.clV1 = P1; clFacLine.clV2 = P2; @@ -349,10 +349,10 @@ bool MeshTrimming::CreateFacets(unsigned long ulFacetPos, int iSide, const std:: int iCtPtsIn=0; int iCtPtsOn=0; Base::Vector3f clFacPnt; - Base::Vector2D clProjPnt; + Base::Vector2d clProjPnt; for (int i=0; i<3; i++) { clFacPnt = (*myProj)(myMesh._aclPointArray[facet._aulPoints[i]]); - clProjPnt = Base::Vector2D(clFacPnt.x, clFacPnt.y); + clProjPnt = Base::Vector2d(clFacPnt.x, clFacPnt.y); if (myPoly.Intersect(clProjPnt, MESH_MIN_PT_DIST)) ++iCtPtsOn; else if (myPoly.Contains(clProjPnt) == myInner) @@ -367,16 +367,16 @@ bool MeshTrimming::CreateFacets(unsigned long ulFacetPos, int iSide, const std:: else if (raclPoints.size() == 1) { Base::Vector3f clP(raclPoints[0]); clP = ((*myProj)(clP)); - Base::Vector2D P(clP.x, clP.y); + Base::Vector2d P(clP.x, clP.y); MeshGeomFacet clFac(myMesh.GetFacet(ulFacetPos)); // determine the edge containing the intersection point - Base::Line2D clFacLine; + Base::Line2d clFacLine; for (int j=0; j<3; j++) { Base::Vector3f clP1((*myProj)(clFac._aclPoints[j])); Base::Vector3f clP2((*myProj)(clFac._aclPoints[(j+1)%3])); - Base::Vector2D P1(clP1.x, clP1.y); - Base::Vector2D P2(clP2.x, clP2.y); + Base::Vector2d P1(clP1.x, clP1.y); + Base::Vector2d P2(clP2.x, clP2.y); clFacLine.clV1 = P1; clFacLine.clV2 = P2; @@ -415,10 +415,10 @@ bool MeshTrimming::CreateFacets(unsigned long ulFacetPos, int iSide, const std:: // check which facets can be inserted int iCtPts=0; Base::Vector3f clFacPnt; - Base::Vector2D clProjPnt; + Base::Vector2d clProjPnt; for (int i=0; i<3; i++) { clFacPnt = (*myProj)(myMesh._aclPointArray[facet._aulPoints[i]]); - clProjPnt = Base::Vector2D(clFacPnt.x, clFacPnt.y); + clProjPnt = Base::Vector2d(clFacPnt.x, clFacPnt.y); if (myPoly.Contains(clProjPnt) == myInner) ++iCtPts; } @@ -458,10 +458,10 @@ bool MeshTrimming::CreateFacets(unsigned long ulFacetPos, int iSide, const std:: // check which facets can be inserted int iCtPts=0; Base::Vector3f clFacPnt; - Base::Vector2D clProjPnt; + Base::Vector2d clProjPnt; for (int i=0; i<3; i++) { clFacPnt = (*myProj)(myMesh._aclPointArray[facet._aulPoints[i]]); - clProjPnt = Base::Vector2D(clFacPnt.x, clFacPnt.y); + clProjPnt = Base::Vector2d(clFacPnt.x, clFacPnt.y); if (myPoly.Contains(clProjPnt) == myInner) ++iCtPts; } @@ -635,10 +635,10 @@ bool MeshTrimming::CreateFacets(unsigned long ulFacetPos, int iSide, const std:: // check which facets should be inserted int iCtPts=0; Base::Vector3f clFacPnt; - Base::Vector2D clProjPnt; + Base::Vector2d clProjPnt; for (int i=0; i<3; i++) { clFacPnt = (*myProj)(myMesh._aclPointArray[facet._aulPoints[i]]); - clProjPnt = Base::Vector2D(clFacPnt.x, clFacPnt.y); + clProjPnt = Base::Vector2d(clFacPnt.x, clFacPnt.y); if (myPoly.Contains(clProjPnt) == myInner) ++iCtPts; } diff --git a/src/Mod/Mesh/App/Core/Trim.h b/src/Mod/Mesh/App/Core/Trim.h index a87f65ab3305..857c9ad55b35 100644 --- a/src/Mod/Mesh/App/Core/Trim.h +++ b/src/Mod/Mesh/App/Core/Trim.h @@ -39,7 +39,7 @@ class MeshExport MeshTrimming enum TMode {INNER, OUTER}; public: - MeshTrimming(MeshKernel& mesh, const Base::ViewProjMethod* pclProj, const Base::Polygon2D& rclPoly); + MeshTrimming(MeshKernel& mesh, const Base::ViewProjMethod* pclProj, const Base::Polygon2d& rclPoly); ~MeshTrimming(); public: @@ -100,7 +100,7 @@ class MeshExport MeshTrimming bool myInner; std::vector myTriangles; const Base::ViewProjMethod* myProj; - const Base::Polygon2D& myPoly; + const Base::Polygon2d& myPoly; }; } //namespace MeshCore diff --git a/src/Mod/Mesh/App/Mesh.cpp b/src/Mod/Mesh/App/Mesh.cpp index 7c6e3d3f2900..58c97818adab 100644 --- a/src/Mod/Mesh/App/Mesh.cpp +++ b/src/Mod/Mesh/App/Mesh.cpp @@ -979,7 +979,7 @@ void MeshObject::crossSections(const std::vector& planes, st } } -void MeshObject::cut(const Base::Polygon2D& polygon2d, +void MeshObject::cut(const Base::Polygon2d& polygon2d, const Base::ViewProjMethod& proj, MeshObject::CutType type) { MeshCore::MeshAlgorithm meshAlg(this->_kernel); @@ -1004,7 +1004,7 @@ void MeshObject::cut(const Base::Polygon2D& polygon2d, this->deleteFacets(check); } -void MeshObject::trim(const Base::Polygon2D& polygon2d, +void MeshObject::trim(const Base::Polygon2d& polygon2d, const Base::ViewProjMethod& proj, MeshObject::CutType type) { MeshCore::MeshTrimming trim(this->_kernel, &proj, polygon2d); diff --git a/src/Mod/Mesh/App/Mesh.h b/src/Mod/Mesh/App/Mesh.h index bf2732be1326..dacb8dc7b6e1 100644 --- a/src/Mod/Mesh/App/Mesh.h +++ b/src/Mod/Mesh/App/Mesh.h @@ -50,7 +50,7 @@ class List; } namespace Base { - class Polygon2D; + class Polygon2d; class ViewProjMethod; } @@ -217,8 +217,8 @@ class MeshExport MeshObject : public Data::ComplexGeoData std::vector getPointNormals() const; void crossSections(const std::vector&, std::vector §ions, float fMinEps = 1.0e-2f, bool bConnectPolygons = false) const; - void cut(const Base::Polygon2D& polygon, const Base::ViewProjMethod& proj, CutType); - void trim(const Base::Polygon2D& polygon, const Base::ViewProjMethod& proj, CutType); + void cut(const Base::Polygon2d& polygon, const Base::ViewProjMethod& proj, CutType); + void trim(const Base::Polygon2d& polygon, const Base::ViewProjMethod& proj, CutType); //@} /** @name Selection */ diff --git a/src/Mod/Mesh/App/MeshPyImp.cpp b/src/Mod/Mesh/App/MeshPyImp.cpp index cbed565ce019..37e025336834 100644 --- a/src/Mod/Mesh/App/MeshPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPyImp.cpp @@ -1524,9 +1524,9 @@ PyObject* MeshPy::cut(PyObject *args) polygon = tria.ProjectToFitPlane(); Base::ViewProjMatrix proj(mat); - Base::Polygon2D polygon2d; + Base::Polygon2d polygon2d; for (std::vector::const_iterator it = polygon.begin(); it != polygon.end(); ++it) - polygon2d.Add(Base::Vector2D(it->x, it->y)); + polygon2d.Add(Base::Vector2d(it->x, it->y)); getMeshObjectPtr()->cut(polygon2d, proj, MeshObject::CutType(mode)); Py_Return; @@ -1558,9 +1558,9 @@ PyObject* MeshPy::trim(PyObject *args) polygon = tria.ProjectToFitPlane(); Base::ViewProjMatrix proj(mat); - Base::Polygon2D polygon2d; + Base::Polygon2d polygon2d; for (std::vector::const_iterator it = polygon.begin(); it != polygon.end(); ++it) - polygon2d.Add(Base::Vector2D(it->x, it->y)); + polygon2d.Add(Base::Vector2d(it->x, it->y)); getMeshObjectPtr()->trim(polygon2d, proj, MeshObject::CutType(mode)); Py_Return; diff --git a/src/Mod/Mesh/Gui/Command.cpp b/src/Mod/Mesh/Gui/Command.cpp index 43e058d116a5..e49d1bd6b23d 100644 --- a/src/Mod/Mesh/Gui/Command.cpp +++ b/src/Mod/Mesh/Gui/Command.cpp @@ -986,11 +986,11 @@ void CmdMeshTrimByPlane::activated(int) p3 = mat * p3; p4 = mat * p4; - Base::Polygon2D polygon2d; - polygon2d.Add(Base::Vector2D(p1.x, p1.y)); - polygon2d.Add(Base::Vector2D(p2.x, p2.y)); - polygon2d.Add(Base::Vector2D(p3.x, p3.y)); - polygon2d.Add(Base::Vector2D(p4.x, p4.y)); + Base::Polygon2d polygon2d; + polygon2d.Add(Base::Vector2d(p1.x, p1.y)); + polygon2d.Add(Base::Vector2d(p2.x, p2.y)); + polygon2d.Add(Base::Vector2d(p3.x, p3.y)); + polygon2d.Add(Base::Vector2d(p4.x, p4.y)); Mesh::MeshObject::CutType type = Mesh::MeshObject::INNER; mesh->trim(polygon2d, proj, type); diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index 9b2f3cfb0bb6..2dcaa80c46bc 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -1059,9 +1059,9 @@ void ViewProviderMesh::getFacetsFromPolygon(const std::vector& picked, { #if 1 const bool ok = true; - Base::Polygon2D polygon; + Base::Polygon2d polygon; for (std::vector::const_iterator it = picked.begin(); it != picked.end(); ++it) - polygon.Add(Base::Vector2D((*it)[0],(*it)[1])); + polygon.Add(Base::Vector2d((*it)[0],(*it)[1])); // Get the attached mesh property Mesh::PropertyMeshKernel& meshProp = static_cast(pcObject)->Mesh; @@ -1289,9 +1289,9 @@ void ViewProviderMesh::trimMesh(const std::vector& polygon, { Mesh::MeshObject* mesh = static_cast(pcObject)->Mesh.startEditing(); - Base::Polygon2D polygon2d; + Base::Polygon2d polygon2d; for (std::vector::const_iterator it = polygon.begin(); it != polygon.end(); ++it) - polygon2d.Add(Base::Vector2D((*it)[0],(*it)[1])); + polygon2d.Add(Base::Vector2d((*it)[0],(*it)[1])); Mesh::MeshObject::CutType type = inner ? Mesh::MeshObject::INNER : diff --git a/src/Mod/Part/Gui/TaskFaceColors.cpp b/src/Mod/Part/Gui/TaskFaceColors.cpp index 76eb885ee707..a09a33be0ad2 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.cpp +++ b/src/Mod/Part/Gui/TaskFaceColors.cpp @@ -163,7 +163,7 @@ class FaceColors::Private } void addFacesToSelection(Gui::View3DInventorViewer* /*viewer*/, const Gui::ViewVolumeProjection& proj, - const Base::Polygon2D& polygon, + const Base::Polygon2d& polygon, const TopoDS_Shape& shape) { try { @@ -184,7 +184,7 @@ class FaceColors::Private gp_Pnt p = BRep_Tool::Pnt(TopoDS::Vertex(xp_vertex.Current())); Base::Vector3d pt2d; pt2d = proj(Base::Vector3d(p.X(), p.Y(), p.Z())); - if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y))) { + if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y))) { #if 0 // TODO if (isVisibleFace(k-1, SbVec2f(pt2d.x, pt2d.y), viewer)) @@ -204,7 +204,7 @@ class FaceColors::Private //gp_Pnt c = props.CentreOfMass(); //Base::Vector3d pt2d; //pt2d = proj(Base::Vector3d(c.X(), c.Y(), c.Z())); - //if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y))) { + //if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y))) { // if (isVisibleFace(k-1, SbVec2f(pt2d.x, pt2d.y), viewer)) { // std::stringstream str; // str << "Face" << k; @@ -227,18 +227,18 @@ class FaceColors::Private SoCamera* cam = view->getSoRenderManager()->getCamera(); SbViewVolume vv = cam->getViewVolume(); Gui::ViewVolumeProjection proj(vv); - Base::Polygon2D polygon; + Base::Polygon2d polygon; if (picked.size() == 2) { SbVec2f pt1 = picked[0]; SbVec2f pt2 = picked[1]; - polygon.Add(Base::Vector2D(pt1[0], pt1[1])); - polygon.Add(Base::Vector2D(pt1[0], pt2[1])); - polygon.Add(Base::Vector2D(pt2[0], pt2[1])); - polygon.Add(Base::Vector2D(pt2[0], pt1[1])); + polygon.Add(Base::Vector2d(pt1[0], pt1[1])); + polygon.Add(Base::Vector2d(pt1[0], pt2[1])); + polygon.Add(Base::Vector2d(pt2[0], pt2[1])); + polygon.Add(Base::Vector2d(pt2[0], pt1[1])); } else { for (std::vector::const_iterator it = picked.begin(); it != picked.end(); ++it) - polygon.Add(Base::Vector2D((*it)[0],(*it)[1])); + polygon.Add(Base::Vector2d((*it)[0],(*it)[1])); } FaceColors* self = reinterpret_cast(ud); diff --git a/src/Mod/Part/Gui/ViewProvider2DObject.cpp b/src/Mod/Part/Gui/ViewProvider2DObject.cpp index 5e9337126cc3..d4072520558f 100644 --- a/src/Mod/Part/Gui/ViewProvider2DObject.cpp +++ b/src/Mod/Part/Gui/ViewProvider2DObject.cpp @@ -204,11 +204,11 @@ void ViewProvider2DObject::updateData(const App::Property* prop) Base::Placement place = static_cast(prop)->getComplexData()->getPlacement(); place.invert(); Base::ViewProjMatrix proj(place.toMatrix()); - Base::BoundBox2D bbox2d = bbox.ProjectBox(&proj); - this->MinX = bbox2d.fMinX; - this->MaxX = bbox2d.fMaxX; - this->MinY = bbox2d.fMinY; - this->MaxY = bbox2d.fMaxY; + Base::BoundBox2d bbox2d = bbox.ProjectBox(&proj); + this->MinX = bbox2d.MinX; + this->MaxX = bbox2d.MaxX; + this->MinY = bbox2d.MinY; + this->MaxY = bbox2d.MaxY; if (ShowGrid.getValue()) { createGrid(); } diff --git a/src/Mod/Points/Gui/ViewProvider.cpp b/src/Mod/Points/Gui/ViewProvider.cpp index efecd9e7208a..ad711bd0b4f6 100644 --- a/src/Mod/Points/Gui/ViewProvider.cpp +++ b/src/Mod/Points/Gui/ViewProvider.cpp @@ -408,9 +408,9 @@ void ViewProviderScattered::updateData(const App::Property* prop) void ViewProviderScattered::cut(const std::vector& picked, Gui::View3DInventorViewer &Viewer) { // create the polygon from the picked points - Base::Polygon2D cPoly; + Base::Polygon2d cPoly; for (std::vector::const_iterator it = picked.begin(); it != picked.end(); ++it) { - cPoly.Add(Base::Vector2D((*it)[0],(*it)[1])); + cPoly.Add(Base::Vector2d((*it)[0],(*it)[1])); } // get a reference to the point feature @@ -430,7 +430,7 @@ void ViewProviderScattered::cut(const std::vector& picked, Gui::View3DI // project from 3d to 2d vol.projectToScreen(pt, pt); - if (cPoly.Contains(Base::Vector2D(pt[0],pt[1]))) + if (cPoly.Contains(Base::Vector2d(pt[0],pt[1]))) removeIndices.push_back(index); } @@ -560,9 +560,9 @@ void ViewProviderStructured::updateData(const App::Property* prop) void ViewProviderStructured::cut(const std::vector& picked, Gui::View3DInventorViewer &Viewer) { // create the polygon from the picked points - Base::Polygon2D cPoly; + Base::Polygon2d cPoly; for (std::vector::const_iterator it = picked.begin(); it != picked.end(); ++it) { - cPoly.Add(Base::Vector2D((*it)[0],(*it)[1])); + cPoly.Add(Base::Vector2d((*it)[0],(*it)[1])); } // get a reference to the point feature @@ -586,7 +586,7 @@ void ViewProviderStructured::cut(const std::vector& picked, Gui::View3D // project from 3d to 2d vol.projectToScreen(pt, pt); - if (cPoly.Contains(Base::Vector2D(pt[0],pt[1]))) { + if (cPoly.Contains(Base::Vector2d(pt[0],pt[1]))) { invalidatePoints = true; vec.Set(nan, nan, nan); } diff --git a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp index 87017200cf04..e7ea0c8d904f 100644 --- a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp +++ b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp @@ -630,37 +630,37 @@ bool ParameterCorrection::GetUVParameters(double fSizeFactor) } } - std::vector vcProjPts; - Base::BoundBox2D clBBox; + std::vector vcProjPts; + Base::BoundBox2d clBBox; // Berechne die Koordinaten der transf. Punkte und projiz. diese auf die x,y-Ebene des neuen // Koordinatensystems for (int ii=_pvcPoints->Lower(); ii<=_pvcPoints->Upper(); ii++) { const gp_Pnt& pnt = (*_pvcPoints)(ii); Wm4::Vector3d clProjPnt = clRotMatTrans * Wm4::Vector3d(pnt.X(), pnt.Y(), pnt.Z()); - vcProjPts.push_back(Base::Vector2D(clProjPnt.X(), clProjPnt.Y())); - clBBox.Add(Base::Vector2D(clProjPnt.X(), clProjPnt.Y())); + vcProjPts.push_back(Base::Vector2d(clProjPnt.X(), clProjPnt.Y())); + clBBox.Add(Base::Vector2d(clProjPnt.X(), clProjPnt.Y())); } - if ((clBBox.fMaxX == clBBox.fMinX) || (clBBox.fMaxY == clBBox.fMinY)) + if ((clBBox.MaxX == clBBox.MinX) || (clBBox.MaxY == clBBox.MinY)) return false; - double tx = fSizeFactor*clBBox.fMinX-(fSizeFactor-1.0)*clBBox.fMaxX; - double ty = fSizeFactor*clBBox.fMinY-(fSizeFactor-1.0)*clBBox.fMaxY; - double fDeltaX = (2*fSizeFactor-1.0)*(clBBox.fMaxX - clBBox.fMinX); - double fDeltaY = (2*fSizeFactor-1.0)*(clBBox.fMaxY - clBBox.fMinY); + double tx = fSizeFactor*clBBox.MinX-(fSizeFactor-1.0)*clBBox.MaxX; + double ty = fSizeFactor*clBBox.MinY-(fSizeFactor-1.0)*clBBox.MaxY; + double fDeltaX = (2*fSizeFactor-1.0)*(clBBox.MaxX - clBBox.MinX); + double fDeltaY = (2*fSizeFactor-1.0)*(clBBox.MaxY - clBBox.MinY); // Berechne die u,v-Parameter mit u,v aus [0,1] _pvcUVParam->Init(gp_Pnt2d(0.0, 0.0)); int ii=0; - if (clBBox.fMaxX - clBBox.fMinX >= clBBox.fMaxY - clBBox.fMinY) { - for (std::vector::iterator It2=vcProjPts.begin(); It2!=vcProjPts.end(); ++It2) { - (*_pvcUVParam)(ii) = gp_Pnt2d((It2->fX-tx)/fDeltaX, (It2->fY-ty)/fDeltaY); + if (clBBox.MaxX - clBBox.MinX >= clBBox.MaxY - clBBox.MinY) { + for (std::vector::iterator It2=vcProjPts.begin(); It2!=vcProjPts.end(); ++It2) { + (*_pvcUVParam)(ii) = gp_Pnt2d((It2->x-tx)/fDeltaX, (It2->y-ty)/fDeltaY); ii++; } } else { - for (std::vector::iterator It2=vcProjPts.begin(); It2!=vcProjPts.end(); ++It2) { - (*_pvcUVParam)(ii) = gp_Pnt2d((It2->fY-ty)/fDeltaY, (It2->fX-tx)/fDeltaX); + for (std::vector::iterator It2=vcProjPts.begin(); It2!=vcProjPts.end(); ++It2) { + (*_pvcUVParam)(ii) = gp_Pnt2d((It2->y-ty)/fDeltaY, (It2->x-tx)/fDeltaX); ii++; } } diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 763fbc9e1dc1..a2749e9e2fde 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -71,10 +71,10 @@ GeometryCreationMode geometryCreationMode=Normal; /* helper functions ======================================================*/ // Return counter-clockwise angle from horizontal out of p1 to p2 in radians. -double GetPointAngle (const Base::Vector2D &p1, const Base::Vector2D &p2) +double GetPointAngle (const Base::Vector2d &p1, const Base::Vector2d &p2) { - double dX = p2.fX - p1.fX; - double dY = p2.fY - p1.fY; + double dX = p2.x - p1.x; + double dY = p2.y - p1.y; return dY >= 0 ? atan2(dY, dX) : atan2(dY, dX) + 2*M_PI; } @@ -91,16 +91,16 @@ be solved for using the midpoint of the line. This can be done for both lines. both S12p and S23p cross at the centerpoint, solving the two equations together will give the location of the centerpoint. */ -Base::Vector2D GetCircleCenter (const Base::Vector2D &p1, const Base::Vector2D &p2, const Base::Vector2D &p3) +Base::Vector2d GetCircleCenter (const Base::Vector2d &p1, const Base::Vector2d &p2, const Base::Vector2d &p3) { - double m12p = (p1.fX - p2.fX) / (p2.fY - p1.fY); - double m23p = (p2.fX - p3.fX) / (p3.fY - p2.fY); - double x = 1/( 2*(m12p - m23p) ) * ( m12p*(p1.fX + p2.fX) - - m23p*(p2.fX + p3.fX) + - p3.fY - p1.fY ); - double y = m12p * ( x - (p1.fX + p2.fX)/2 ) + (p1.fY + p2.fY)/2; - - return Base::Vector2D(x, y); + double m12p = (p1.x - p2.x) / (p2.y - p1.y); + double m23p = (p2.x - p3.x) / (p3.y - p2.y); + double x = 1/( 2*(m12p - m23p) ) * ( m12p*(p1.x + p2.x) - + m23p*(p2.x + p3.x) + + p3.y - p1.y ); + double y = m12p * ( x - (p1.x + p2.x)/2 ) + (p1.y + p2.y)/2; + + return Base::Vector2d(x, y); } void ActivateHandler(Gui::Document *doc,DrawSketchHandler *handler) @@ -198,18 +198,18 @@ class DrawSketchHandlerLine: public DrawSketchHandler setCursor(QPixmap(cursor_createline),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr1); return; } } else if (Mode==STATUS_SEEK_Second){ float length = (onSketchPos - EditCurve[0]).Length(); - float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2D(1.f,0.f)); + float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2d(1.f,0.f)); SbString text; text.sprintf(" (%.1f,%.1fdeg)", length, angle * 180 / M_PI); setPositionText(onSketchPos, text); @@ -224,7 +224,7 @@ class DrawSketchHandlerLine: public DrawSketchHandler applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ EditCurve[0] = onSketchPos; @@ -238,7 +238,7 @@ class DrawSketchHandlerLine: public DrawSketchHandler return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Mode==STATUS_End){ @@ -249,7 +249,7 @@ class DrawSketchHandlerLine: public DrawSketchHandler Gui::Command::openCommand("Add sketch line"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)", sketchgui->getObject()->getNameInDocument(), - EditCurve[0].fX,EditCurve[0].fY,EditCurve[1].fX,EditCurve[1].fY, + EditCurve[0].x,EditCurve[0].y,EditCurve[1].x,EditCurve[1].y, geometryCreationMode==Construction?"True":"False"); Gui::Command::commitCommand(); @@ -303,7 +303,7 @@ class DrawSketchHandlerLine: public DrawSketchHandler } protected: SelectMode Mode; - std::vector EditCurve; + std::vector EditCurve; std::vector sugConstr1, sugConstr2; }; @@ -407,28 +407,28 @@ class DrawSketchHandlerBox: public DrawSketchHandler setCursor(QPixmap(cursor_createbox),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr1); return; } } else if (Mode==STATUS_SEEK_Second) { - float dx = onSketchPos.fX - EditCurve[0].fX; - float dy = onSketchPos.fY - EditCurve[0].fY; + float dx = onSketchPos.x - EditCurve[0].x; + float dy = onSketchPos.y - EditCurve[0].y; SbString text; text.sprintf(" (%.1f x %.1f)", dx, dy); setPositionText(onSketchPos, text); EditCurve[2] = onSketchPos; - EditCurve[1] = Base::Vector2D(onSketchPos.fX ,EditCurve[0].fY); - EditCurve[3] = Base::Vector2D(EditCurve[0].fX,onSketchPos.fY); + EditCurve[1] = Base::Vector2d(onSketchPos.x ,EditCurve[0].y); + EditCurve[3] = Base::Vector2d(EditCurve[0].x,onSketchPos.y); sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.0,0.0))) { + if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2d(0.0,0.0))) { renderSuggestConstraintsCursor(sugConstr2); return; } @@ -436,7 +436,7 @@ class DrawSketchHandlerBox: public DrawSketchHandler applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ EditCurve[0] = onSketchPos; @@ -445,15 +445,15 @@ class DrawSketchHandlerBox: public DrawSketchHandler } else { EditCurve[2] = onSketchPos; - EditCurve[1] = Base::Vector2D(onSketchPos.fX ,EditCurve[0].fY); - EditCurve[3] = Base::Vector2D(EditCurve[0].fX,onSketchPos.fY); + EditCurve[1] = Base::Vector2d(onSketchPos.x ,EditCurve[0].y); + EditCurve[3] = Base::Vector2d(EditCurve[0].x,onSketchPos.y); sketchgui->drawEdit(EditCurve); Mode = STATUS_End; } return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Mode==STATUS_End){ @@ -480,10 +480,10 @@ class DrawSketchHandlerBox: public DrawSketchHandler "conList.append(Sketcher.Constraint('Vertical',%i))\n" "conList.append(Sketcher.Constraint('Vertical',%i))\n" "App.ActiveDocument.%s.addConstraint(conList)\n", - EditCurve[0].fX,EditCurve[0].fY,EditCurve[1].fX,EditCurve[1].fY, // line 1 - EditCurve[1].fX,EditCurve[1].fY,EditCurve[2].fX,EditCurve[2].fY, // line 2 - EditCurve[2].fX,EditCurve[2].fY,EditCurve[3].fX,EditCurve[3].fY, // line 3 - EditCurve[3].fX,EditCurve[3].fY,EditCurve[0].fX,EditCurve[0].fY, // line 4 + EditCurve[0].x,EditCurve[0].y,EditCurve[1].x,EditCurve[1].y, // line 1 + EditCurve[1].x,EditCurve[1].y,EditCurve[2].x,EditCurve[2].y, // line 2 + EditCurve[2].x,EditCurve[2].y,EditCurve[3].x,EditCurve[3].y, // line 3 + EditCurve[3].x,EditCurve[3].y,EditCurve[0].x,EditCurve[0].y, // line 4 sketchgui->getObject()->getNameInDocument(), // the sketch geometryCreationMode==Construction?"True":"False", // geometry as construction or not firstCurve,firstCurve+1, // coincident1 @@ -548,7 +548,7 @@ class DrawSketchHandlerBox: public DrawSketchHandler } protected: BoxMode Mode; - std::vector EditCurve; + std::vector EditCurve; std::vector sugConstr1, sugConstr2; }; @@ -689,7 +689,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler // SEGMENT_MODE_Arc, TRANSITION_MODE_Perpendicular_L // SEGMENT_MODE_Arc, TRANSITION_MODE_Perpendicular_R - Base::Vector2D onSketchPos; + Base::Vector2d onSketchPos; if (SegmentMode == SEGMENT_MODE_Line) onSketchPos = EditCurve[EditCurve.size()-1]; else @@ -757,12 +757,12 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler setCursor(QPixmap(cursor_createlineset),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { suppressTransition = false; if (Mode==STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr1); return; } @@ -771,7 +771,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler if (SegmentMode == SEGMENT_MODE_Line) { EditCurve[EditCurve.size()-1] = onSketchPos; if (TransitionMode == TRANSITION_MODE_Tangent) { - Base::Vector2D Tangent(dirVec.x,dirVec.y); + Base::Vector2d Tangent(dirVec.x,dirVec.y); EditCurve[1].ProjectToLine(EditCurve[2] - EditCurve[0], Tangent); if (EditCurve[1] * Tangent < 0) { EditCurve[1] = EditCurve[2]; @@ -782,7 +782,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler } else if (TransitionMode == TRANSITION_MODE_Perpendicular_L || TransitionMode == TRANSITION_MODE_Perpendicular_R) { - Base::Vector2D Perpendicular(-dirVec.y,dirVec.x); + Base::Vector2d Perpendicular(-dirVec.y,dirVec.x); EditCurve[1].ProjectToLine(EditCurve[2] - EditCurve[0], Perpendicular); EditCurve[1] = EditCurve[0] + EditCurve[1]; } @@ -790,7 +790,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler sketchgui->drawEdit(EditCurve); float length = (EditCurve[1] - EditCurve[0]).Length(); - float angle = (EditCurve[1] - EditCurve[0]).GetAngle(Base::Vector2D(1.f,0.f)); + float angle = (EditCurve[1] - EditCurve[0]).GetAngle(Base::Vector2d(1.f,0.f)); SbString text; text.sprintf(" (%.1f,%.1fdeg)", length, angle * 180 / M_PI); @@ -804,39 +804,39 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler } } else if (SegmentMode == SEGMENT_MODE_Arc) { - Base::Vector2D Tangent; + Base::Vector2d Tangent; if (TransitionMode == TRANSITION_MODE_Tangent) - Tangent = Base::Vector2D(dirVec.x,dirVec.y); + Tangent = Base::Vector2d(dirVec.x,dirVec.y); else if (TransitionMode == TRANSITION_MODE_Perpendicular_L) - Tangent = Base::Vector2D(-dirVec.y,dirVec.x); + Tangent = Base::Vector2d(-dirVec.y,dirVec.x); else if (TransitionMode == TRANSITION_MODE_Perpendicular_R) - Tangent = Base::Vector2D(dirVec.y,-dirVec.x); + Tangent = Base::Vector2d(dirVec.y,-dirVec.x); double theta = Tangent.GetAngle(onSketchPos - EditCurve[0]); arcRadius = (onSketchPos - EditCurve[0]).Length()/(2.0*sin(theta)); // At this point we need a unit normal vector pointing torwards // the center of the arc we are drawing. Derivation of the formula // used here can be found at http://people.richland.edu/james/lecture/m116/matrices/area.html - double x1 = EditCurve[0].fX; - double y1 = EditCurve[0].fY; - double x2 = x1 + Tangent.fX; - double y2 = y1 + Tangent.fY; - double x3 = onSketchPos.fX; - double y3 = onSketchPos.fY; + double x1 = EditCurve[0].x; + double y1 = EditCurve[0].y; + double x2 = x1 + Tangent.x; + double y2 = y1 + Tangent.y; + double x3 = onSketchPos.x; + double y3 = onSketchPos.y; if ((x2*y3-x3*y2)-(x1*y3-x3*y1)+(x1*y2-x2*y1) > 0) arcRadius *= -1; if (boost::math::isnan(arcRadius) || boost::math::isinf(arcRadius)) arcRadius = 0.f; - CenterPoint = EditCurve[0] + Base::Vector2D(arcRadius * Tangent.fY, -arcRadius * Tangent.fX); + CenterPoint = EditCurve[0] + Base::Vector2d(arcRadius * Tangent.y, -arcRadius * Tangent.x); - double rx = EditCurve[0].fX - CenterPoint.fX; - double ry = EditCurve[0].fY - CenterPoint.fY; + double rx = EditCurve[0].x - CenterPoint.x; + double ry = EditCurve[0].y - CenterPoint.y; startAngle = atan2(ry,rx); - double rxe = onSketchPos.fX - CenterPoint.fX; - double rye = onSketchPos.fY - CenterPoint.fY; + double rxe = onSketchPos.x - CenterPoint.x; + double rye = onSketchPos.y - CenterPoint.y; double arcAngle = atan2(-rxe*ry + rye*rx, rxe*rx + rye*ry); if (boost::math::isnan(arcAngle) || boost::math::isinf(arcAngle)) arcAngle = 0.f; @@ -850,7 +850,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler double angle = i*arcAngle/29.0; double dx = rx * cos(angle) - ry * sin(angle); double dy = rx * sin(angle) + ry * cos(angle); - EditCurve[i] = Base::Vector2D(CenterPoint.fX + dx, CenterPoint.fY + dy); + EditCurve[i] = Base::Vector2d(CenterPoint.x + dx, CenterPoint.y + dy); } EditCurve[30] = CenterPoint; @@ -862,7 +862,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler text.sprintf(" (%.1fR,%.1fdeg)", std::abs(arcRadius), arcAngle * 180 / M_PI); setPositionText(onSketchPos, text); - if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr2); return; } @@ -871,7 +871,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode == STATUS_SEEK_First) { @@ -959,7 +959,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { if (Mode == STATUS_Do || Mode == STATUS_Close) { bool addedGeometry = true; @@ -971,7 +971,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)", sketchgui->getObject()->getNameInDocument(), - EditCurve[0].fX,EditCurve[0].fY,EditCurve[1].fX,EditCurve[1].fY, + EditCurve[0].x,EditCurve[0].y,EditCurve[1].x,EditCurve[1].y, geometryCreationMode==Construction?"True":"False"); } catch (const Base::Exception& e) { @@ -992,7 +992,7 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler "App.ActiveDocument.%s.addGeometry(Part.ArcOfCircle" "(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f),%s)", sketchgui->getObject()->getNameInDocument(), - CenterPoint.fX, CenterPoint.fY, std::abs(arcRadius), + CenterPoint.x, CenterPoint.y, std::abs(arcRadius), std::min(startAngle,endAngle), std::max(startAngle,endAngle), geometryCreationMode==Construction?"True":"False"); } @@ -1138,14 +1138,14 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler TRANSITION_MODE TransitionMode; bool suppressTransition; - std::vector EditCurve; + std::vector EditCurve; int firstCurve; int previousCurve; Sketcher::PointPos firstPosId; Sketcher::PointPos previousPosId; std::vector sugConstr1, sugConstr2; - Base::Vector2D CenterPoint; + Base::Vector2d CenterPoint; Base::Vector3d dirVec; double startAngle, endAngle, arcRadius; @@ -1160,19 +1160,19 @@ class DrawSketchHandlerLineSet: public DrawSketchHandler 0.f); if (PosId == Sketcher::start) { dirVec *= -1; - EditCurve[0] = Base::Vector2D(lineSeg->getStartPoint().x, lineSeg->getStartPoint().y); + EditCurve[0] = Base::Vector2d(lineSeg->getStartPoint().x, lineSeg->getStartPoint().y); } else - EditCurve[0] = Base::Vector2D(lineSeg->getEndPoint().x, lineSeg->getEndPoint().y); + EditCurve[0] = Base::Vector2d(lineSeg->getEndPoint().x, lineSeg->getEndPoint().y); } else if (geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) { const Part::GeomArcOfCircle *arcSeg = static_cast(geom); if (PosId == Sketcher::start) { - EditCurve[0] = Base::Vector2D(arcSeg->getStartPoint(/*emulateCCW=*/true).x,arcSeg->getStartPoint(/*emulateCCW=*/true).y); + EditCurve[0] = Base::Vector2d(arcSeg->getStartPoint(/*emulateCCW=*/true).x,arcSeg->getStartPoint(/*emulateCCW=*/true).y); dirVec = Base::Vector3d(0.f,0.f,-1.0) % (arcSeg->getStartPoint(/*emulateCCW=*/true)-arcSeg->getCenter()); } else { - EditCurve[0] = Base::Vector2D(arcSeg->getEndPoint(/*emulateCCW=*/true).x,arcSeg->getEndPoint(/*emulateCCW=*/true).y); + EditCurve[0] = Base::Vector2d(arcSeg->getEndPoint(/*emulateCCW=*/true).x,arcSeg->getEndPoint(/*emulateCCW=*/true).y); dirVec = Base::Vector3d(0.f,0.f,1.0) % (arcSeg->getEndPoint(/*emulateCCW=*/true)-arcSeg->getCenter()); } } @@ -1288,24 +1288,24 @@ class DrawSketchHandlerArc : public DrawSketchHandler setCursor(QPixmap(cursor_createarc),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr1); return; } } else if (Mode==STATUS_SEEK_Second) { - double dx_ = onSketchPos.fX - EditCurve[0].fX; - double dy_ = onSketchPos.fY - EditCurve[0].fY; + double dx_ = onSketchPos.x - EditCurve[0].x; + double dy_ = onSketchPos.y - EditCurve[0].y; for (int i=0; i < 16; i++) { double angle = i*M_PI/16.0; double dx = dx_ * cos(angle) + dy_ * sin(angle); double dy = -dx_ * sin(angle) + dy_ * cos(angle); - EditCurve[1+i] = Base::Vector2D(EditCurve[0].fX + dx, EditCurve[0].fY + dy); - EditCurve[17+i] = Base::Vector2D(EditCurve[0].fX - dx, EditCurve[0].fY - dy); + EditCurve[1+i] = Base::Vector2d(EditCurve[0].x + dx, EditCurve[0].y + dy); + EditCurve[17+i] = Base::Vector2d(EditCurve[0].x - dx, EditCurve[0].y - dy); } EditCurve[33] = EditCurve[1]; @@ -1318,21 +1318,21 @@ class DrawSketchHandlerArc : public DrawSketchHandler setPositionText(onSketchPos, text); sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr2); return; } } else if (Mode==STATUS_SEEK_Third) { - double angle1 = atan2(onSketchPos.fY - CenterPoint.fY, - onSketchPos.fX - CenterPoint.fX) - startAngle; + double angle1 = atan2(onSketchPos.y - CenterPoint.y, + onSketchPos.x - CenterPoint.x) - startAngle; double angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ; arcAngle = abs(angle1-arcAngle) < abs(angle2-arcAngle) ? angle1 : angle2; for (int i=1; i <= 29; i++) { double angle = i*arcAngle/29.0; double dx = rx * cos(angle) - ry * sin(angle); double dy = rx * sin(angle) + ry * cos(angle); - EditCurve[i] = Base::Vector2D(CenterPoint.fX + dx, CenterPoint.fY + dy); + EditCurve[i] = Base::Vector2d(CenterPoint.x + dx, CenterPoint.y + dy); } // Display radius and arc angle @@ -1343,7 +1343,7 @@ class DrawSketchHandlerArc : public DrawSketchHandler setPositionText(onSketchPos, text); sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2D(0.0,0.0))) { + if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2d(0.0,0.0))) { renderSuggestConstraintsCursor(sugConstr3); return; } @@ -1352,7 +1352,7 @@ class DrawSketchHandlerArc : public DrawSketchHandler } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ CenterPoint = onSketchPos; @@ -1364,16 +1364,16 @@ class DrawSketchHandlerArc : public DrawSketchHandler EditCurve.resize(31); EditCurve[0] = onSketchPos; EditCurve[30] = CenterPoint; - rx = EditCurve[0].fX - CenterPoint.fX; - ry = EditCurve[0].fY - CenterPoint.fY; + rx = EditCurve[0].x - CenterPoint.x; + ry = EditCurve[0].y - CenterPoint.y; startAngle = atan2(ry, rx); arcAngle = 0.; Mode = STATUS_SEEK_Third; } else { EditCurve.resize(30); - double angle1 = atan2(onSketchPos.fY - CenterPoint.fY, - onSketchPos.fX - CenterPoint.fX) - startAngle; + double angle1 = atan2(onSketchPos.y - CenterPoint.y, + onSketchPos.x - CenterPoint.x) - startAngle; double angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ; arcAngle = abs(angle1-arcAngle) < abs(angle2-arcAngle) ? angle1 : angle2; if (arcAngle > 0) @@ -1391,7 +1391,7 @@ class DrawSketchHandlerArc : public DrawSketchHandler return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Mode==STATUS_End) { @@ -1405,7 +1405,7 @@ class DrawSketchHandlerArc : public DrawSketchHandler "(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f)," "%f,%f),%s)", sketchgui->getObject()->getNameInDocument(), - CenterPoint.fX, CenterPoint.fY, sqrt(rx*rx + ry*ry), + CenterPoint.x, CenterPoint.y, sqrt(rx*rx + ry*ry), startAngle, endAngle, geometryCreationMode==Construction?"True":"False"); //arcAngle > 0 ? 0 : 1); @@ -1465,8 +1465,8 @@ class DrawSketchHandlerArc : public DrawSketchHandler } protected: SelectMode Mode; - std::vector EditCurve; - Base::Vector2D CenterPoint; + std::vector EditCurve; + Base::Vector2d CenterPoint; double rx, ry, startAngle, endAngle, arcAngle; std::vector sugConstr1, sugConstr2, sugConstr3; }; @@ -1564,11 +1564,11 @@ class DrawSketchHandler3PointArc : public DrawSketchHandler setCursor(QPixmap(cursor_create3pointarc),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr1); return; } @@ -1584,8 +1584,8 @@ class DrawSketchHandler3PointArc : public DrawSketchHandler // Start at current angle double angle = (i-1)*2*M_PI/32.0 + lineAngle; // N point closed circle has N segments if (i != 1 && i != 17 ) { - EditCurve[i] = Base::Vector2D(CenterPoint.fX + radius*cos(angle), - CenterPoint.fY + radius*sin(angle)); + EditCurve[i] = Base::Vector2d(CenterPoint.x + radius*cos(angle), + CenterPoint.y + radius*sin(angle)); } } @@ -1596,7 +1596,7 @@ class DrawSketchHandler3PointArc : public DrawSketchHandler setPositionText(onSketchPos, text); sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr2); return; } @@ -1655,8 +1655,8 @@ class DrawSketchHandler3PointArc : public DrawSketchHandler // Build a 30 point circle ignoring already constructed points for (int i=1; i <= 28; i++) { double angle = startAngle + i*arcAngle/29.0; // N point arc has N-1 segments - EditCurve[i] = Base::Vector2D(CenterPoint.fX + radius*cos(angle), - CenterPoint.fY + radius*sin(angle)); + EditCurve[i] = Base::Vector2d(CenterPoint.x + radius*cos(angle), + CenterPoint.y + radius*sin(angle)); } SbString text; @@ -1664,7 +1664,7 @@ class DrawSketchHandler3PointArc : public DrawSketchHandler setPositionText(onSketchPos, text); sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2D(0.0,0.0), + if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2d(0.0,0.0), AutoConstraint::CURVE)) { renderSuggestConstraintsCursor(sugConstr3); return; @@ -1673,7 +1673,7 @@ class DrawSketchHandler3PointArc : public DrawSketchHandler applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ // 32 point curve + center + endpoint @@ -1701,7 +1701,7 @@ class DrawSketchHandler3PointArc : public DrawSketchHandler return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); // Need to look at. rx might need fixing. @@ -1716,7 +1716,7 @@ class DrawSketchHandler3PointArc : public DrawSketchHandler "(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f)," "%f,%f),%s)", sketchgui->getObject()->getNameInDocument(), - CenterPoint.fX, CenterPoint.fY, radius, + CenterPoint.x, CenterPoint.y, radius, startAngle, endAngle, geometryCreationMode==Construction?"True":"False"); @@ -1776,8 +1776,8 @@ class DrawSketchHandler3PointArc : public DrawSketchHandler } protected: SelectMode Mode; - std::vector EditCurve; - Base::Vector2D CenterPoint, FirstPoint, SecondPoint; + std::vector EditCurve; + Base::Vector2d CenterPoint, FirstPoint, SecondPoint; double radius, startAngle, endAngle, arcAngle; std::vector sugConstr1, sugConstr2, sugConstr3; Sketcher::PointPos arcPos1, arcPos2; @@ -1968,24 +1968,24 @@ class DrawSketchHandlerCircle : public DrawSketchHandler setCursor(QPixmap(cursor_createcircle),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr1); return; } } else if (Mode==STATUS_SEEK_Second) { - double rx0 = onSketchPos.fX - EditCurve[0].fX; - double ry0 = onSketchPos.fY - EditCurve[0].fY; + double rx0 = onSketchPos.x - EditCurve[0].x; + double ry0 = onSketchPos.y - EditCurve[0].y; for (int i=0; i < 16; i++) { double angle = i*M_PI/16.0; double rx = rx0 * cos(angle) + ry0 * sin(angle); double ry = -rx0 * sin(angle) + ry0 * cos(angle); - EditCurve[1+i] = Base::Vector2D(EditCurve[0].fX + rx, EditCurve[0].fY + ry); - EditCurve[17+i] = Base::Vector2D(EditCurve[0].fX - rx, EditCurve[0].fY - ry); + EditCurve[1+i] = Base::Vector2d(EditCurve[0].x + rx, EditCurve[0].y + ry); + EditCurve[17+i] = Base::Vector2d(EditCurve[0].x - rx, EditCurve[0].y - ry); } EditCurve[33] = EditCurve[1]; @@ -2006,7 +2006,7 @@ class DrawSketchHandlerCircle : public DrawSketchHandler applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ EditCurve[0] = onSketchPos; @@ -2018,12 +2018,12 @@ class DrawSketchHandlerCircle : public DrawSketchHandler return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Mode==STATUS_Close) { - double rx = EditCurve[1].fX - EditCurve[0].fX; - double ry = EditCurve[1].fY - EditCurve[0].fY; + double rx = EditCurve[1].x - EditCurve[0].x; + double ry = EditCurve[1].y - EditCurve[0].y; unsetCursor(); resetPositionText(); @@ -2033,7 +2033,7 @@ class DrawSketchHandlerCircle : public DrawSketchHandler "App.ActiveDocument.%s.addGeometry(Part.Circle" "(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)", sketchgui->getObject()->getNameInDocument(), - EditCurve[0].fX, EditCurve[0].fY, + EditCurve[0].x, EditCurve[0].y, sqrt(rx*rx + ry*ry), geometryCreationMode==Construction?"True":"False"); @@ -2087,7 +2087,7 @@ class DrawSketchHandlerCircle : public DrawSketchHandler } protected: SelectMode Mode; - std::vector EditCurve; + std::vector EditCurve; std::vector sugConstr1, sugConstr2; }; @@ -2247,12 +2247,12 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler * @brief Updates the ellipse when the cursor moves * @param onSketchPos the position of the cursor on the sketch */ - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (method == PERIAPSIS_APOAPSIS_B) { if (mode == STATUS_SEEK_PERIAPSIS) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f), + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f), AutoConstraint::CURVE)) { renderSuggestConstraintsCursor(sugConstr1); return; @@ -2270,7 +2270,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler sketchgui->drawEdit(editCurve); // Suggestions for ellipse and curves are disabled because many tangent constraints // need an intermediate point or line. - if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.f,0.f), + if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2d(0.f,0.f), AutoConstraint::CURVE)) { renderSuggestConstraintsCursor(sugConstr2); return; @@ -2285,7 +2285,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler setPositionText(onSketchPos, text); sketchgui->drawEdit(editCurve); - if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2D(0.f,0.f), + if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2d(0.f,0.f), AutoConstraint::CURVE)) { renderSuggestConstraintsCursor(sugConstr3); return; @@ -2294,7 +2294,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler } else { // method is CENTER_PERIAPSIS_B if (mode == STATUS_SEEK_CENTROID) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { // TODO: ellipse prio 1 + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { // TODO: ellipse prio 1 renderSuggestConstraintsCursor(sugConstr1); return; } @@ -2339,7 +2339,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler * @param onSketchPos the position of the cursor on the sketch * @return */ - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (method == PERIAPSIS_APOAPSIS_B) { if (mode == STATUS_SEEK_PERIAPSIS) { @@ -2374,7 +2374,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler * @param onSketchPos the position of the cursor on the sketch * @return */ - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (mode == STATUS_Close) { @@ -2402,11 +2402,11 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler ConstructionMethod method; int constrMethod; /// periapsis position vector, in standard position in sketch coordinate system - Base::Vector2D periapsis; + Base::Vector2d periapsis; /// apoapsis position vector, in standard position in sketch coordinate system - Base::Vector2D apoapsis; + Base::Vector2d apoapsis; /// centroid position vector, in standard position in sketch coordinate system - Base::Vector2D centroid; + Base::Vector2d centroid; /** * @brief position vector of positive b point, in standard position in sketch coordinate system * I.E. in polar perifocal system, the first intersection of the semiminor axis with the ellipse @@ -2418,15 +2418,15 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler * In a rotated R^3 cartesian system, centered at the centroid, +X towards periapsis, and * +Z coming out of the sketch, this b position is in the +Y direction from the centroid. */ - Base::Vector2D positiveB; + Base::Vector2d positiveB; /// the other b position - Base::Vector2D negativeB; + Base::Vector2d negativeB; /// cart. position vector for primary focus - Base::Vector2D f; + Base::Vector2d f; /// cart. position vector for other focus - Base::Vector2D fPrime; + Base::Vector2d fPrime; /// Unit vector for apse line - Base::Vector2D apseHat; + Base::Vector2d apseHat; /// length of semimajor axis, i.e. 'radius' colloquially double a; /// length of semiminor axis, i.e. 'radius' colloquially @@ -2446,11 +2446,11 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler /// angle of apse line relative to sketch coordinate system double phi; /// holds a position vector for a point on the ellipse from f - Base::Vector2D pos; + Base::Vector2d pos; /// holds a position vector for a point on the ellipse from fPrime - Base::Vector2D posPrime; + Base::Vector2d posPrime; /// holds position vectors for a points on the ellipse - std::vector editCurve; + std::vector editCurve; /// local i_hat vector for ellipse, from centroid to periapsis Base::Vector3d iPrime; /// local j_hat vector for ellipse, from centroid to b point @@ -2458,13 +2458,13 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler /// length (radius) of the fixed axis double fixedAxisLength; /// position vector of fixed axis point in sketch coordinates - Base::Vector2D fixedAxis; + Base::Vector2d fixedAxis; /** * @brief Computes a vector of 2D points representing an ellipse * @param onSketchPos Current position of the cursor on the sketch */ - void solveEllipse(Base::Vector2D onSketchPos) + void solveEllipse(Base::Vector2d onSketchPos) { const double GOLDEN_RATIO = 1.6180339887; Base::Vector3d k(0,0,1); @@ -2487,11 +2487,11 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler } else if (mode == STATUS_SEEK_B) { // Get the closest distance from onSketchPos to apse line, as a 'requested' value for b - Base::Vector2D cursor = Base::Vector2D(onSketchPos - f); // vector from f to cursor pos + Base::Vector2d cursor = Base::Vector2d(onSketchPos - f); // vector from f to cursor pos // decompose cursor with a projection, then length of w_2 will give us b - Base::Vector2D w_1 = cursor; + Base::Vector2d w_1 = cursor; w_1.ProjectToLine(cursor, (periapsis - apoapsis)); // projection of cursor line onto apse line - Base::Vector2D w_2 = (cursor - w_1); + Base::Vector2d w_2 = (cursor - w_1); b = w_2.Length(); // limit us to ellipse or circles @@ -2509,7 +2509,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler fPrime = apseHat; fPrime.Scale(-1 * ae); fPrime = centroid + fPrime; - phi = atan2(apseHat.fY, apseHat.fX); + phi = atan2(apseHat.y, apseHat.x); num = a * (1 - (e * e)); // The ellipse is now solved } else { // method == CENTER_PERIAPSIS_B @@ -2517,8 +2517,8 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler // solve the ellipse inscribed in a golden rectangle periapsis = onSketchPos; a = (centroid - periapsis).Length(); - iPrime.x = periapsis.fX - centroid.fX; - iPrime.y = periapsis.fY - centroid.fY; + iPrime.x = periapsis.x - centroid.x; + iPrime.y = periapsis.y - centroid.y; iPrime.z = 0; jPrime = k % iPrime; // j = k cross i @@ -2539,7 +2539,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler apoapsis = apseHat; apoapsis.Scale(-1 * a); apoapsis = centroid + apoapsis; - phi = atan2(apseHat.fY, apseHat.fX); + phi = atan2(apseHat.y, apseHat.x); num = a * (1 - (e * e)); fixedAxisLength = a; fixedAxis = periapsis; @@ -2547,16 +2547,16 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler // while looking for the last click, we may switch back and forth // between looking for a b point and looking for periapsis, so ensure // we are in the right mode - Base::Vector2D cursor = Base::Vector2D(onSketchPos - centroid); // vector from centroid to cursor pos + Base::Vector2d cursor = Base::Vector2d(onSketchPos - centroid); // vector from centroid to cursor pos // decompose cursor with a projection, then length of w_2 will give us b - Base::Vector2D w_1 = cursor; + Base::Vector2d w_1 = cursor; w_1.ProjectToLine(cursor, (fixedAxis - centroid)); // projection of cursor line onto fixed axis line - Base::Vector2D w_2 = (cursor - w_1); + Base::Vector2d w_2 = (cursor - w_1); if (w_2.Length() > fixedAxisLength) { // b is fixed, we are seeking a mode = STATUS_SEEK_A; - jPrime.x = (fixedAxis - centroid).fX; - jPrime.y = (fixedAxis - centroid).fY; + jPrime.x = (fixedAxis - centroid).x; + jPrime.y = (fixedAxis - centroid).y; jPrime.Normalize(); iPrime = jPrime % k; // cross b = fixedAxisLength; @@ -2564,16 +2564,16 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler } else { // a is fixed, we are seeking b mode = STATUS_SEEK_B; - iPrime.x = (fixedAxis - centroid).fX; - iPrime.y = (fixedAxis - centroid).fY; + iPrime.x = (fixedAxis - centroid).x; + iPrime.y = (fixedAxis - centroid).y; iPrime.Normalize(); jPrime = k % iPrime; // cross a = fixedAxisLength; b = w_2.Length(); } // now finish solving the ellipse - periapsis.fX = centroid.fX + (iPrime * a).x; - periapsis.fY = centroid.fY + (iPrime * a).y; + periapsis.x = centroid.x + (iPrime * a).x; + periapsis.y = centroid.y + (iPrime * a).y; e = sqrt(1 - ((b * b) / (a * a))); ratio = sqrt(1 - (e*e)); ae = a * e; @@ -2588,7 +2588,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler apoapsis = apseHat; apoapsis.Scale(-1 * a); apoapsis = centroid + apoapsis; - phi = atan2(apseHat.fY, apseHat.fX); + phi = atan2(apseHat.y, apseHat.x); num = a * (1 - (e * e)); } } @@ -2616,11 +2616,11 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler if (i > 0) {theta = theta + radianShift;} r = num / (1 + (e * cos(theta))); // r(pi/2) is semi-latus rectum, if we need it - pos.fX = r*cos(theta+phi); // phi rotates, sin/cos translate - pos.fY = r*sin(theta+phi); + pos.x = r*cos(theta+phi); // phi rotates, sin/cos translate + pos.y = r*sin(theta+phi); pos = pos + f; - posPrime.fX = r*cos(theta+phi+M_PI); - posPrime.fY = r*sin(theta+phi+M_PI); + posPrime.x = r*cos(theta+phi+M_PI); + posPrime.y = r*sin(theta+phi+M_PI); posPrime = posPrime + fPrime; // over the loop, loads Quadrant I points, by using f as origin editCurve[i] = pos; @@ -2628,13 +2628,13 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler editCurve[(2*n) + i] = posPrime; // load points with negative theta angles (i.e. cw) if (i>0) { - pos.fX = r*cos(-1*theta+phi); - pos.fY = r*sin(-1*theta+phi); + pos.x = r*cos(-1*theta+phi); + pos.y = r*sin(-1*theta+phi); pos = pos + f; // loads Quadrant IV points editCurve[(4*n) - i] = pos; - posPrime.fX = r*cos(-1*theta+phi+M_PI); - posPrime.fY = r*sin(-1*theta+phi+M_PI); + posPrime.x = r*cos(-1*theta+phi+M_PI); + posPrime.y = r*sin(-1*theta+phi+M_PI); posPrime = posPrime + fPrime; // loads Quadrant II points editCurve[(2*n) - i] = posPrime; @@ -2643,12 +2643,12 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler // load pos & neg b points theta = M_PI - atan2(b, ae); // the angle from f to the positive b point r = num / (1 + (e * cos(theta))); - pos.fX = r*cos(theta+phi); - pos.fY = r*sin(theta+phi); + pos.x = r*cos(theta+phi); + pos.y = r*sin(theta+phi); pos = pos + f; editCurve[n] = pos; // positive - pos.fX = r*cos(-1*theta+phi); - pos.fY = r*sin(-1*theta+phi); + pos.x = r*cos(-1*theta+phi); + pos.y = r*sin(-1*theta+phi); pos = pos + f; editCurve[(3*n)] = pos; // negative // force the curve to be a closed shape @@ -2659,7 +2659,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler * @brief Prints the ellipse data to STDOUT as an GNU Octave script * @param onSketchPos position of the cursor on the sketch */ - void ellipseToOctave(Base::Vector2D /*onSketchPos*/) + void ellipseToOctave(Base::Vector2d /*onSketchPos*/) { int n = static_cast((editCurve.size() - 1) / 4); @@ -2667,20 +2667,20 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler std::ostringstream octave; octave << std::fixed << std::setprecision(12); octave << "\nclear all;\nclose all;\nclc;\n\n"; - octave << "periapsis = [" << periapsis.fX << ", " << periapsis.fY << "];\n"; - octave << "apoapsis = [" << apoapsis.fX << ", " << apoapsis.fY << "];\n"; - octave << "positiveB = [" << editCurve[n].fX << ", " << editCurve[n].fY << "];\n"; - octave << "apseHat = [" << apseHat.fX << ", " << apseHat.fY << "];\n"; + octave << "periapsis = [" << periapsis.x << ", " << periapsis.y << "];\n"; + octave << "apoapsis = [" << apoapsis.x << ", " << apoapsis.y << "];\n"; + octave << "positiveB = [" << editCurve[n].x << ", " << editCurve[n].y << "];\n"; + octave << "apseHat = [" << apseHat.x << ", " << apseHat.y << "];\n"; octave << "a = " << a << ";\n"; octave << "b = " << b << ";\n"; octave << "eccentricity = " << e << ";\n"; - octave << "centroid = [" << centroid.fX << ", " << centroid.fY << "];\n"; - octave << "f = [" << f.fX << ", " << f.fY << "];\n"; - octave << "fPrime = [" << fPrime.fX << ", " << fPrime.fY << "];\n"; + octave << "centroid = [" << centroid.x << ", " << centroid.y << "];\n"; + octave << "f = [" << f.x << ", " << f.y << "];\n"; + octave << "fPrime = [" << fPrime.x << ", " << fPrime.y << "];\n"; octave << "phi = " << phi << ";\n\n"; octave << "x = ["; for (int i=0; i < 4*n + 1; i++) { - octave << editCurve[i].fX; + octave << editCurve[i].x; if (i < 4*n) { octave << ", "; } @@ -2688,7 +2688,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler octave << "];\n"; octave << "y = ["; for (int i=0; i < 4*n + 1; i++) { - octave << editCurve[i].fY; + octave << editCurve[i].y; if (i < 4*n) { octave << ", "; } @@ -2762,18 +2762,18 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler char py[64]; char ax[64]; char ay[64]; - sprintf(cx, "%.6lf\n", centroid.fX); - sprintf(cy, "%.6lf\n", centroid.fY); - sprintf(px, "%.6lf\n", periapsis.fX); - sprintf(py, "%.6lf\n", periapsis.fY); - sprintf(ax, "%.6lf\n", apoapsis.fX); - sprintf(ay, "%.6lf\n", apoapsis.fY); - centroid.fX = atof(cx); - centroid.fY = atof(cy); - periapsis.fX = atof(px); - periapsis.fY = atof(py); - apoapsis.fX = atof(ax); - apoapsis.fY = atof(ay); + sprintf(cx, "%.6lf\n", centroid.x); + sprintf(cy, "%.6lf\n", centroid.y); + sprintf(px, "%.6lf\n", periapsis.x); + sprintf(py, "%.6lf\n", periapsis.y); + sprintf(ax, "%.6lf\n", apoapsis.x); + sprintf(ay, "%.6lf\n", apoapsis.y); + centroid.x = atof(cx); + centroid.y = atof(cy); + periapsis.x = atof(px); + periapsis.y = atof(py); + apoapsis.x = atof(ax); + apoapsis.y = atof(ay); double majorLength = (periapsis - apoapsis).Length(); double minorLength = 0; @@ -2781,7 +2781,7 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler * from centroid to periapsis, +Z out of the page. */ Base::Vector3d k(0,0,1); - Base::Vector3d i(periapsis.fX - centroid.fX, periapsis.fY - centroid.fY, 0); + Base::Vector3d i(periapsis.x - centroid.x, periapsis.y - centroid.y, 0); Base::Vector3d j = k % i; // j = k cross i double beta = 1e-7; int count = 0; @@ -2795,25 +2795,25 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler do { tempB = b - double(count * beta); j = j.Normalize() * tempB; - positiveB.fX = centroid.fX + j.x; - positiveB.fY = centroid.fY + j.y; - negativeB.fX = centroid.fX + (j.x * -1); - negativeB.fY = centroid.fY + (j.y * -1); + positiveB.x = centroid.x + j.x; + positiveB.y = centroid.y + j.y; + negativeB.x = centroid.x + (j.x * -1); + negativeB.y = centroid.y + (j.y * -1); char bpx[64]; char bpy[64]; char bnx[64]; char bny[64]; - sprintf(bpx, "%.6lf\n", positiveB.fX); - sprintf(bpy, "%.6lf\n", positiveB.fY); - sprintf(bnx, "%.6lf\n", negativeB.fX); - sprintf(bny, "%.6lf\n", negativeB.fY); - positiveB.fX = atof(bpx); - positiveB.fY = atof(bpy); - negativeB.fX = atof(bnx); - negativeB.fY = atof(bny); - GC_MakeEllipse me(gp_Pnt(periapsis.fX,periapsis.fY,0), - gp_Pnt(positiveB.fX,positiveB.fY,0), - gp_Pnt(centroid.fX,centroid.fY,0)); + sprintf(bpx, "%.6lf\n", positiveB.x); + sprintf(bpy, "%.6lf\n", positiveB.y); + sprintf(bnx, "%.6lf\n", negativeB.x); + sprintf(bny, "%.6lf\n", negativeB.y); + positiveB.x = atof(bpx); + positiveB.y = atof(bpy); + negativeB.x = atof(bnx); + negativeB.y = atof(bny); + GC_MakeEllipse me(gp_Pnt(periapsis.x,periapsis.y,0), + gp_Pnt(positiveB.x,positiveB.y,0), + gp_Pnt(centroid.x,centroid.y,0)); minorLength = (negativeB - positiveB).Length(); count++; success = me.IsDone() && (minorLength + beta < majorLength); @@ -2841,9 +2841,9 @@ class DrawSketchHandlerEllipse : public DrawSketchHandler "App.ActiveDocument.%s.addGeometry(Part.Ellipse" "(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)", sketchgui->getObject()->getNameInDocument(), - periapsis.fX, periapsis.fY, - positiveB.fX, positiveB.fY, - centroid.fX, centroid.fY, + periapsis.x, periapsis.y, + positiveB.x, positiveB.y, + centroid.x, centroid.y, geometryCreationMode==Construction?"True":"False"); currentgeoid++; @@ -3063,24 +3063,24 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler setCursor(QPixmap(cursor_createarcofellipse),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { // TODO: ellipse prio 1 + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { // TODO: ellipse prio 1 renderSuggestConstraintsCursor(sugConstr1); return; } } else if (Mode==STATUS_SEEK_Second) { - double rx0 = onSketchPos.fX - EditCurve[0].fX; - double ry0 = onSketchPos.fY - EditCurve[0].fY; + double rx0 = onSketchPos.x - EditCurve[0].x; + double ry0 = onSketchPos.y - EditCurve[0].y; for (int i=0; i < 16; i++) { double angle = i*M_PI/16.0; double rx = rx0 * cos(angle) + ry0 * sin(angle); double ry = -rx0 * sin(angle) + ry0 * cos(angle); - EditCurve[1+i] = Base::Vector2D(EditCurve[0].fX + rx, EditCurve[0].fY + ry); - EditCurve[17+i] = Base::Vector2D(EditCurve[0].fX - rx, EditCurve[0].fY - ry); + EditCurve[1+i] = Base::Vector2d(EditCurve[0].x + rx, EditCurve[0].y + ry); + EditCurve[17+i] = Base::Vector2d(EditCurve[0].x - rx, EditCurve[0].y - ry); } EditCurve[33] = EditCurve[1]; @@ -3101,18 +3101,18 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler else if (Mode==STATUS_SEEK_Third) { // angle between the major axis of the ellipse and the X axis double a = (EditCurve[1]-EditCurve[0]).Length(); - double phi = atan2(EditCurve[1].fY-EditCurve[0].fY,EditCurve[1].fX-EditCurve[0].fX); + double phi = atan2(EditCurve[1].y-EditCurve[0].y,EditCurve[1].x-EditCurve[0].x); // This is the angle at cursor point - double angleatpoint = acos((onSketchPos.fX-EditCurve[0].fX+(onSketchPos.fY-EditCurve[0].fY)*tan(phi))/(a*(cos(phi)+tan(phi)*sin(phi)))); - double b=(onSketchPos.fY-EditCurve[0].fY-a*cos(angleatpoint)*sin(phi))/(sin(angleatpoint)*cos(phi)); + double angleatpoint = acos((onSketchPos.x-EditCurve[0].x+(onSketchPos.y-EditCurve[0].y)*tan(phi))/(a*(cos(phi)+tan(phi)*sin(phi)))); + double b=(onSketchPos.y-EditCurve[0].y-a*cos(angleatpoint)*sin(phi))/(sin(angleatpoint)*cos(phi)); for (int i=1; i < 16; i++) { double angle = i*M_PI/16.0; double rx = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi); double ry = a * cos(angle) * sin(phi) + b * sin(angle) * cos(phi); - EditCurve[1+i] = Base::Vector2D(EditCurve[0].fX + rx, EditCurve[0].fY + ry); - EditCurve[17+i] = Base::Vector2D(EditCurve[0].fX - rx, EditCurve[0].fY - ry); + EditCurve[1+i] = Base::Vector2d(EditCurve[0].x + rx, EditCurve[0].y + ry); + EditCurve[17+i] = Base::Vector2d(EditCurve[0].x - rx, EditCurve[0].y - ry); } EditCurve[33] = EditCurve[1]; EditCurve[17] = EditCurve[16]; @@ -3123,7 +3123,7 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler setPositionText(onSketchPos, text); sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr3); return; } @@ -3131,18 +3131,18 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler else if (Mode==STATUS_SEEK_Fourth) { // here we differ from ellipse creation // angle between the major axis of the ellipse and the X axis double a = (axisPoint-centerPoint).Length(); - double phi = atan2(axisPoint.fY-centerPoint.fY,axisPoint.fX-centerPoint.fX); + double phi = atan2(axisPoint.y-centerPoint.y,axisPoint.x-centerPoint.x); // This is the angle at cursor point - double angleatpoint = acos((startingPoint.fX-centerPoint.fX+(startingPoint.fY-centerPoint.fY)*tan(phi))/(a*(cos(phi)+tan(phi)*sin(phi)))); - double b=abs((startingPoint.fY-centerPoint.fY-a*cos(angleatpoint)*sin(phi))/(sin(angleatpoint)*cos(phi))); + double angleatpoint = acos((startingPoint.x-centerPoint.x+(startingPoint.y-centerPoint.y)*tan(phi))/(a*(cos(phi)+tan(phi)*sin(phi)))); + double b=abs((startingPoint.y-centerPoint.y-a*cos(angleatpoint)*sin(phi))/(sin(angleatpoint)*cos(phi))); - double rxs = startingPoint.fX - centerPoint.fX; - double rys = startingPoint.fY - centerPoint.fY; + double rxs = startingPoint.x - centerPoint.x; + double rys = startingPoint.y - centerPoint.y; startAngle = atan2(a*(rys*cos(phi)-rxs*sin(phi)), b*(rxs*cos(phi)+rys*sin(phi))); // eccentric anomaly angle - double angle1 = atan2(a*((onSketchPos.fY - centerPoint.fY)*cos(phi)-(onSketchPos.fX - centerPoint.fX)*sin(phi)), - b*((onSketchPos.fX - centerPoint.fX)*cos(phi)+(onSketchPos.fY - centerPoint.fY)*sin(phi)))- startAngle; + double angle1 = atan2(a*((onSketchPos.y - centerPoint.y)*cos(phi)-(onSketchPos.x - centerPoint.x)*sin(phi)), + b*((onSketchPos.x - centerPoint.x)*cos(phi)+(onSketchPos.y - centerPoint.y)*sin(phi)))- startAngle; double angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ; arcAngle = abs(angle1-arcAngle) < abs(angle2-arcAngle) ? angle1 : angle2; @@ -3151,7 +3151,7 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler double angle = startAngle+i*arcAngle/34.0; double rx = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi); double ry = a * cos(angle) * sin(phi) + b * sin(angle) * cos(phi); - EditCurve[i] = Base::Vector2D(centerPoint.fX + rx, centerPoint.fY + ry); + EditCurve[i] = Base::Vector2d(centerPoint.x + rx, centerPoint.y + ry); } // EditCurve[33] = EditCurve[1]; // EditCurve[17] = EditCurve[16]; @@ -3162,7 +3162,7 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler setPositionText(onSketchPos, text); sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr4, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr4, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr4); return; } @@ -3173,7 +3173,7 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ EditCurve[0] = onSketchPos; @@ -3199,7 +3199,7 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Mode==STATUS_Close) { @@ -3208,14 +3208,14 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler // angle between the major axis of the ellipse and the X axisEllipse double a = (axisPoint-centerPoint).Length(); - double phi = atan2(axisPoint.fY-centerPoint.fY,axisPoint.fX-centerPoint.fX); + double phi = atan2(axisPoint.y-centerPoint.y,axisPoint.x-centerPoint.x); // This is the angle at cursor point - double angleatpoint = acos((startingPoint.fX-centerPoint.fX+(startingPoint.fY-centerPoint.fY)*tan(phi))/(a*(cos(phi)+tan(phi)*sin(phi)))); - double b=abs((startingPoint.fY-centerPoint.fY-a*cos(angleatpoint)*sin(phi))/(sin(angleatpoint)*cos(phi))); + double angleatpoint = acos((startingPoint.x-centerPoint.x+(startingPoint.y-centerPoint.y)*tan(phi))/(a*(cos(phi)+tan(phi)*sin(phi)))); + double b=abs((startingPoint.y-centerPoint.y-a*cos(angleatpoint)*sin(phi))/(sin(angleatpoint)*cos(phi))); - double angle1 = atan2(a*((endPoint.fY - centerPoint.fY)*cos(phi)-(endPoint.fX - centerPoint.fX)*sin(phi)), - b*((endPoint.fX - centerPoint.fX)*cos(phi)+(endPoint.fY - centerPoint.fY)*sin(phi)))- startAngle; + double angle1 = atan2(a*((endPoint.y - centerPoint.y)*cos(phi)-(endPoint.x - centerPoint.x)*sin(phi)), + b*((endPoint.x - centerPoint.x)*cos(phi)+(endPoint.y - centerPoint.y)*sin(phi)))- startAngle; double angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ; arcAngle = abs(angle1-arcAngle) < abs(angle2-arcAngle) ? angle1 : angle2; @@ -3230,7 +3230,7 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler isOriginalArcCCW=false; } - Base::Vector2D majAxisDir,minAxisDir,minAxisPoint,majAxisPoint; + Base::Vector2d majAxisDir,minAxisDir,minAxisPoint,majAxisPoint; // We always create a CCW ellipse, because we want our XY reference system to be in the +X +Y direction // Our normal will then always be in the +Z axis (local +Z axis of the sketcher) @@ -3238,7 +3238,7 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler { // force second semidiameter to be perpendicular to first semidiamater majAxisDir = axisPoint - centerPoint; - Base::Vector2D perp(-majAxisDir.fY,majAxisDir.fX); + Base::Vector2d perp(-majAxisDir.y,majAxisDir.x); perp.Normalize(); perp.Scale(abs(b)); minAxisPoint = centerPoint+perp; @@ -3247,7 +3247,7 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler else { // force second semidiameter to be perpendicular to first semidiamater minAxisDir = axisPoint - centerPoint; - Base::Vector2D perp(minAxisDir.fY,-minAxisDir.fX); + Base::Vector2d perp(minAxisDir.y,-minAxisDir.x); perp.Normalize(); perp.Scale(abs(b)); majAxisPoint = centerPoint+perp; @@ -3268,9 +3268,9 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler "(Part.Ellipse(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0))," "%f,%f),%s)", sketchgui->getObject()->getNameInDocument(), - majAxisPoint.fX, majAxisPoint.fY, - minAxisPoint.fX, minAxisPoint.fY, - centerPoint.fX, centerPoint.fY, + majAxisPoint.x, majAxisPoint.y, + minAxisPoint.x, minAxisPoint.y, + centerPoint.x, centerPoint.y, startAngle, endAngle, geometryCreationMode==Construction?"True":"False"); @@ -3353,8 +3353,8 @@ class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler } protected: SelectMode Mode; - std::vector EditCurve; - Base::Vector2D centerPoint, axisPoint, startingPoint, endPoint; + std::vector EditCurve; + Base::Vector2d centerPoint, axisPoint, startingPoint, endPoint; double rx, ry, startAngle, endAngle, arcAngle, arcAngle_t; std::vector sugConstr1, sugConstr2, sugConstr3, sugConstr4; }; @@ -3566,11 +3566,11 @@ class DrawSketchHandler3PointCircle : public DrawSketchHandler setCursor(QPixmap(cursor_create3pointcircle),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode == STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f), + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f), AutoConstraint::CURVE)) { // Disable tangent snap on 1st point if (sugConstr1.back().Type == Sketcher::Tangent) @@ -3592,8 +3592,8 @@ class DrawSketchHandler3PointCircle : public DrawSketchHandler for (int i=1; i < N; i++) { // Start at current angle double angle = i*2*M_PI/N + lineAngle; // N point closed circle has N segments - EditCurve[i] = Base::Vector2D(CenterPoint.fX + radius*cos(angle), - CenterPoint.fY + radius*sin(angle)); + EditCurve[i] = Base::Vector2d(CenterPoint.x + radius*cos(angle), + CenterPoint.y + radius*sin(angle)); } // Beginning and end of curve should be exact EditCurve[0] = EditCurve[N] = onSketchPos; @@ -3606,7 +3606,7 @@ class DrawSketchHandler3PointCircle : public DrawSketchHandler sketchgui->drawEdit(EditCurve); if (Mode == STATUS_SEEK_Second) { - if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.f,0.f), + if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2d(0.f,0.f), AutoConstraint::CURVE)) { // Disable tangent snap on 2nd point if (sugConstr2.back().Type == Sketcher::Tangent) @@ -3617,7 +3617,7 @@ class DrawSketchHandler3PointCircle : public DrawSketchHandler } } else { - if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2D(0.0,0.0), + if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2d(0.0,0.0), AutoConstraint::CURVE)) { renderSuggestConstraintsCursor(sugConstr3); return; @@ -3627,7 +3627,7 @@ class DrawSketchHandler3PointCircle : public DrawSketchHandler applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode == STATUS_SEEK_First) { // N point curve + center + endpoint @@ -3652,7 +3652,7 @@ class DrawSketchHandler3PointCircle : public DrawSketchHandler return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); // Need to look at. rx might need fixing. @@ -3666,7 +3666,7 @@ class DrawSketchHandler3PointCircle : public DrawSketchHandler "App.ActiveDocument.%s.addGeometry(Part.Circle" "(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)", sketchgui->getObject()->getNameInDocument(), - CenterPoint.fX, CenterPoint.fY, + CenterPoint.x, CenterPoint.y, radius, geometryCreationMode==Construction?"True":"False"); @@ -3726,8 +3726,8 @@ class DrawSketchHandler3PointCircle : public DrawSketchHandler } protected: SelectMode Mode; - std::vector EditCurve; - Base::Vector2D CenterPoint, FirstPoint, SecondPoint; + std::vector EditCurve; + Base::Vector2d CenterPoint, FirstPoint, SecondPoint; double radius, N; // N should be even std::vector sugConstr1, sugConstr2, sugConstr3; }; @@ -3911,24 +3911,24 @@ class DrawSketchHandlerPoint: public DrawSketchHandler setCursor(QPixmap(cursor_createpoint),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr); return; } applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { EditPoint = onSketchPos; selectionDone = true; return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (selectionDone){ @@ -3939,7 +3939,7 @@ class DrawSketchHandlerPoint: public DrawSketchHandler Gui::Command::openCommand("Add sketch point"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Point(App.Vector(%f,%f,0)))", sketchgui->getObject()->getNameInDocument(), - EditPoint.fX,EditPoint.fY); + EditPoint.x,EditPoint.y); Gui::Command::commitCommand(); } @@ -3981,7 +3981,7 @@ class DrawSketchHandlerPoint: public DrawSketchHandler } protected: bool selectionDone; - Base::Vector2D EditPoint; + Base::Vector2d EditPoint; std::vector sugConstr; }; @@ -4172,18 +4172,18 @@ class DrawSketchHandlerFillet: public DrawSketchHandler setCursor(QPixmap(cursor_createfillet),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { bool construction=false; int VtId = sketchgui->getPreselectPoint(); @@ -4270,21 +4270,21 @@ class DrawSketchHandlerFillet: public DrawSketchHandler Gui::Selection().addSelection(sketchgui->getSketchObject()->getDocument()->getName() ,sketchgui->getSketchObject()->getNameInDocument() ,ss.str().c_str() - ,onSketchPos.fX - ,onSketchPos.fY + ,onSketchPos.x + ,onSketchPos.y ,0.f); } else if (Mode==STATUS_SEEK_Second) { int secondCurve = GeoId; - Base::Vector2D secondPos = onSketchPos; + Base::Vector2d secondPos = onSketchPos; // guess fillet radius const Part::GeomLineSegment *lineSeg1 = static_cast (sketchgui->getSketchObject()->getGeometry(firstCurve)); const Part::GeomLineSegment *lineSeg2 = static_cast (sketchgui->getSketchObject()->getGeometry(secondCurve)); - Base::Vector3d refPnt1(firstPos.fX, firstPos.fY, 0.f); - Base::Vector3d refPnt2(secondPos.fX, secondPos.fY, 0.f); + Base::Vector3d refPnt1(firstPos.x, firstPos.y, 0.f); + Base::Vector3d refPnt2(secondPos.x, secondPos.y, 0.f); double radius = Part::suggestFilletRadius(lineSeg1, lineSeg2, refPnt1, refPnt2); if (radius < 0) return false; @@ -4298,8 +4298,8 @@ class DrawSketchHandlerFillet: public DrawSketchHandler Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.fillet(%d,%d,App.Vector(%f,%f,0),App.Vector(%f,%f,0),%f)", sketchgui->getObject()->getNameInDocument(), firstCurve, secondCurve, - firstPos.fX, firstPos.fY, - secondPos.fX, secondPos.fY, radius); + firstPos.x, firstPos.y, + secondPos.x, secondPos.y, radius); Gui::Command::commitCommand(); } catch (const Base::Exception& e) { @@ -4336,7 +4336,7 @@ class DrawSketchHandlerFillet: public DrawSketchHandler protected: SelectMode Mode; int firstCurve; - Base::Vector2D firstPos; + Base::Vector2d firstPos; }; DEF_STD_CMD_A(CmdSketcherCreateFillet); @@ -4459,18 +4459,18 @@ class DrawSketchHandlerTrimming: public DrawSketchHandler setCursor(QPixmap(cursor_trimming),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { int GeoId = sketchgui->getPreselectCurve(); if (GeoId > -1) { @@ -4484,7 +4484,7 @@ class DrawSketchHandlerTrimming: public DrawSketchHandler Gui::Command::openCommand("Trim edge"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.trim(%d,App.Vector(%f,%f,0))", sketchgui->getObject()->getNameInDocument(), - GeoId, onSketchPos.fX, onSketchPos.fY); + GeoId, onSketchPos.x, onSketchPos.y); Gui::Command::commitCommand(); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); @@ -4667,20 +4667,20 @@ class DrawSketchHandlerExternal: public DrawSketchHandler sketchgui->setAxisPickStyle(true); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Gui::Selection().getPreselection().pObjectName) applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); /* this is ok not to call to purgeHandler @@ -4830,19 +4830,19 @@ class DrawSketchHandlerSlot: public DrawSketchHandler setCursor(QPixmap(cursor_creatslot),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr1); return; } } else if (Mode==STATUS_SEEK_Second) { - float dx = onSketchPos.fX - StartPos.fX; - float dy = onSketchPos.fY - StartPos.fY; + float dx = onSketchPos.x - StartPos.x; + float dy = onSketchPos.y - StartPos.y; lx=0;ly=0;a=0; double rev = 0; @@ -4862,10 +4862,10 @@ class DrawSketchHandlerSlot: public DrawSketchHandler double angle = (i+a)*M_PI/16.0; double rx = -fabs(r)* rev * sin(angle) ; double ry = fabs(r) * rev *cos(angle) ; - EditCurve[i] = Base::Vector2D(StartPos.fX + rx, StartPos.fY + ry); - EditCurve[18+i] = Base::Vector2D(StartPos.fX - rx+lx, StartPos.fY - ry+ly); + EditCurve[i] = Base::Vector2d(StartPos.x + rx, StartPos.y + ry); + EditCurve[18+i] = Base::Vector2d(StartPos.x - rx+lx, StartPos.y - ry+ly); } - EditCurve[17] = EditCurve[16] + Base::Vector2D(lx,ly); + EditCurve[17] = EditCurve[16] + Base::Vector2d(lx,ly); EditCurve[35] = EditCurve[0] ; //EditCurve[34] = EditCurve[0]; @@ -4874,7 +4874,7 @@ class DrawSketchHandlerSlot: public DrawSketchHandler setPositionText(onSketchPos, text); sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.f,0.f), + if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2d(0.f,0.f), AutoConstraint::CURVE)) { renderSuggestConstraintsCursor(sugConstr2); return; @@ -4883,7 +4883,7 @@ class DrawSketchHandlerSlot: public DrawSketchHandler applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ StartPos = onSketchPos; @@ -4895,7 +4895,7 @@ class DrawSketchHandlerSlot: public DrawSketchHandler return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Mode==STATUS_End){ @@ -4935,14 +4935,14 @@ class DrawSketchHandlerSlot: public DrawSketchHandler "conList.append(Sketcher.Constraint('%s',%i))\n" "conList.append(Sketcher.Constraint('Equal',%i,%i))\n" "App.ActiveDocument.%s.addConstraint(conList)\n", - StartPos.fX,StartPos.fY, // center of the arc1 + StartPos.x,StartPos.y, // center of the arc1 fabs(r), // radius arc1 start,end, // start and end angle of arc1 - StartPos.fX+lx,StartPos.fY+ly, // center of the arc2 + StartPos.x+lx,StartPos.y+ly, // center of the arc2 fabs(r), // radius arc2 end,start, // start and end angle of arc2 - EditCurve[16].fX,EditCurve[16].fY,EditCurve[17].fX,EditCurve[17].fY, // line1 - EditCurve[0].fX,EditCurve[0].fY,EditCurve[34].fX,EditCurve[34].fY, // line2 + EditCurve[16].x,EditCurve[16].y,EditCurve[17].x,EditCurve[17].y, // line1 + EditCurve[0].x,EditCurve[0].y,EditCurve[34].x,EditCurve[34].y, // line2 sketchgui->getObject()->getNameInDocument(), // the sketch geometryCreationMode==Construction?"True":"False", // geometry as construction or not firstCurve,firstCurve+3, // tangent1 @@ -5007,9 +5007,9 @@ class DrawSketchHandlerSlot: public DrawSketchHandler } protected: BoxMode Mode; - Base::Vector2D StartPos; + Base::Vector2d StartPos; double lx,ly,r,a; - std::vector EditCurve; + std::vector EditCurve; std::vector sugConstr1, sugConstr2; }; @@ -5121,33 +5121,33 @@ class DrawSketchHandlerRegularPolygon: public DrawSketchHandler setCursor(QPixmap(cursor_createregularpolygon),7,7); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { setPositionText(onSketchPos); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr1); return; } } else if (Mode==STATUS_SEEK_Second) { - EditCurve[0]= Base::Vector2D(onSketchPos.fX, onSketchPos.fY); - EditCurve[Corners]= Base::Vector2D(onSketchPos.fX, onSketchPos.fY); + EditCurve[0]= Base::Vector2d(onSketchPos.x, onSketchPos.y); + EditCurve[Corners]= Base::Vector2d(onSketchPos.x, onSketchPos.y); - Base::Vector2D dV = onSketchPos - StartPos; - double rx = dV.fX; - double ry = dV.fY; + Base::Vector2d dV = onSketchPos - StartPos; + double rx = dV.x; + double ry = dV.y; for (int i=1; i < static_cast(Corners); i++) { const double old_rx = rx; rx = cos_v * rx - sin_v * ry; ry = cos_v * ry + sin_v * old_rx; - EditCurve[i] = Base::Vector2D(StartPos.fX + rx, StartPos.fY + ry); + EditCurve[i] = Base::Vector2d(StartPos.x + rx, StartPos.y + ry); } // Display radius for user const float radius = dV.Length(); - const float angle = ( 180.0 / M_PI ) * atan2( dV.fY, dV.fX ); + const float angle = ( 180.0 / M_PI ) * atan2( dV.y, dV.x ); SbString text; text.sprintf(" (%.1fR %.1fdeg)", radius, angle ); @@ -5162,7 +5162,7 @@ class DrawSketchHandlerRegularPolygon: public DrawSketchHandler applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ StartPos = onSketchPos; @@ -5174,7 +5174,7 @@ class DrawSketchHandlerRegularPolygon: public DrawSketchHandler return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Mode==STATUS_End){ @@ -5188,7 +5188,7 @@ class DrawSketchHandlerRegularPolygon: public DrawSketchHandler "ProfileLib.RegularPolygon.makeRegularPolygon('%s',%i,App.Vector(%f,%f,0),App.Vector(%f,%f,0),%s)", sketchgui->getObject()->getNameInDocument(), Corners, - StartPos.fX,StartPos.fY,EditCurve[0].fX,EditCurve[0].fY, + StartPos.x,StartPos.y,EditCurve[0].x,EditCurve[0].y, geometryCreationMode==Construction?"True":"False"); Gui::Command::commitCommand(); @@ -5250,8 +5250,8 @@ class DrawSketchHandlerRegularPolygon: public DrawSketchHandler const double AngleOfSeparation; const double cos_v, sin_v; SelectMode Mode; - Base::Vector2D StartPos; - std::vector EditCurve; + Base::Vector2d StartPos; + std::vector EditCurve; std::vector sugConstr1, sugConstr2; }; diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index 22d033d94adf..1e26b1ec7e94 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -1247,21 +1247,21 @@ static const char *cursor_createcopy[]={ { setCursor(QPixmap(cursor_createcopy),7,7); Origin = static_cast(sketchgui->getObject())->getPoint(OriginGeoId, OriginPos); - EditCurve[0] = Base::Vector2D(Origin.x,Origin.y); + EditCurve[0] = Base::Vector2d(Origin.x,Origin.y); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { float length = (onSketchPos - EditCurve[0]).Length(); - float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2D(1.f,0.f)); + float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2d(1.f,0.f)); SbString text; text.sprintf(" (%.1f,%.1fdeg)", length, angle * 180 / M_PI); setPositionText(onSketchPos, text); EditCurve[1] = onSketchPos; sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.0,0.0),AutoConstraint::VERTEX)) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.0,0.0),AutoConstraint::VERTEX)) { renderSuggestConstraintsCursor(sugConstr1); return; } @@ -1270,7 +1270,7 @@ static const char *cursor_createcopy[]={ applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ EditCurve[1] = onSketchPos; @@ -1281,12 +1281,12 @@ static const char *cursor_createcopy[]={ return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Mode==STATUS_End){ - Base::Vector2D vector = EditCurve[1]-EditCurve[0]; + Base::Vector2d vector = EditCurve[1]-EditCurve[0]; unsetCursor(); resetPositionText(); @@ -1300,7 +1300,7 @@ static const char *cursor_createcopy[]={ Gui::Command::doCommand( Gui::Command::Doc, "App.ActiveDocument.%s.addCopy(%s,App.Vector(%f,%f,0),%s)", sketchgui->getObject()->getNameInDocument(), - geoIdList.c_str(), vector.fX, vector.fY, + geoIdList.c_str(), vector.x, vector.y, (Clone?"True":"False")); Gui::Command::commitCommand(); @@ -1336,7 +1336,7 @@ static const char *cursor_createcopy[]={ Sketcher::PointPos OriginPos; int nElements; bool Clone; - std::vector EditCurve; + std::vector EditCurve; std::vector sugConstr1; }; @@ -1692,21 +1692,21 @@ static const char *cursor_createrectangulararray[]={ { setCursor(QPixmap(cursor_createrectangulararray),7,7); Origin = static_cast(sketchgui->getObject())->getPoint(OriginGeoId, OriginPos); - EditCurve[0] = Base::Vector2D(Origin.x,Origin.y); + EditCurve[0] = Base::Vector2d(Origin.x,Origin.y); } - virtual void mouseMove(Base::Vector2D onSketchPos) + virtual void mouseMove(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First) { float length = (onSketchPos - EditCurve[0]).Length(); - float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2D(1.f,0.f)); + float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2d(1.f,0.f)); SbString text; text.sprintf(" (%.1f,%.1fdeg)", length, angle * 180 / M_PI); setPositionText(onSketchPos, text); EditCurve[1] = onSketchPos; sketchgui->drawEdit(EditCurve); - if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.0,0.0),AutoConstraint::VERTEX)) { + if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.0,0.0),AutoConstraint::VERTEX)) { renderSuggestConstraintsCursor(sugConstr1); return; } @@ -1715,7 +1715,7 @@ static const char *cursor_createrectangulararray[]={ applyCursor(); } - virtual bool pressButton(Base::Vector2D onSketchPos) + virtual bool pressButton(Base::Vector2d onSketchPos) { if (Mode==STATUS_SEEK_First){ EditCurve[1] = onSketchPos; @@ -1726,12 +1726,12 @@ static const char *cursor_createrectangulararray[]={ return true; } - virtual bool releaseButton(Base::Vector2D onSketchPos) + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Mode==STATUS_End){ - Base::Vector2D vector = EditCurve[1]-EditCurve[0]; + Base::Vector2d vector = EditCurve[1]-EditCurve[0]; unsetCursor(); resetPositionText(); @@ -1745,7 +1745,7 @@ static const char *cursor_createrectangulararray[]={ Gui::Command::doCommand( Gui::Command::Doc, "App.ActiveDocument.%s.addRectangularArray(%s, App.Vector(%f,%f,0),%s,%d,%d,%s,%f)", sketchgui->getObject()->getNameInDocument(), - geoIdList.c_str(), vector.fX, vector.fY, + geoIdList.c_str(), vector.x, vector.y, (Clone?"True":"False"), Cols, Rows, (ConstraintSeparation?"True":"False"), @@ -1788,7 +1788,7 @@ static const char *cursor_createrectangulararray[]={ int Cols; bool ConstraintSeparation; bool EqualVerticalHorizontalSpacing; - std::vector EditCurve; + std::vector EditCurve; std::vector sugConstr1; }; diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index 54f5aa3c8b4e..4bc10b60d31f 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -75,7 +75,7 @@ DrawSketchHandler::~DrawSketchHandler() void DrawSketchHandler::quit(void) { assert(sketchgui); - sketchgui->drawEdit(std::vector()); + sketchgui->drawEdit(std::vector()); resetPositionText(); unsetCursor(); @@ -133,7 +133,7 @@ void DrawSketchHandler::unsetCursor(void) } int DrawSketchHandler::seekAutoConstraint(std::vector &suggestedConstraints, - const Base::Vector2D& Pos, const Base::Vector2D& Dir, + const Base::Vector2d& Pos, const Base::Vector2d& Dir, AutoConstraint::TargetType type) { suggestedConstraints.clear(); @@ -191,7 +191,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested constr.Type = Sketcher::Tangent; if(constr.Type == Sketcher::Tangent && Dir.Length() > 1e-8 && hitShapeDir.Length() > 1e-8) { // We are hitting a line and have hitting vector information - Base::Vector3d dir3d = Base::Vector3d(Dir.fX,Dir.fY,0); + Base::Vector3d dir3d = Base::Vector3d(Dir.x,Dir.y,0); double cosangle=dir3d.Normalize()*hitShapeDir.Normalize(); // the angle between the line and the hitting direction are over around 6 degrees (it is substantially parallel) @@ -221,7 +221,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested constr.Type = Sketcher::None; constr.GeoId = Constraint::GeoUndef; constr.PosId = Sketcher::none; - double angle = std::abs(atan2(Dir.fY, Dir.fX)); + double angle = std::abs(atan2(Dir.y, Dir.x)); if (angle < angleDevRad || (M_PI - angle) < angleDevRad ) // Suggest horizontal constraint constr.Type = Sketcher::Horizontal; @@ -243,9 +243,9 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested // Get geometry list const std::vector geomlist = sketchgui->getSketchObject()->getCompleteGeometry(); - Base::Vector3d tmpPos(Pos.fX, Pos.fY, 0.f); // Current cursor point - Base::Vector3d tmpDir(Dir.fX, Dir.fY, 0.f); // Direction of line - Base::Vector3d tmpStart(Pos.fX-Dir.fX, Pos.fY-Dir.fY, 0.f); // Start point + Base::Vector3d tmpPos(Pos.x, Pos.y, 0.f); // Current cursor point + Base::Vector3d tmpDir(Dir.x, Dir.y, 0.f); // Direction of line + Base::Vector3d tmpStart(Pos.x-Dir.x, Pos.y-Dir.y, 0.f); // Start point // Iterate through geometry int i = 0; @@ -287,7 +287,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested Base::Vector3d focus1P = center + cf * majdir; Base::Vector3d focus2P = center - cf * majdir; - Base::Vector3d norm = Base::Vector3d(Dir.fY,-Dir.fX).Normalize(); + Base::Vector3d norm = Base::Vector3d(Dir.y,-Dir.x).Normalize(); double distancetoline = norm*(tmpPos - focus1P); // distance focus1 to line @@ -342,7 +342,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested Base::Vector3d focus1P = center + cf * majdir; Base::Vector3d focus2P = center - cf * majdir; - Base::Vector3d norm = Base::Vector3d(Dir.fY,-Dir.fX).Normalize(); + Base::Vector3d norm = Base::Vector3d(Dir.y,-Dir.x).Normalize(); double distancetoline = norm*(tmpPos - focus1P); // distance focus1 to line @@ -581,13 +581,13 @@ void DrawSketchHandler::renderSuggestConstraintsCursor(std::vectorsetPositionText(Pos, text); } -void DrawSketchHandler::setPositionText(const Base::Vector2D &Pos) +void DrawSketchHandler::setPositionText(const Base::Vector2d &Pos) { sketchgui->setPositionText(Pos); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.h b/src/Mod/Sketcher/Gui/DrawSketchHandler.h index 22994bffbf6e..b7133740564c 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.h @@ -64,9 +64,9 @@ class SketcherGuiExport DrawSketchHandler virtual void activated(ViewProviderSketch *){} virtual void deactivated(ViewProviderSketch *){} - virtual void mouseMove(Base::Vector2D onSketchPos)=0; - virtual bool pressButton(Base::Vector2D onSketchPos)=0; - virtual bool releaseButton(Base::Vector2D onSketchPos)=0; + virtual void mouseMove(Base::Vector2d onSketchPos)=0; + virtual bool pressButton(Base::Vector2d onSketchPos)=0; + virtual bool releaseButton(Base::Vector2d onSketchPos)=0; virtual bool onSelectionChanged(const Gui::SelectionChanges&) { return false; } virtual void registerPressedKey(bool /*pressed*/, int /*key*/){} @@ -80,13 +80,13 @@ class SketcherGuiExport DrawSketchHandler int getHighestCurveIndex(void); int seekAutoConstraint(std::vector &suggestedConstraints, - const Base::Vector2D &Pos, const Base::Vector2D &Dir, + const Base::Vector2d &Pos, const Base::Vector2d &Dir, AutoConstraint::TargetType type = AutoConstraint::VERTEX); void createAutoConstraints(const std::vector &autoConstrs, int geoId, Sketcher::PointPos pointPos=Sketcher::none); - void setPositionText(const Base::Vector2D &Pos, const SbString &text); - void setPositionText(const Base::Vector2D &Pos); + void setPositionText(const Base::Vector2d &Pos, const SbString &text); + void setPositionText(const Base::Vector2d &Pos); void resetPositionText(void); void renderSuggestConstraintsCursor(std::vector &suggestedConstraints); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 9a6a958893bf..1c7a9b31a365 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -345,7 +345,7 @@ void ViewProviderSketch::deactivateHandler() { assert(edit); if(edit->sketchHandler != 0){ - std::vector editCurve; + std::vector editCurve; editCurve.clear(); drawEdit(editCurve); // erase any line edit->sketchHandler->deactivated(this); @@ -612,7 +612,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe return done; } case STATUS_SKETCH_UseHandler: - return edit->sketchHandler->pressButton(Base::Vector2D(x,y)); + return edit->sketchHandler->pressButton(Base::Vector2d(x,y)); default: return false; } @@ -799,7 +799,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe Gui::Command::openCommand("Drag Constraint"); for(std::set::iterator it = edit->DragConstraintSet.begin(); it != edit->DragConstraintSet.end(); ++it) { - moveConstraint(*it, Base::Vector2D(x, y)); + moveConstraint(*it, Base::Vector2d(x, y)); //updateColor(); } edit->PreselectConstraintSet = edit->DragConstraintSet; @@ -823,7 +823,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe Mode = STATUS_NONE; return true; case STATUS_SKETCH_UseHandler: - return edit->sketchHandler->releaseButton(Base::Vector2D(x,y)); + return edit->sketchHandler->releaseButton(Base::Vector2d(x,y)); case STATUS_NONE: default: return false; @@ -1108,7 +1108,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor Base::Vector3d vec(x-xInit,y-yInit,0); if (GeoId != Sketcher::Constraint::GeoUndef && PosId != Sketcher::none) { if (getSketchObject()->getSolvedSketch().movePoint(GeoId, PosId, vec, relative) == 0) { - setPositionText(Base::Vector2D(x,y)); + setPositionText(Base::Vector2d(x,y)); draw(true); signalSolved(QString::fromLatin1("Solved in %1 sec").arg(getSketchObject()->getSolvedSketch().SolveTime)); } else { @@ -1122,7 +1122,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor if (edit->DragCurve != -1) { Base::Vector3d vec(x-xInit,y-yInit,0); if (getSketchObject()->getSolvedSketch().movePoint(edit->DragCurve, Sketcher::none, vec, relative) == 0) { - setPositionText(Base::Vector2D(x,y)); + setPositionText(Base::Vector2d(x,y)); draw(true); signalSolved(QString::fromLatin1("Solved in %1 sec").arg(getSketchObject()->getSolvedSketch().SolveTime)); } else { @@ -1134,11 +1134,11 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor if (edit->DragConstraintSet.empty() == false) { for(std::set::iterator it = edit->DragConstraintSet.begin(); it != edit->DragConstraintSet.end(); ++it) - moveConstraint(*it, Base::Vector2D(x,y)); + moveConstraint(*it, Base::Vector2d(x,y)); } return true; case STATUS_SKETCH_UseHandler: - edit->sketchHandler->mouseMove(Base::Vector2D(x,y)); + edit->sketchHandler->mouseMove(Base::Vector2d(x,y)); if (preselectChanged) { this->drawConstraintIcons(); this->updateColor(); @@ -1166,7 +1166,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor return false; } -void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPos) +void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPos) { // are we in edit? if (!edit) @@ -1227,7 +1227,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo angle = (startangle + endangle)/2; } else { - Base::Vector3d tmpDir = Base::Vector3d(toPos.fX, toPos.fY, 0) - p1; + Base::Vector3d tmpDir = Base::Vector3d(toPos.x, toPos.y, 0) - p1; angle = atan2(tmpDir.y, tmpDir.x); } p2 = p1 + radius * Base::Vector3d(cos(angle),sin(angle),0.); @@ -1236,7 +1236,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo const Part::GeomCircle *circle = static_cast(geo); double radius = circle->getRadius(); p1 = circle->getCenter(); - Base::Vector3d tmpDir = Base::Vector3d(toPos.fX, toPos.fY, 0) - p1; + Base::Vector3d tmpDir = Base::Vector3d(toPos.x, toPos.y, 0) - p1; double angle = atan2(tmpDir.y, tmpDir.x); p2 = p1 + radius * Base::Vector3d(cos(angle),sin(angle),0.); } @@ -1245,7 +1245,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo } else return; - Base::Vector3d vec = Base::Vector3d(toPos.fX, toPos.fY, 0) - p2; + Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p2; Base::Vector3d dir; if (Constr->Type == Distance || Constr->Type == Radius) @@ -1263,7 +1263,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo Constr->LabelDistance = vec.x * norm.x + vec.y * norm.y; if (Constr->Type == Distance || Constr->Type == DistanceX || Constr->Type == DistanceY) { - vec = Base::Vector3d(toPos.fX, toPos.fY, 0) - (p2 + p1) / 2; + vec = Base::Vector3d(toPos.x, toPos.y, 0) - (p2 + p1) / 2; Constr->LabelPosition = vec.x * dir.x + vec.y * dir.y; } } @@ -1325,7 +1325,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo } else return; - Base::Vector3d vec = Base::Vector3d(toPos.fX, toPos.fY, 0) - p0; + Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p0; Constr->LabelDistance = vec.Length()/2; } @@ -1872,11 +1872,11 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & std::vector corners = viewer->getGLPolygon(corners0); // all calculations with polygon and proj are in dimensionless [0 1] screen coordinates - Base::Polygon2D polygon; - polygon.Add(Base::Vector2D(corners[0].getValue()[0], corners[0].getValue()[1])); - polygon.Add(Base::Vector2D(corners[0].getValue()[0], corners[1].getValue()[1])); - polygon.Add(Base::Vector2D(corners[1].getValue()[0], corners[1].getValue()[1])); - polygon.Add(Base::Vector2D(corners[1].getValue()[0], corners[0].getValue()[1])); + Base::Polygon2d polygon; + polygon.Add(Base::Vector2d(corners[0].getValue()[0], corners[0].getValue()[1])); + polygon.Add(Base::Vector2d(corners[0].getValue()[0], corners[1].getValue()[1])); + polygon.Add(Base::Vector2d(corners[1].getValue()[0], corners[1].getValue()[1])); + polygon.Add(Base::Vector2d(corners[1].getValue()[0], corners[0].getValue()[1])); Gui::ViewVolumeProjection proj(viewer->getSoRenderManager()->getCamera()->getViewVolume()); @@ -1908,7 +1908,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & pnt0 = proj(pnt0); VertexId += 1; - if (polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y))) { + if (polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y))) { std::stringstream ss; ss << "Vertex" << VertexId + 1; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); @@ -1923,8 +1923,8 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & pnt2 = proj(pnt2); VertexId += 2; - bool pnt1Inside = polygon.Contains(Base::Vector2D(pnt1.x, pnt1.y)); - bool pnt2Inside = polygon.Contains(Base::Vector2D(pnt2.x, pnt2.y)); + bool pnt1Inside = polygon.Contains(Base::Vector2d(pnt1.x, pnt1.y)); + bool pnt2Inside = polygon.Contains(Base::Vector2d(pnt2.x, pnt2.y)); if (pnt1Inside) { std::stringstream ss; ss << "Vertex" << VertexId; @@ -1952,7 +1952,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & Plm.multVec(pnt0, pnt0); pnt0 = proj(pnt0); - if (polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y))) { + if (polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y))) { std::stringstream ss; ss << "Vertex" << VertexId + 1; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); @@ -1972,7 +1972,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & 0.f); Plm.multVec(pnt, pnt); pnt = proj(pnt); - if (!polygon.Contains(Base::Vector2D(pnt.x, pnt.y))) { + if (!polygon.Contains(Base::Vector2d(pnt.x, pnt.y))) { bpolyInside = false; break; } @@ -1994,7 +1994,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & Plm.multVec(pnt0, pnt0); pnt0 = proj(pnt0); - if (polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y))) { + if (polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y))) { std::stringstream ss; ss << "Vertex" << VertexId + 1; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); @@ -2015,7 +2015,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & pnt = pnt0 + (cos(angle)*a)*majdir + sin(angle)*b*mindir; Plm.multVec(pnt, pnt); pnt = proj(pnt); - if (!polygon.Contains(Base::Vector2D(pnt.x, pnt.y))) { + if (!polygon.Contains(Base::Vector2d(pnt.x, pnt.y))) { bpolyInside = false; break; } @@ -2045,21 +2045,21 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & pnt1 = proj(pnt1); pnt2 = proj(pnt2); - bool pnt0Inside = polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y)); + bool pnt0Inside = polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y)); if (pnt0Inside) { std::stringstream ss; ss << "Vertex" << VertexId - 1; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); } - bool pnt1Inside = polygon.Contains(Base::Vector2D(pnt1.x, pnt1.y)); + bool pnt1Inside = polygon.Contains(Base::Vector2d(pnt1.x, pnt1.y)); if (pnt1Inside) { std::stringstream ss; ss << "Vertex" << VertexId; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); } - if (polygon.Contains(Base::Vector2D(pnt2.x, pnt2.y))) { + if (polygon.Contains(Base::Vector2d(pnt2.x, pnt2.y))) { std::stringstream ss; ss << "Vertex" << VertexId + 1; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); @@ -2087,7 +2087,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & 0.f); Plm.multVec(pnt, pnt); pnt = proj(pnt); - if (!polygon.Contains(Base::Vector2D(pnt.x, pnt.y))) { + if (!polygon.Contains(Base::Vector2d(pnt.x, pnt.y))) { bpolyInside = false; break; } @@ -2116,21 +2116,21 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & pnt1 = proj(pnt1); pnt2 = proj(pnt2); - bool pnt0Inside = polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y)); + bool pnt0Inside = polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y)); if (pnt0Inside) { std::stringstream ss; ss << "Vertex" << VertexId - 1; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); } - bool pnt1Inside = polygon.Contains(Base::Vector2D(pnt1.x, pnt1.y)); + bool pnt1Inside = polygon.Contains(Base::Vector2d(pnt1.x, pnt1.y)); if (pnt1Inside) { std::stringstream ss; ss << "Vertex" << VertexId; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); } - if (polygon.Contains(Base::Vector2D(pnt2.x, pnt2.y))) { + if (polygon.Contains(Base::Vector2d(pnt2.x, pnt2.y))) { std::stringstream ss; ss << "Vertex" << VertexId + 1; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); @@ -2159,7 +2159,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & pnt = pnt0 + cos(angle)*a*majdir + sin(angle)*b*mindir; Plm.multVec(pnt, pnt); pnt = proj(pnt); - if (!polygon.Contains(Base::Vector2D(pnt.x, pnt.y))) { + if (!polygon.Contains(Base::Vector2d(pnt.x, pnt.y))) { bpolyInside = false; break; } @@ -2181,7 +2181,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & } pnt0 = proj(Plm.getPosition()); - if (polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y))) + if (polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y))) Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), "RootPoint"); } @@ -4108,7 +4108,7 @@ void ViewProviderSketch::rebuildConstraintsVisual(void) } } -void ViewProviderSketch::drawEdit(const std::vector &EditCurve) +void ViewProviderSketch::drawEdit(const std::vector &EditCurve) { assert(edit); @@ -4118,8 +4118,8 @@ void ViewProviderSketch::drawEdit(const std::vector &EditCurve) int32_t *index = edit->EditCurveSet->numVertices.startEditing(); int i=0; // setting up the line set - for (std::vector::const_iterator it = EditCurve.begin(); it != EditCurve.end(); ++it,i++) - verts[i].setValue(it->fX,it->fY,zEdit); + for (std::vector::const_iterator it = EditCurve.begin(); it != EditCurve.end(); ++it,i++) + verts[i].setValue(it->x,it->y,zEdit); index[0] = EditCurve.size(); edit->EditCurvesCoordinate->point.finishEditing(); @@ -4720,18 +4720,18 @@ void ViewProviderSketch::unsetEditViewer(Gui::View3DInventorViewer* viewer) static_cast(root)->selectionRole.setValue(true); } -void ViewProviderSketch::setPositionText(const Base::Vector2D &Pos, const SbString &text) +void ViewProviderSketch::setPositionText(const Base::Vector2d &Pos, const SbString &text) { edit->textX->string = text; - edit->textPos->translation = SbVec3f(Pos.fX,Pos.fY,zText); + edit->textPos->translation = SbVec3f(Pos.x,Pos.y,zText); } -void ViewProviderSketch::setPositionText(const Base::Vector2D &Pos) +void ViewProviderSketch::setPositionText(const Base::Vector2d &Pos) { SbString text; - text.sprintf(" (%.1f,%.1f)", Pos.fX, Pos.fY); + text.sprintf(" (%.1f,%.1f)", Pos.x, Pos.y); edit->textX->string = text; - edit->textPos->translation = SbVec3f(Pos.fX,Pos.fY,zText); + edit->textPos->translation = SbVec3f(Pos.x,Pos.y,zText); } void ViewProviderSketch::resetPositionText(void) diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h index 5752bc123302..d77ed49e6055 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h @@ -113,7 +113,7 @@ class SketcherGuiExport ViewProviderSketch : public PartGui::ViewProvider2DObjec void draw(bool temp=false); /// draw the edit curve - void drawEdit(const std::vector &EditCurve); + void drawEdit(const std::vector &EditCurve); /// Is the view provider selectable bool isSelectable(void) const; @@ -189,7 +189,7 @@ class SketcherGuiExport ViewProviderSketch : public PartGui::ViewProvider2DObjec void snapToGrid(double &x, double &y); /// moves a selected constraint - void moveConstraint(int constNum, const Base::Vector2D &toPos); + void moveConstraint(int constNum, const Base::Vector2d &toPos); /// finds a free position for placing a constraint icon Base::Vector3d seekConstraintPosition(const Base::Vector3d &origPos, const Base::Vector3d &norm, @@ -342,8 +342,8 @@ class SketcherGuiExport ViewProviderSketch : public PartGui::ViewProvider2DObjec SbVec3s getDisplayedSize(const SoImage *) const; //@} - void setPositionText(const Base::Vector2D &Pos, const SbString &txt); - void setPositionText(const Base::Vector2D &Pos); + void setPositionText(const Base::Vector2d &Pos, const SbString &txt); + void setPositionText(const Base::Vector2d &Pos); void resetPositionText(void); // handle preselection and selection of points diff --git a/src/Mod/TechDraw/App/DrawParametricTemplate.cpp b/src/Mod/TechDraw/App/DrawParametricTemplate.cpp index 068aad1b8eeb..920507fffc89 100644 --- a/src/Mod/TechDraw/App/DrawParametricTemplate.cpp +++ b/src/Mod/TechDraw/App/DrawParametricTemplate.cpp @@ -119,8 +119,8 @@ int DrawParametricTemplate::drawLine(double x1, double y1, double x2, double y2) { TechDrawGeometry::Generic *line = new TechDrawGeometry::Generic(); - line->points.push_back(Base::Vector2D(x1, y1)); - line->points.push_back(Base::Vector2D(x2, y2)); + line->points.push_back(Base::Vector2d(x1, y1)); + line->points.push_back(Base::Vector2d(x2, y2)); geom.push_back(line); // Push onto geometry stack return geom.size() -1; @@ -148,4 +148,4 @@ template<> const char* TechDraw::DrawParametricTemplatePython::getViewProviderNa // explicit template instantiation template class TechDrawExport FeaturePythonT; -} +} diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index 13599633e7b7..af2806f5325c 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -286,15 +286,15 @@ double DrawViewDimension::getDimValue() const int idx = DrawUtil::getIndexFromName(subElements[0]); TechDrawGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx); TechDrawGeometry::Generic* gen = static_cast(geom); - Base::Vector2D start = gen->points[0]; - Base::Vector2D end = gen->points[1]; - Base::Vector2D line = end - start; + Base::Vector2d start = gen->points[0]; + Base::Vector2d end = gen->points[1]; + Base::Vector2d line = end - start; if (Type.isValue("Distance")) { result = line.Length() / getViewPart()->Scale.getValue(); } else if (Type.isValue("DistanceX")) { - return fabs(line.fX) / getViewPart()->Scale.getValue(); + return fabs(line.x) / getViewPart()->Scale.getValue(); } else { - result = fabs(line.fY) / getViewPart()->Scale.getValue(); + result = fabs(line.y) / getViewPart()->Scale.getValue(); } }else if (getRefType() == twoEdge) { //only works for straight line edges @@ -304,35 +304,35 @@ double DrawViewDimension::getDimValue() const TechDrawGeometry::BaseGeom* geom1 = getViewPart()->getProjEdgeByIndex(idx1); TechDrawGeometry::Generic* gen0 = static_cast(geom0); TechDrawGeometry::Generic* gen1 = static_cast(geom1); - Base::Vector2D s0 = gen0->points[0]; - Base::Vector2D e0 = gen0->points[1]; - Base::Vector2D s1 = gen1->points[0]; - Base::Vector2D e1 = gen1->points[1]; + Base::Vector2d s0 = gen0->points[0]; + Base::Vector2d e0 = gen0->points[1]; + Base::Vector2d s1 = gen1->points[0]; + Base::Vector2d e1 = gen1->points[1]; if (Type.isValue("Distance")) { result = dist2Segs(s0,e0,s1,e1) / getViewPart()->Scale.getValue(); } else if (Type.isValue("DistanceX")) { - Base::Vector2D p1 = geom0->nearPoint(geom1); - Base::Vector2D p2 = geom1->nearPoint(geom0); - result = fabs(p1.fX - p2.fX) / getViewPart()->Scale.getValue(); + Base::Vector2d p1 = geom0->nearPoint(geom1); + Base::Vector2d p2 = geom1->nearPoint(geom0); + result = fabs(p1.x - p2.x) / getViewPart()->Scale.getValue(); } else if (Type.isValue("DistanceY")) { - Base::Vector2D p1 = geom0->nearPoint(geom1); - Base::Vector2D p2 = geom1->nearPoint(geom0); - result = fabs(p1.fY - p2.fY) / getViewPart()->Scale.getValue(); + Base::Vector2d p1 = geom0->nearPoint(geom1); + Base::Vector2d p2 = geom1->nearPoint(geom0); + result = fabs(p1.y - p2.y) / getViewPart()->Scale.getValue(); } } else if (getRefType() == twoVertex) { int idx0 = DrawUtil::getIndexFromName(subElements[0]); int idx1 = DrawUtil::getIndexFromName(subElements[1]); TechDrawGeometry::Vertex* v0 = getViewPart()->getProjVertexByIndex(idx0); TechDrawGeometry::Vertex* v1 = getViewPart()->getProjVertexByIndex(idx1); - Base::Vector2D start = v0->pnt; - Base::Vector2D end = v1->pnt; - Base::Vector2D line = end - start; + Base::Vector2d start = v0->pnt; + Base::Vector2d end = v1->pnt; + Base::Vector2d line = end - start; if (Type.isValue("Distance")) { result = line.Length() / getViewPart()->Scale.getValue(); } else if (Type.isValue("DistanceX")) { - result = fabs(line.fX) / getViewPart()->Scale.getValue(); + result = fabs(line.x) / getViewPart()->Scale.getValue(); } else { - result = fabs(line.fY) / getViewPart()->Scale.getValue(); + result = fabs(line.y) / getViewPart()->Scale.getValue(); } } else if (getRefType() == vertexEdge) { int idx0 = DrawUtil::getIndexFromName(subElements[0]); @@ -346,14 +346,14 @@ double DrawViewDimension::getDimValue() const e = getViewPart()->getProjEdgeByIndex(idx1); v = getViewPart()->getProjVertexByIndex(idx0); } - Base::Vector2D nearPoint = e->nearPoint(v->pnt); - Base::Vector2D line = nearPoint - v->pnt; + Base::Vector2d nearPoint = e->nearPoint(v->pnt); + Base::Vector2d line = nearPoint - v->pnt; if (Type.isValue("Distance")) { result = e->minDist(v->pnt) / getViewPart()->Scale.getValue(); } else if (Type.isValue("DistanceX")) { - result = fabs(line.fX) / getViewPart()->Scale.getValue(); + result = fabs(line.x) / getViewPart()->Scale.getValue(); } else { - result = fabs(line.fY) / getViewPart()->Scale.getValue(); + result = fabs(line.y) / getViewPart()->Scale.getValue(); } } //else tarfu } else if(Type.isValue("Radius")){ @@ -371,7 +371,7 @@ double DrawViewDimension::getDimValue() const } else if(Type.isValue("Angle")){ // Must project lines to 2D so cannot use measurement framework this time //Relcalculate the measurement based on references stored. - //WF: why not use projected geom in GeomObject and Vector2D.GetAngle? intersection pt & direction issues? + //WF: why not use projected geom in GeomObject and Vector2d.GetAngle? intersection pt & direction issues? //TODO: do we need to distinguish inner vs outer angle? -wf // if(subElements.size() != 2) { // throw Base::Exception("FVD - Two references required for angle measurement"); @@ -395,11 +395,11 @@ double DrawViewDimension::getDimValue() const TechDrawGeometry::Generic *gen1 = static_cast(edge0); TechDrawGeometry::Generic *gen2 = static_cast(edge1); - Base::Vector3d p1S(gen1->points.at(0).fX, gen1->points.at(0).fY, 0.); - Base::Vector3d p1E(gen1->points.at(1).fX, gen1->points.at(1).fY, 0.); + Base::Vector3d p1S(gen1->points.at(0).x, gen1->points.at(0).y, 0.); + Base::Vector3d p1E(gen1->points.at(1).x, gen1->points.at(1).y, 0.); - Base::Vector3d p2S(gen2->points.at(0).fX, gen2->points.at(0).fY, 0.); - Base::Vector3d p2E(gen2->points.at(1).fX, gen2->points.at(1).fY, 0.); + Base::Vector3d p2S(gen2->points.at(0).x, gen2->points.at(0).y, 0.); + Base::Vector3d p2E(gen2->points.at(1).x, gen2->points.at(1).y, 0.); Base::Vector3d dir1 = p1E - p1S; Base::Vector3d dir2 = p2E - p2S; @@ -409,8 +409,8 @@ double DrawViewDimension::getDimValue() const if ((det > 0 ? det : -det) < 1e-10) throw Base::Exception("Invalid selection - Det = 0"); - double c1 = dir1.y*gen1->points.at(0).fX - dir1.x*gen1->points.at(0).fY; - double c2 = dir2.y*gen2->points.at(1).fX - dir2.x*gen2->points.at(1).fY; + double c1 = dir1.y*gen1->points.at(0).x - dir1.x*gen1->points.at(0).y; + double c2 = dir2.y*gen2->points.at(1).x - dir2.x*gen2->points.at(1).y; double x = (dir1.x*c2 - dir2.x*c1)/det; double y = (dir1.y*c2 - dir2.y*c1)/det; @@ -519,20 +519,20 @@ void DrawViewDimension::dumpRefs2D(char* text) const } } -double DrawViewDimension::dist2Segs(Base::Vector2D s1, - Base::Vector2D e1, - Base::Vector2D s2, - Base::Vector2D e2) const +double DrawViewDimension::dist2Segs(Base::Vector2d s1, + Base::Vector2d e1, + Base::Vector2d s2, + Base::Vector2d e2) const { - gp_Pnt start(s1.fX,s1.fY,0.0); - gp_Pnt end(e1.fX,e1.fY,0.0); + gp_Pnt start(s1.x,s1.y,0.0); + gp_Pnt end(e1.x,e1.y,0.0); TopoDS_Vertex v1 = BRepBuilderAPI_MakeVertex(start); TopoDS_Vertex v2 = BRepBuilderAPI_MakeVertex(end); BRepBuilderAPI_MakeEdge makeEdge1(v1,v2); TopoDS_Edge edge1 = makeEdge1.Edge(); - start = gp_Pnt(s2.fX,s2.fY,0.0); - end = gp_Pnt(e2.fX,e2.fY,0.0); + start = gp_Pnt(s2.x,s2.y,0.0); + end = gp_Pnt(e2.x,e2.y,0.0); v1 = BRepBuilderAPI_MakeVertex(start); v2 = BRepBuilderAPI_MakeVertex(end); BRepBuilderAPI_MakeEdge makeEdge2(v1,v2); diff --git a/src/Mod/TechDraw/App/DrawViewDimension.h b/src/Mod/TechDraw/App/DrawViewDimension.h index 4cd9b90ce936..78420fa4ceb4 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.h +++ b/src/Mod/TechDraw/App/DrawViewDimension.h @@ -103,10 +103,10 @@ class TechDrawExport DrawViewDimension : public TechDraw::DrawView protected: Measure::Measurement *measurement; - double dist2Segs(Base::Vector2D s1, - Base::Vector2D e1, - Base::Vector2D s2, - Base::Vector2D e2) const; + double dist2Segs(Base::Vector2d s1, + Base::Vector2d e1, + Base::Vector2d s2, + Base::Vector2d e2) const; private: static const char* TypeEnums[]; static const char* MeasureTypeEnums[]; diff --git a/src/Mod/TechDraw/App/Geometry.cpp b/src/Mod/TechDraw/App/Geometry.cpp index ceb325c9c3d0..9c2f6d9e2f6a 100644 --- a/src/Mod/TechDraw/App/Geometry.cpp +++ b/src/Mod/TechDraw/App/Geometry.cpp @@ -101,46 +101,46 @@ BaseGeom::BaseGeom() : } -std::vector BaseGeom::findEndPoints() +std::vector BaseGeom::findEndPoints() { - std::vector result; + std::vector result; gp_Pnt p = BRep_Tool::Pnt(TopExp::FirstVertex(occEdge)); - result.push_back(Base::Vector2D(p.X(),p.Y())); + result.push_back(Base::Vector2d(p.X(),p.Y())); p = BRep_Tool::Pnt(TopExp::LastVertex(occEdge)); - result.push_back(Base::Vector2D(p.X(),p.Y())); + result.push_back(Base::Vector2d(p.X(),p.Y())); return result; } -Base::Vector2D BaseGeom::getStartPoint() +Base::Vector2d BaseGeom::getStartPoint() { - std::vector verts = findEndPoints(); + std::vector verts = findEndPoints(); return verts[0]; } -Base::Vector2D BaseGeom::getEndPoint() +Base::Vector2d BaseGeom::getEndPoint() { - std::vector verts = findEndPoints(); + std::vector verts = findEndPoints(); return verts[1]; } -double BaseGeom::minDist(Base::Vector2D p) +double BaseGeom::minDist(Base::Vector2d p) { double minDist = -1.0; - gp_Pnt pnt(p.fX,p.fY,0.0); + gp_Pnt pnt(p.x,p.y,0.0); TopoDS_Vertex v = BRepBuilderAPI_MakeVertex(pnt); minDist = TechDraw::DrawUtil::simpleMinDist(occEdge,v); return minDist; } //!find point on me nearest to p -Base::Vector2D BaseGeom::nearPoint(const BaseGeom* p) +Base::Vector2d BaseGeom::nearPoint(const BaseGeom* p) { - Base::Vector2D result(0.0,0.0); + Base::Vector2d result(0.0,0.0); TopoDS_Edge pEdge = p->occEdge; BRepExtrema_DistShapeShape extss(occEdge, pEdge); if (extss.IsDone()) { @@ -148,16 +148,16 @@ Base::Vector2D BaseGeom::nearPoint(const BaseGeom* p) if (count != 0) { gp_Pnt p1; p1 = extss.PointOnShape1(1); - result = Base::Vector2D(p1.X(),p1.Y()); + result = Base::Vector2d(p1.X(),p1.Y()); } } return result; } -Base::Vector2D BaseGeom::nearPoint(Base::Vector2D p) +Base::Vector2d BaseGeom::nearPoint(Base::Vector2d p) { - gp_Pnt pnt(p.fX,p.fY,0.0); - Base::Vector2D result(0.0,0.0); + gp_Pnt pnt(p.x,p.y,0.0); + Base::Vector2d result(0.0,0.0); TopoDS_Vertex v = BRepBuilderAPI_MakeVertex(pnt); BRepExtrema_DistShapeShape extss(occEdge, v); if (extss.IsDone()) { @@ -165,7 +165,7 @@ Base::Vector2D BaseGeom::nearPoint(Base::Vector2D p) if (count != 0) { gp_Pnt p1; p1 = extss.PointOnShape1(1); - result = Base::Vector2D(p1.X(),p1.Y()); + result = Base::Vector2d(p1.X(),p1.Y()); } } return result; @@ -173,10 +173,10 @@ Base::Vector2D BaseGeom::nearPoint(Base::Vector2D p) std::string BaseGeom::dump() { - Base::Vector2D start = getStartPoint(); - Base::Vector2D end = getEndPoint(); + Base::Vector2d start = getStartPoint(); + Base::Vector2d end = getEndPoint(); std::stringstream ss; - ss << "BaseGeom: s:(" << start.fX << "," << start.fY << ") e:(" << end.fX << "," << end.fY << ") "; + ss << "BaseGeom: s:(" << start.x << "," << start.y << ") e:(" << end.x << "," << end.y << ") "; ss << "type: " << geomType << " class: " << classOfEdge << " viz: " << visible << " rev: " << reversed; return ss.str(); } @@ -265,7 +265,7 @@ Ellipse::Ellipse(const TopoDS_Edge &e) gp_Elips ellp = c.Ellipse(); const gp_Pnt &p = ellp.Location(); - center = Base::Vector2D(p.X(), p.Y()); + center = Base::Vector2d(p.X(), p.Y()); major = ellp.MajorRadius(); minor = ellp.MinorRadius(); @@ -296,9 +296,9 @@ AOE::AOE(const TopoDS_Edge &e) : Ellipse(e) cw = (a < 0) ? true: false; largeArc = (l-f > M_PI) ? true : false; - startPnt = Base::Vector2D(s.X(), s.Y()); - endPnt = Base::Vector2D(ePt.X(), ePt.Y()); - midPnt = Base::Vector2D(m.X(), m.Y()); + startPnt = Base::Vector2d(s.X(), s.Y()); + endPnt = Base::Vector2d(ePt.X(), ePt.Y()); + midPnt = Base::Vector2d(m.X(), m.Y()); } @@ -312,7 +312,7 @@ Circle::Circle(const TopoDS_Edge &e) const gp_Pnt& p = circ.Location(); radius = circ.Radius(); - center = Base::Vector2D(p.X(), p.Y()); + center = Base::Vector2d(p.X(), p.Y()); } @@ -337,9 +337,9 @@ AOC::AOC(const TopoDS_Edge &e) : Circle(e) cw = (a < 0) ? true: false; largeArc = (l-f > M_PI) ? true : false; - startPnt = Base::Vector2D(s.X(), s.Y()); - endPnt = Base::Vector2D(ePt.X(), ePt.Y()); - midPnt = Base::Vector2D(m.X(), m.Y()); + startPnt = Base::Vector2d(s.X(), s.Y()); + endPnt = Base::Vector2d(ePt.X(), ePt.Y()); + midPnt = Base::Vector2d(m.X(), m.Y()); } bool AOC::isOnArc(Base::Vector3d p) @@ -363,7 +363,7 @@ bool AOC::isOnArc(Base::Vector3d p) double AOC::distToArc(Base::Vector3d p) { - Base::Vector2D p2(p.x,p.y); + Base::Vector2d p2(p.x,p.y); double result = minDist(p2); return result; } @@ -406,14 +406,14 @@ Generic::Generic(const TopoDS_Edge &e) if (!polygon.IsNull()) { const TColgp_Array1OfPnt &nodes = polygon->Nodes(); for (int i = nodes.Lower(); i <= nodes.Upper(); i++){ - points.push_back(Base::Vector2D(nodes(i).X(), nodes(i).Y())); + points.push_back(Base::Vector2d(nodes(i).X(), nodes(i).Y())); } } else { //no polygon representation? approximate with line gp_Pnt p = BRep_Tool::Pnt(TopExp::FirstVertex(occEdge)); - points.push_back(Base::Vector2D(p.X(), p.Y())); + points.push_back(Base::Vector2d(p.X(), p.Y())); p = BRep_Tool::Pnt(TopExp::LastVertex(occEdge)); - points.push_back(Base::Vector2D(p.X(), p.Y())); + points.push_back(Base::Vector2d(p.X(), p.Y())); } } @@ -471,9 +471,9 @@ BSpline::BSpline(const TopoDS_Edge &e) BezierSegment tempSegment; tempSegment.poles = 3; tempSegment.degree = 2; - tempSegment.pnts.push_back(Base::Vector2D(s.X(),s.Y())); - tempSegment.pnts.push_back(Base::Vector2D(m.X(),m.Y())); - tempSegment.pnts.push_back(Base::Vector2D(ePt.X(),ePt.Y())); + tempSegment.pnts.push_back(Base::Vector2d(s.X(),s.Y())); + tempSegment.pnts.push_back(Base::Vector2d(m.X(),m.Y())); + tempSegment.pnts.push_back(Base::Vector2d(ePt.X(),ePt.Y())); segments.push_back(tempSegment); } else { for (Standard_Integer i = 1; i <= crt.NbArcs(); ++i) { @@ -486,7 +486,7 @@ BSpline::BSpline(const TopoDS_Edge &e) tempSegment.degree = bezier->Degree(); for (int pole = 1; pole <= tempSegment.poles; ++pole) { controlPoint = bezier->Pole(pole); - tempSegment.pnts.push_back(Base::Vector2D(controlPoint.X(), controlPoint.Y())); + tempSegment.pnts.push_back(Base::Vector2d(controlPoint.X(), controlPoint.Y())); } segments.push_back(tempSegment); } @@ -519,7 +519,7 @@ BezierSegment::BezierSegment(const TopoDS_Edge &e) } for (int i = 1; i <= poles; ++i) { gp_Pnt controlPoint = bez->Pole(i); - pnts.push_back(Base::Vector2D(controlPoint.X(), controlPoint.Y())); + pnts.push_back(Base::Vector2d(controlPoint.X(), controlPoint.Y())); } } @@ -527,7 +527,7 @@ BezierSegment::BezierSegment(const TopoDS_Edge &e) //**** Vertex Vertex::Vertex(double x, double y) { - pnt = Base::Vector2D(x, y); + pnt = Base::Vector2d(x, y); extractType = ExtractionType::Plain; //obs? visible = false; ref3D = -1; //obs. never used. @@ -561,7 +561,7 @@ BaseGeomPtrVector GeometryUtils::chainGeoms(BaseGeomPtrVector geoms) } else { //start with first edge result.push_back(geoms[0]); - Base::Vector2D atPoint = (geoms[0])->getEndPoint(); + Base::Vector2d atPoint = (geoms[0])->getEndPoint(); used[0] = true; for (unsigned int i = 1; i < geoms.size(); i++) { //do size-1 more edges auto next( nextGeom(atPoint, geoms, used, Precision::Confusion()) ); @@ -586,7 +586,7 @@ BaseGeomPtrVector GeometryUtils::chainGeoms(BaseGeomPtrVector geoms) /*static*/ GeometryUtils::ReturnType GeometryUtils::nextGeom( - Base::Vector2D atPoint, + Base::Vector2d atPoint, BaseGeomPtrVector geoms, std::vector used, double tolerance ) diff --git a/src/Mod/TechDraw/App/Geometry.h b/src/Mod/TechDraw/App/Geometry.h index 252c31ea2695..239366ce573f 100644 --- a/src/Mod/TechDraw/App/Geometry.h +++ b/src/Mod/TechDraw/App/Geometry.h @@ -74,12 +74,12 @@ class TechDrawExport BaseGeom int ref3D; //obs? TopoDS_Edge occEdge; //projected Edge - std::vector findEndPoints(); - Base::Vector2D getStartPoint(); - Base::Vector2D getEndPoint(); - double minDist(Base::Vector2D p); - Base::Vector2D nearPoint(Base::Vector2D p); - Base::Vector2D nearPoint(const BaseGeom* p); + std::vector findEndPoints(); + Base::Vector2d getStartPoint(); + Base::Vector2d getEndPoint(); + double minDist(Base::Vector2d p); + Base::Vector2d nearPoint(Base::Vector2d p); + Base::Vector2d nearPoint(const BaseGeom* p); static BaseGeom* baseFactory(TopoDS_Edge edge); std::string dump(); }; @@ -93,7 +93,7 @@ class TechDrawExport Circle: public BaseGeom ~Circle() = default; public: - Base::Vector2D center; + Base::Vector2d center; double radius; }; @@ -104,7 +104,7 @@ class TechDrawExport Ellipse: public BaseGeom ~Ellipse() = default; public: - Base::Vector2D center; + Base::Vector2d center; double minor; double major; @@ -119,9 +119,9 @@ class TechDrawExport AOE: public Ellipse ~AOE() = default; public: - Base::Vector2D startPnt; //TODO: The points are used for drawing, the angles for bounding box calcs - seems redundant - Base::Vector2D endPnt; - Base::Vector2D midPnt; + Base::Vector2d startPnt; //TODO: The points are used for drawing, the angles for bounding box calcs - seems redundant + Base::Vector2d endPnt; + Base::Vector2d midPnt; /// Angle in radian double startAngle; @@ -141,9 +141,9 @@ class TechDrawExport AOC: public Circle ~AOC() = default; public: - Base::Vector2D startPnt; - Base::Vector2D endPnt; - Base::Vector2D midPnt; + Base::Vector2d startPnt; + Base::Vector2d endPnt; + Base::Vector2d midPnt; /// Angle in radian ??angle with horizontal? double startAngle; @@ -170,8 +170,8 @@ class TechDrawExport BezierSegment: public BaseGeom int poles; int degree; - //Base::Vector2D pnts[4]; - std::vector pnts; + //Base::Vector2d pnts[4]; + std::vector pnts; }; class TechDrawExport BSpline: public BaseGeom @@ -192,7 +192,7 @@ class TechDrawExport Generic: public BaseGeom Generic(); ~Generic() = default; - std::vector points; + std::vector points; }; @@ -222,19 +222,19 @@ class TechDrawExport Vertex { public: Vertex(double x, double y); - Vertex(Base::Vector2D v) : Vertex(v.fX,v.fY) {} + Vertex(Base::Vector2d v) : Vertex(v.x,v.y) {} ~Vertex() = default; - Base::Vector2D pnt; + Base::Vector2d pnt; ExtractionType extractType; //obs? bool visible; int ref3D; //obs. never used. bool isCenter; TopoDS_Vertex occVertex; bool isEqual(Vertex* v, double tol); - Base::Vector3d getAs3D(void) {return Base::Vector3d(pnt.fX,pnt.fY,0.0);} - double x() {return pnt.fX;} - double y() {return pnt.fY;} + Base::Vector3d getAs3D(void) {return Base::Vector3d(pnt.x,pnt.y,0.0);} + double x() {return pnt.x;} + double y() {return pnt.y;} }; /// Encapsulates some useful static methods @@ -255,7 +255,7 @@ class TechDrawExport GeometryUtils /*! * returns index[1:geoms.size()),reversed [true,false] */ - static ReturnType nextGeom( Base::Vector2D atPoint, + static ReturnType nextGeom( Base::Vector2d atPoint, std::vector geoms, std::vector used, double tolerance ); diff --git a/src/Mod/TechDraw/App/GeometryObject.cpp b/src/Mod/TechDraw/App/GeometryObject.cpp index afd993a465b0..55503ffe6f7b 100644 --- a/src/Mod/TechDraw/App/GeometryObject.cpp +++ b/src/Mod/TechDraw/App/GeometryObject.cpp @@ -414,7 +414,7 @@ Base::BoundBox3d GeometryObject::calcBoundingBox() const } //! does this GeometryObject already have this vertex -bool GeometryObject::findVertex(Base::Vector2D v) +bool GeometryObject::findVertex(Base::Vector2d v) { bool found = false; std::vector::iterator it = vertexGeom.begin(); diff --git a/src/Mod/TechDraw/App/GeometryObject.h b/src/Mod/TechDraw/App/GeometryObject.h index cf25e125cfab..40aa56ea8e9a 100644 --- a/src/Mod/TechDraw/App/GeometryObject.h +++ b/src/Mod/TechDraw/App/GeometryObject.h @@ -113,7 +113,7 @@ class TechDrawExport GeometryObject std::vector vertexGeom; std::vector faceGeom; - bool findVertex(Base::Vector2D v); + bool findVertex(Base::Vector2d v); double Scale; diff --git a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp index b6e5e5d45b65..c732d1215717 100644 --- a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp @@ -1009,10 +1009,10 @@ int _isValidSingleEdge(Gui::Command* cmd) { if(gen1->points.size() > 2) { //the edge is a polyline return isInvalid; } - Base::Vector2D line = gen1->points.at(1) - gen1->points.at(0); - if(fabs(line.fY) < FLT_EPSILON ) { + Base::Vector2d line = gen1->points.at(1) - gen1->points.at(0); + if(fabs(line.y) < FLT_EPSILON ) { edgeType = isHorizontal; - } else if(fabs(line.fX) < FLT_EPSILON) { + } else if(fabs(line.x) < FLT_EPSILON) { edgeType = isVertical; } else { edgeType = isDiagonal; @@ -1079,15 +1079,15 @@ int _isValidEdgeToEdge(Gui::Command* cmd) { gen1->points.size() > 2) { //the edge is a polyline return isInvalid; } - Base::Vector2D line0 = gen0->points.at(1) - gen0->points.at(0); - Base::Vector2D line1 = gen1->points.at(1) - gen1->points.at(0); - double xprod = fabs(line0.fX * line1.fY - line0.fY * line1.fX); + Base::Vector2d line0 = gen0->points.at(1) - gen0->points.at(0); + Base::Vector2d line1 = gen1->points.at(1) - gen1->points.at(0); + double xprod = fabs(line0.x * line1.y - line0.y * line1.x); if(xprod > FLT_EPSILON) { //edges are not parallel return isAngle; } - if(fabs(line0.fX) < FLT_EPSILON && fabs(line1.fX) < FLT_EPSILON) { //both horizontal + if(fabs(line0.x) < FLT_EPSILON && fabs(line1.x) < FLT_EPSILON) { //both horizontal edgeType = isHorizontal; - } else if(fabs(line0.fY) < FLT_EPSILON && fabs(line1.fY) < FLT_EPSILON) { //both vertical + } else if(fabs(line0.y) < FLT_EPSILON && fabs(line1.y) < FLT_EPSILON) { //both vertical edgeType = isVertical; } else { edgeType = isDiagonal; diff --git a/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp b/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp index 4cf04bc9c75a..8da70a146255 100644 --- a/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp +++ b/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp @@ -110,11 +110,11 @@ void QGIDrawingTemplate::draw() TechDrawGeometry::Generic *geom = static_cast(*it); - path.moveTo(geom->points[0].fX, geom->points[0].fY); - std::vector::const_iterator it = geom->points.begin(); + path.moveTo(geom->points[0].x, geom->points[0].y); + std::vector::const_iterator it = geom->points.begin(); for(++it; it != geom->points.end(); ++it) { - path.lineTo((*it).fX, (*it).fY); + path.lineTo((*it).x, (*it).y); } break; } diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index 7326837d74ea..82e446f6b68a 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -324,10 +324,10 @@ void QGIViewDimension::draw() } if (geom->geomType == TechDrawGeometry::GENERIC) { TechDrawGeometry::Generic *gen = static_cast(geom); - Base::Vector2D pnt1 = gen->points.at(0); - Base::Vector2D pnt2 = gen->points.at(1); - distStart = Base::Vector3d(pnt1.fX, pnt1.fY, 0.); - distEnd = Base::Vector3d(pnt2.fX, pnt2.fY, 0.); + Base::Vector2d pnt1 = gen->points.at(0); + Base::Vector2d pnt2 = gen->points.at(1); + distStart = Base::Vector3d(pnt1.x, pnt1.y, 0.); + distEnd = Base::Vector3d(pnt2.x, pnt2.y, 0.); } else { throw Base::Exception("QGIVD::draw - Original edge not found or is invalid type (1)"); } @@ -344,8 +344,8 @@ void QGIViewDimension::draw() idx0,idx1,refObj->getEdgeGeometry().size()); return; } - distStart = Base::Vector3d (v0->pnt.fX, v0->pnt.fY, 0.); - distEnd = Base::Vector3d (v1->pnt.fX, v1->pnt.fY, 0.); + distStart = Base::Vector3d (v0->pnt.x, v0->pnt.y, 0.); + distEnd = Base::Vector3d (v1->pnt.x, v1->pnt.y, 0.); } else if(dim->References2D.getValues().size() == 2 && TechDraw::DrawUtil::getGeomTypeFromName(SubNames[0]) == "Edge" && TechDraw::DrawUtil::getGeomTypeFromName(SubNames[1]) == "Edge") { @@ -360,25 +360,25 @@ void QGIViewDimension::draw() } if (strcmp(dimType, "DistanceX") == 0 || strcmp(dimType, "DistanceY") == 0) { - Base::Vector2D p1,p2; + Base::Vector2d p1,p2; p1 = geom0->nearPoint(geom1); p2 = geom1->nearPoint(geom0); - distStart = Base::Vector3d(p1.fX,p1.fY,0.0); - distEnd = Base::Vector3d(p2.fX,p2.fY,0.0); + distStart = Base::Vector3d(p1.x,p1.y,0.0); + distEnd = Base::Vector3d(p2.x,p2.y,0.0); } else if ( (geom0->geomType == TechDrawGeometry::GENERIC) && (geom1->geomType == TechDrawGeometry::GENERIC) ){ TechDrawGeometry::Generic *gen0 = static_cast(geom0); TechDrawGeometry::Generic *gen1 = static_cast(geom1); - Base::Vector2D pnt1, pnt2; + Base::Vector2d pnt1, pnt2; Base::Vector3d edge1Start, edge1End, edge2Start, edge2End; pnt1 = gen0->points.at(0); pnt2 = gen0->points.at(1); - edge1Start = Base::Vector3d(pnt1.fX, pnt1.fY, 0); - edge1End = Base::Vector3d(pnt2.fX, pnt2.fY, 0); + edge1Start = Base::Vector3d(pnt1.x, pnt1.y, 0); + edge1End = Base::Vector3d(pnt2.x, pnt2.y, 0); pnt1 = gen1->points.at(0); pnt2 = gen1->points.at(1); - edge2Start = Base::Vector3d(pnt1.fX, pnt1.fY, 0); - edge2End = Base::Vector3d(pnt2.fX, pnt2.fY, 0); + edge2Start = Base::Vector3d(pnt1.x, pnt1.y, 0); + edge2End = Base::Vector3d(pnt2.x, pnt2.y, 0); // figure out which end of each edge to use for drawing Base::Vector3d lin1 = edge1End - edge1Start; //vector from edge1Start to edge2End @@ -423,9 +423,9 @@ void QGIViewDimension::draw() ex,vx,refObj->getEdgeGeometry().size()); return; } - Base::Vector3d pnt(v->pnt.fX,v->pnt.fY, 0.0); - Base::Vector3d edgeStart(e->getStartPoint().fX,e->getStartPoint().fY,0.0); - Base::Vector3d edgeEnd(e->getEndPoint().fX,e->getEndPoint().fY,0.0); + Base::Vector3d pnt(v->pnt.x,v->pnt.y, 0.0); + Base::Vector3d edgeStart(e->getStartPoint().x,e->getStartPoint().y,0.0); + Base::Vector3d edgeEnd(e->getEndPoint().x,e->getEndPoint().y,0.0); Base::Vector3d displace; displace.ProjectToLine(pnt - edgeStart, edgeEnd - edgeStart); Base::Vector3d ptOnLine = pnt + displace; @@ -626,7 +626,7 @@ void QGIViewDimension::draw() (geom->geomType == TechDrawGeometry::ARCOFCIRCLE) ) { TechDrawGeometry::Circle *circ = static_cast(geom); radius = circ->radius; - centre = Base::Vector3d (circ->center.fX, circ->center.fY, 0); + centre = Base::Vector3d (circ->center.x, circ->center.y, 0); } else { throw Base::Exception("FVD::draw - Original edge not found or is invalid type (2)"); } @@ -842,15 +842,15 @@ void QGIViewDimension::draw() if (geom->geomType == TechDrawGeometry::CIRCLE) { TechDrawGeometry::Circle *circ = static_cast(geom); radius = circ->radius; - curveCenter = Base::Vector3d(circ->center.fX,circ->center.fY,0.0); + curveCenter = Base::Vector3d(circ->center.x,circ->center.y,0.0); pointOnCurve = Base::Vector3d(curveCenter.x + radius, curveCenter.y,0.0); } else if (geom->geomType == TechDrawGeometry::ARCOFCIRCLE) { isArc = true; TechDrawGeometry::AOC *circ = static_cast(geom); geomArc = circ; radius = circ->radius; - curveCenter = Base::Vector3d(circ->center.fX,circ->center.fY,0.0); - pointOnCurve = Base::Vector3d(circ->midPnt.fX, circ->midPnt.fY,0.0); + curveCenter = Base::Vector3d(circ->center.x,circ->center.y,0.0); + pointOnCurve = Base::Vector3d(circ->midPnt.x, circ->midPnt.y,0.0); } else { throw Base::Exception("FVD::draw - Original edge not found or is invalid type (3)"); } @@ -904,9 +904,9 @@ void QGIViewDimension::draw() //handle partial arc weird cases if (isArc) { - Base::Vector3d midPt(geomArc->midPnt.fX, geomArc->midPnt.fY,0.0); - Base::Vector3d startPt(geomArc->startPnt.fX, geomArc->startPnt.fY,0.0); - Base::Vector3d endPt(geomArc->endPnt.fX, geomArc->endPnt.fY,0.0); + Base::Vector3d midPt(geomArc->midPnt.x, geomArc->midPnt.y,0.0); + Base::Vector3d startPt(geomArc->startPnt.x, geomArc->startPnt.y,0.0); + Base::Vector3d endPt(geomArc->endPnt.x, geomArc->endPnt.y,0.0); if (outerPlacement && !geomArc->intersectsArc(curveCenter,kinkPoint) ) { pointOnCurve = midPt; @@ -979,19 +979,19 @@ void QGIViewDimension::draw() TechDrawGeometry::Generic *gen1 = static_cast(geom1); // Get Points for line - Base::Vector2D pnt1, pnt2; + Base::Vector2d pnt1, pnt2; Base::Vector3d p1S, p1E, p2S, p2E; pnt1 = gen0->points.at(0); pnt2 = gen0->points.at(1); - p1S = Base::Vector3d(pnt1.fX, pnt1.fY, 0); - p1E = Base::Vector3d(pnt2.fX, pnt2.fY, 0); + p1S = Base::Vector3d(pnt1.x, pnt1.y, 0); + p1E = Base::Vector3d(pnt2.x, pnt2.y, 0); pnt1 = gen1->points.at(0); pnt2 = gen1->points.at(1); - p2S = Base::Vector3d(pnt1.fX, pnt1.fY, 0); - p2E = Base::Vector3d(pnt2.fX, pnt2.fY, 0); + p2S = Base::Vector3d(pnt1.x, pnt1.y, 0); + p2E = Base::Vector3d(pnt2.x, pnt2.y, 0); Base::Vector3d dir1 = p1E - p1S; Base::Vector3d dir2 = p2E - p2S; diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index b2439243b5b0..1f9a390aecff 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -138,8 +138,8 @@ QPainterPath QGIViewPart::drawPainterPath(TechDrawGeometry::BaseGeom *baseGeom) case TechDrawGeometry::CIRCLE: { TechDrawGeometry::Circle *geom = static_cast(baseGeom); - double x = geom->center.fX - geom->radius; - double y = geom->center.fY - geom->radius; + double x = geom->center.x - geom->radius; + double y = geom->center.y - geom->radius; path.addEllipse(x, y, geom->radius * 2, geom->radius * 2); //topleft@(x,y) radx,rady //Base::Console().Message("TRACE -drawPainterPath - making an CIRCLE @(%.3f,%.3f) R:%.3f\n",x, y, geom->radius); @@ -148,20 +148,20 @@ QPainterPath QGIViewPart::drawPainterPath(TechDrawGeometry::BaseGeom *baseGeom) TechDrawGeometry::AOC *geom = static_cast(baseGeom); pathArc(path, geom->radius, geom->radius, 0., geom->largeArc, geom->cw, - geom->endPnt.fX, geom->endPnt.fY, - geom->startPnt.fX, geom->startPnt.fY); -// double x = geom->center.fX - geom->radius; -// double y = geom->center.fY - geom->radius; + geom->endPnt.x, geom->endPnt.y, + geom->startPnt.x, geom->startPnt.y); +// double x = geom->center.x - geom->radius; +// double y = geom->center.y - geom->radius; //Base::Console().Message("TRACE -drawPainterPath - making an ARCOFCIRCLE @(%.3f,%.3f) R:%.3f\n",x, y, geom->radius); } break; case TechDrawGeometry::ELLIPSE: { TechDrawGeometry::Ellipse *geom = static_cast(baseGeom); // Calculate start and end points as ellipse with theta = 0 and pi - double startX = geom->center.fX + geom->major * cos(geom->angle), - startY = geom->center.fY + geom->major * sin(geom->angle), - endX = geom->center.fX - geom->major * cos(geom->angle), - endY = geom->center.fY - geom->major * sin(geom->angle); + double startX = geom->center.x + geom->major * cos(geom->angle), + startY = geom->center.y + geom->major * sin(geom->angle), + endX = geom->center.x - geom->major * cos(geom->angle), + endY = geom->center.y - geom->major * sin(geom->angle); pathArc(path, geom->major, geom->minor, geom->angle, false, false, endX, endY, startX, startY); @@ -169,41 +169,41 @@ QPainterPath QGIViewPart::drawPainterPath(TechDrawGeometry::BaseGeom *baseGeom) pathArc(path, geom->major, geom->minor, geom->angle, false, false, startX, startY, endX, endY); - //Base::Console().Message("TRACE -drawPainterPath - making an ELLIPSE @(%.3f,%.3f) R1:%.3f R2:%.3f\n",geom->center.fX,geom->center.fY, geom->major, geom->minor); + //Base::Console().Message("TRACE -drawPainterPath - making an ELLIPSE @(%.3f,%.3f) R1:%.3f R2:%.3f\n",geom->center.x,geom->center.y, geom->major, geom->minor); } break; case TechDrawGeometry::ARCOFELLIPSE: { TechDrawGeometry::AOE *geom = static_cast(baseGeom); pathArc(path, geom->major, geom->minor, geom->angle, geom->largeArc, geom->cw, - geom->endPnt.fX, geom->endPnt.fY, - geom->startPnt.fX, geom->startPnt.fY); - //Base::Console().Message("TRACE -drawPainterPath - making an ARCOFELLIPSE R1:%.3f R2:%.3f From: (%.3f,%.3f) To: (%.3f,%.3f)\n",geom->major, geom->minor,geom->startPnt.fX, geom->startPnt.fY,geom->endPnt.fX, geom->endPnt.fY); + geom->endPnt.x, geom->endPnt.y, + geom->startPnt.x, geom->startPnt.y); + //Base::Console().Message("TRACE -drawPainterPath - making an ARCOFELLIPSE R1:%.3f R2:%.3f From: (%.3f,%.3f) To: (%.3f,%.3f)\n",geom->major, geom->minor,geom->startPnt.x, geom->startPnt.y,geom->endPnt.x, geom->endPnt.y); } break; case TechDrawGeometry::BEZIER: { TechDrawGeometry::BezierSegment *geom = static_cast(baseGeom); // Move painter to the beginning - path.moveTo(geom->pnts[0].fX, geom->pnts[0].fY); - //Base::Console().Message("TRACE -drawPainterPath - making an BEZIER From: (%.3f,%.3f)\n",geom->pnts[0].fX,geom->pnts[0].fY); + path.moveTo(geom->pnts[0].x, geom->pnts[0].y); + //Base::Console().Message("TRACE -drawPainterPath - making an BEZIER From: (%.3f,%.3f)\n",geom->pnts[0].x,geom->pnts[0].y); if ( geom->poles == 2 ) { // Degree 1 bezier = straight line... - path.lineTo(geom->pnts[1].fX, geom->pnts[1].fY); + path.lineTo(geom->pnts[1].x, geom->pnts[1].y); } else if ( geom->poles == 3 ) { - path.quadTo(geom->pnts[1].fX, geom->pnts[1].fY, - geom->pnts[2].fX, geom->pnts[2].fY); + path.quadTo(geom->pnts[1].x, geom->pnts[1].y, + geom->pnts[2].x, geom->pnts[2].y); } else if ( geom->poles == 4 ) { - path.cubicTo(geom->pnts[1].fX, geom->pnts[1].fY, - geom->pnts[2].fX, geom->pnts[2].fY, - geom->pnts[3].fX, geom->pnts[3].fY); + path.cubicTo(geom->pnts[1].x, geom->pnts[1].y, + geom->pnts[2].x, geom->pnts[2].y, + geom->pnts[3].x, geom->pnts[3].y); } else { //can only handle lines,quads,cubes Base::Console().Error("Bad pole count (%d) for BezierSegment\n",geom->poles); auto itBez = geom->pnts.begin() + 1; for (; itBez != geom->pnts.end();itBez++) { - path.lineTo((*itBez).fX, (*itBez).fY); //show something for debugging + path.lineTo((*itBez).x, (*itBez).y); //show something for debugging } } } break; @@ -213,39 +213,39 @@ QPainterPath QGIViewPart::drawPainterPath(TechDrawGeometry::BaseGeom *baseGeom) std::vector::const_iterator it = geom->segments.begin(); // Move painter to the beginning of our first segment - path.moveTo(it->pnts[0].fX, it->pnts[0].fY); - //Base::Console().Message("TRACE -drawPainterPath - making an BSPLINE From: (%.3f,%.3f)\n",it->pnts[0].fX,it->pnts[0].fY); + path.moveTo(it->pnts[0].x, it->pnts[0].y); + //Base::Console().Message("TRACE -drawPainterPath - making an BSPLINE From: (%.3f,%.3f)\n",it->pnts[0].x,it->pnts[0].y); for ( ; it != geom->segments.end(); ++it) { // At this point, the painter is either at the beginning // of the first segment, or end of the last if ( it->poles == 2 ) { // Degree 1 bezier = straight line... - path.lineTo(it->pnts[1].fX, it->pnts[1].fY); + path.lineTo(it->pnts[1].x, it->pnts[1].y); } else if ( it->poles == 3 ) { - path.quadTo(it->pnts[1].fX, it->pnts[1].fY, - it->pnts[2].fX, it->pnts[2].fY); + path.quadTo(it->pnts[1].x, it->pnts[1].y, + it->pnts[2].x, it->pnts[2].y); } else if ( it->poles == 4 ) { - path.cubicTo(it->pnts[1].fX, it->pnts[1].fY, - it->pnts[2].fX, it->pnts[2].fY, - it->pnts[3].fX, it->pnts[3].fY); + path.cubicTo(it->pnts[1].x, it->pnts[1].y, + it->pnts[2].x, it->pnts[2].y, + it->pnts[3].x, it->pnts[3].y); } else { //can only handle lines,quads,cubes Base::Console().Error("Bad pole count (%d) for BezierSegment of BSpline geometry\n",it->poles); - path.lineTo(it->pnts[1].fX, it->pnts[1].fY); //show something for debugging + path.lineTo(it->pnts[1].x, it->pnts[1].y); //show something for debugging } } } break; case TechDrawGeometry::GENERIC: { TechDrawGeometry::Generic *geom = static_cast(baseGeom); - path.moveTo(geom->points[0].fX, geom->points[0].fY); - std::vector::const_iterator it = geom->points.begin(); - //Base::Console().Message("TRACE -drawPainterPath - making an GENERIC From: (%.3f,%.3f)\n",geom->points[0].fX, geom->points[0].fY); + path.moveTo(geom->points[0].x, geom->points[0].y); + std::vector::const_iterator it = geom->points.begin(); + //Base::Console().Message("TRACE -drawPainterPath - making an GENERIC From: (%.3f,%.3f)\n",geom->points[0].x, geom->points[0].y); for(++it; it != geom->points.end(); ++it) { - path.lineTo((*it).fX, (*it).fY); - //Base::Console().Message(">>>> To: (%.3f,%.3f)\n",(*it).fX, (*it).fY); + path.lineTo((*it).x, (*it).y); + //Base::Console().Message(">>>> To: (%.3f,%.3f)\n",(*it).x, (*it).y); } } break; default: @@ -408,7 +408,7 @@ void QGIViewPart::drawViewPart() if (showCenters) { QGICMark* cmItem = new QGICMark(i); addToGroup(cmItem); - cmItem->setPos((*vert)->pnt.fX, (*vert)->pnt.fY); //this is in ViewPart coords + cmItem->setPos((*vert)->pnt.x, (*vert)->pnt.y); //this is in ViewPart coords cmItem->setThick(0.5 * lineWidth * lineScaleFactor); //need minimum? cmItem->setSize( cAdjust * lineWidth * vertexScaleFactor); cmItem->setZValue(ZVALUE::VERTEX); @@ -416,7 +416,7 @@ void QGIViewPart::drawViewPart() } else { QGIVertex *item = new QGIVertex(i); addToGroup(item); - item->setPos((*vert)->pnt.fX, (*vert)->pnt.fY); //this is in ViewPart coords + item->setPos((*vert)->pnt.x, (*vert)->pnt.y); //this is in ViewPart coords item->setRadius(lineWidth * vertexScaleFactor); item->setZValue(ZVALUE::VERTEX); } @@ -603,8 +603,8 @@ void QGIViewPart::drawCenterLines(bool b) // As called by arc of ellipse case: // pathArc(path, geom->major, geom->minor, geom->angle, geom->largeArc, geom->cw, -// geom->endPnt.fX, geom->endPnt.fY, -// geom->startPnt.fX, geom->startPnt.fY); +// geom->endPnt.x, geom->endPnt.y, +// geom->startPnt.x, geom->startPnt.y); void QGIViewPart::pathArc(QPainterPath &path, double rx, double ry, double x_axis_rotation, bool large_arc_flag, bool sweep_flag, double x, double y,