summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-10-31 12:40:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-10-31 15:56:13 +0000
commit9069e26d1fe1fbbe7bceab0bae8a186d8cdb47cc (patch)
tree56cf998775179e658daa71eb9112542992dd4921
parent5d8f48c81eac8650315b936d0e89ad1d54b566fc (diff)
we need these old equal methods again
i.e. revert 5c3615c1152eabfda508504c8a4c5727868acbc8 Change-Id: I7bafaabaf5b8337c3ef4fe0d9ea687924045114e
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx44
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx26
-rw-r--r--include/basegfx/polygon/b2dpolygontools.hxx4
-rw-r--r--include/basegfx/polygon/b3dpolygontools.hxx4
4 files changed, 78 insertions, 0 deletions
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 583fa3e778ee..f9fec004e15c 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -3133,6 +3133,50 @@ namespace basegfx
return aRetval;
}
+ //////////////////////////////////////////////////////////////////////
+ // comparators with tolerance for 2D Polygons
+
+ bool equal(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, const double& rfSmallValue)
+ {
+ const sal_uInt32 nPointCount(rCandidateA.count());
+
+ if(nPointCount != rCandidateB.count())
+ return false;
+
+ const bool bClosed(rCandidateA.isClosed());
+
+ if(bClosed != rCandidateB.isClosed())
+ return false;
+
+ const bool bAreControlPointsUsed(rCandidateA.areControlPointsUsed());
+
+ if(bAreControlPointsUsed != rCandidateB.areControlPointsUsed())
+ return false;
+
+ for(sal_uInt32 a(0); a < nPointCount; a++)
+ {
+ const B2DPoint aPoint(rCandidateA.getB2DPoint(a));
+
+ if(!aPoint.equal(rCandidateB.getB2DPoint(a), rfSmallValue))
+ return false;
+
+ if(bAreControlPointsUsed)
+ {
+ const basegfx::B2DPoint aPrev(rCandidateA.getPrevControlPoint(a));
+
+ if(!aPrev.equal(rCandidateB.getPrevControlPoint(a), rfSmallValue))
+ return false;
+
+ const basegfx::B2DPoint aNext(rCandidateA.getNextControlPoint(a));
+
+ if(!aNext.equal(rCandidateB.getNextControlPoint(a), rfSmallValue))
+ return false;
+ }
+ }
+
+ return true;
+ }
+
// snap points of horizontal or vertical edges to discrete values
B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate)
{
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index fb2def2dc376..56268d254820 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -734,6 +734,32 @@ namespace basegfx
return false;
}
+ //////////////////////////////////////////////////////////////////////
+ // comparators with tolerance for 3D Polygons
+
+ bool equal(const B3DPolygon& rCandidateA, const B3DPolygon& rCandidateB, const double& rfSmallValue)
+ {
+ const sal_uInt32 nPointCount(rCandidateA.count());
+
+ if(nPointCount != rCandidateB.count())
+ return false;
+
+ const bool bClosed(rCandidateA.isClosed());
+
+ if(bClosed != rCandidateB.isClosed())
+ return false;
+
+ for(sal_uInt32 a(0); a < nPointCount; a++)
+ {
+ const B3DPoint aPoint(rCandidateA.getB3DPoint(a));
+
+ if(!aPoint.equal(rCandidateB.getB3DPoint(a), rfSmallValue))
+ return false;
+ }
+
+ return true;
+ }
+
// snap points of horizontal or vertical edges to discrete values
B3DPolygon snapPointsOfHorizontalOrVerticalEdges(const B3DPolygon& rCandidate)
{
diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx
index d00ed1ea8460..6aa96927edd7 100644
--- a/include/basegfx/polygon/b2dpolygontools.hxx
+++ b/include/basegfx/polygon/b2dpolygontools.hxx
@@ -420,6 +420,10 @@ namespace basegfx
*/
BASEGFX_DLLPUBLIC B2DPolygon createWaveline(const B2DPolygon& rCandidate, double fWaveWidth, double fWaveHeight);
+ //////////////////////////////////////////////////////////////////////
+ // comparators with tolerance for 2D Polygons
+ BASEGFX_DLLPUBLIC bool equal(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, const double& rfSmallValue);
+
/** snap some polygon coordinates to discrete coordinates
This method allows to snap some polygon points to discrete (integer) values
diff --git a/include/basegfx/polygon/b3dpolygontools.hxx b/include/basegfx/polygon/b3dpolygontools.hxx
index 45695d4fded7..8bd610394b2f 100644
--- a/include/basegfx/polygon/b3dpolygontools.hxx
+++ b/include/basegfx/polygon/b3dpolygontools.hxx
@@ -113,6 +113,10 @@ namespace basegfx
// and a line given by start and end point
BASEGFX_DLLPUBLIC bool getCutBetweenLineAndPlane(const B3DVector& rPlaneNormal, const B3DPoint& rPlanePoint, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut);
+ //////////////////////////////////////////////////////////////////////
+ // comparators with tolerance for 3D Polygons
+ BASEGFX_DLLPUBLIC bool equal(const B3DPolygon& rCandidateA, const B3DPolygon& rCandidateB, const double& rfSmallValue);
+
/** snap some polygon coordinates to discrete coordinates
This method allows to snap some polygon points to discrete (integer) values