Base: misc patches

Convenience macros/function (in Interpreter.h)

* FC_PY_GetObject/Callable(), look for callables in a python object,
  which will be used in future patch to improve performance in various
  python observer/features.

* pyCall(WithKeywords)(), helper function to invoke the callable

Matrix4D:

* hasScale(), check if there is any scale in the transformation. If so,
  further check if the scale is uniform or not. This will be used in
  future patch for Part::TopoShape to decide which type of transform to
  apply.

Placement:

* translate/rotate(), new convenience API

Rotation:

* isSame/multiVec(), new convenience API

Polygon2d:

* Intersect(), GetCenter(), new convenience API.

FlagToggler:

* New class for exception safe flag toggling, similar to StateLocker
  but with template (actually, FlagToggler is added earlier by me).

BitsetLocker:

* New class for exception manipulation of a std::bitset variable.
This commit is contained in:
Zheng, Lei
2019-07-06 17:10:17 +08:00
committed by wmayer
parent 59417068f5
commit 3fcbf71fb5
12 changed files with 230 additions and 2 deletions

View File

@@ -89,7 +89,7 @@ public:
inline BoundBox2d (double fX1, double fY1, double fX2, double fY2);
inline bool IsValid (void);
inline bool IsEqual(const BoundBox2d&, double tolerance) const;
// operators
inline BoundBox2d& operator= (const BoundBox2d& rclBB);
inline bool operator== (const BoundBox2d& rclBB) const;
@@ -102,6 +102,11 @@ public:
// misc
bool Contains (const Vector2d &rclV) const;
inline Vector2d GetCenter() const {
return Vector2d((MinX+MaxX)/2,(MinY+MaxY)/2);
}
};
/** Line2d ********************************************/
@@ -160,6 +165,7 @@ public:
BoundBox2d CalcBoundBox (void) const;
bool Contains (const Vector2d &rclV) const;
void Intersect (const Polygon2d &rclPolygon, std::list<Polygon2d> &rclResultPolygonList) const;
bool Intersect (const Polygon2d &rclPolygon) const;
bool Intersect (const Vector2d &rclV, double eps) const;
private:
@@ -308,7 +314,6 @@ inline Vector2d& Polygon2d::At (size_t ulNdx) const
return (Vector2d&) _aclVct[ulNdx];
}
inline Line2d::Line2d (const Line2d &rclLine)
: clV1 (rclLine.clV1),
clV2 (rclLine.clV2)