summaryrefslogtreecommitdiff
path: root/basegfx/source/polygon/b2dpolygontools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basegfx/source/polygon/b2dpolygontools.cxx')
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx302
1 files changed, 0 insertions, 302 deletions
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 2104a53c5ef6..73f920fea85c 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -979,67 +979,6 @@ namespace basegfx
}
CutFlagValue findCut(
- const B2DPolygon& rCandidate,
- sal_uInt32 nIndex1, sal_uInt32 nIndex2,
- CutFlagValue aCutFlags,
- double* pCut1, double* pCut2)
- {
- CutFlagValue aRetval(CUTFLAG_NONE);
- const sal_uInt32 nPointCount(rCandidate.count());
-
- if(nIndex1 < nPointCount && nIndex2 < nPointCount && nIndex1 != nIndex2)
- {
- sal_uInt32 nEnd1(getIndexOfSuccessor(nIndex1, rCandidate));
- sal_uInt32 nEnd2(getIndexOfSuccessor(nIndex2, rCandidate));
-
- const B2DPoint aStart1(rCandidate.getB2DPoint(nIndex1));
- const B2DPoint aEnd1(rCandidate.getB2DPoint(nEnd1));
- const B2DVector aVector1(aEnd1 - aStart1);
-
- const B2DPoint aStart2(rCandidate.getB2DPoint(nIndex2));
- const B2DPoint aEnd2(rCandidate.getB2DPoint(nEnd2));
- const B2DVector aVector2(aEnd2 - aStart2);
-
- aRetval = findCut(
- aStart1, aVector1, aStart2, aVector2,
- aCutFlags, pCut1, pCut2);
- }
-
- return aRetval;
- }
-
- CutFlagValue findCut(
- const B2DPolygon& rCandidate1, sal_uInt32 nIndex1,
- const B2DPolygon& rCandidate2, sal_uInt32 nIndex2,
- CutFlagValue aCutFlags,
- double* pCut1, double* pCut2)
- {
- CutFlagValue aRetval(CUTFLAG_NONE);
- const sal_uInt32 nPointCount1(rCandidate1.count());
- const sal_uInt32 nPointCount2(rCandidate2.count());
-
- if(nIndex1 < nPointCount1 && nIndex2 < nPointCount2)
- {
- sal_uInt32 nEnd1(getIndexOfSuccessor(nIndex1, rCandidate1));
- sal_uInt32 nEnd2(getIndexOfSuccessor(nIndex2, rCandidate2));
-
- const B2DPoint aStart1(rCandidate1.getB2DPoint(nIndex1));
- const B2DPoint aEnd1(rCandidate1.getB2DPoint(nEnd1));
- const B2DVector aVector1(aEnd1 - aStart1);
-
- const B2DPoint aStart2(rCandidate2.getB2DPoint(nIndex2));
- const B2DPoint aEnd2(rCandidate2.getB2DPoint(nEnd2));
- const B2DVector aVector2(aEnd2 - aStart2);
-
- aRetval = findCut(
- aStart1, aVector1, aStart2, aVector2,
- aCutFlags, pCut1, pCut2);
- }
-
- return aRetval;
- }
-
- CutFlagValue findCut(
const B2DPoint& rEdge1Start, const B2DVector& rEdge1Delta,
const B2DPoint& rEdge2Start, const B2DVector& rEdge2Delta,
CutFlagValue aCutFlags,
@@ -1663,32 +1602,6 @@ namespace basegfx
return false;
}
- B2DPolygon createPolygonFromRect( const B2DRectangle& rRect, double fRadius )
- {
- const double fZero(0.0);
- const double fOne(1.0);
-
- if(fTools::lessOrEqual(fRadius, fZero))
- {
- // no radius, use rectangle
- return createPolygonFromRect( rRect );
- }
- else if(fTools::moreOrEqual(fRadius, fOne))
- {
- // full radius, use ellipse
- const B2DPoint aCenter(rRect.getCenter());
- const double fRadiusX(rRect.getWidth() / 2.0);
- const double fRadiusY(rRect.getHeight() / 2.0);
-
- return createPolygonFromEllipse( aCenter, fRadiusX, fRadiusY );
- }
- else
- {
- // create rectangle with two radii between ]0.0 .. 1.0[
- return createPolygonFromRect( rRect, fRadius, fRadius );
- }
- }
-
B2DPolygon createPolygonFromRect( const B2DRectangle& rRect, double fRadiusX, double fRadiusY )
{
const double fZero(0.0);
@@ -2977,81 +2890,6 @@ namespace basegfx
return aRetval;
}
- B2DPolygon reSegmentPolygonEdges(const B2DPolygon& rCandidate, sal_uInt32 nSubEdges, bool bHandleCurvedEdges, bool bHandleStraightEdges)
- {
- const sal_uInt32 nPointCount(rCandidate.count());
-
- if(nPointCount < 2 || nSubEdges < 2 || (!bHandleCurvedEdges && !bHandleStraightEdges))
- {
- // nothing to do:
- // - less than two points -> no edge at all
- // - less than two nSubEdges -> no resegment necessary
- // - neither bHandleCurvedEdges nor bHandleStraightEdges -> nothing to do
- return rCandidate;
- }
- else
- {
- B2DPolygon aRetval;
- const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1);
- B2DCubicBezier aCurrentEdge;
-
- // prepare first edge and add start point to target
- aCurrentEdge.setStartPoint(rCandidate.getB2DPoint(0));
- aRetval.append(aCurrentEdge.getStartPoint());
-
- for(sal_uInt32 a(0); a < nEdgeCount; a++)
- {
- // fill edge
- const sal_uInt32 nNextIndex((a + 1) % nPointCount);
- aCurrentEdge.setControlPointA(rCandidate.getNextControlPoint(a));
- aCurrentEdge.setControlPointB(rCandidate.getPrevControlPoint(nNextIndex));
- aCurrentEdge.setEndPoint(rCandidate.getB2DPoint(nNextIndex));
-
- if(aCurrentEdge.isBezier())
- {
- if(bHandleCurvedEdges)
- {
- for(sal_uInt32 b(nSubEdges); b > 1; b--)
- {
- const double fSplitPoint(1.0 / b);
- B2DCubicBezier aLeftPart;
-
- aCurrentEdge.split(fSplitPoint, &aLeftPart, &aCurrentEdge);
- aRetval.appendBezierSegment(aLeftPart.getControlPointA(), aLeftPart.getControlPointB(), aLeftPart.getEndPoint());
- }
- }
-
- // copy remaining segment to target
- aRetval.appendBezierSegment(aCurrentEdge.getControlPointA(), aCurrentEdge.getControlPointB(), aCurrentEdge.getEndPoint());
- }
- else
- {
- if(bHandleStraightEdges)
- {
- for(sal_uInt32 b(nSubEdges); b > 1; b--)
- {
- const double fSplitPoint(1.0 / b);
- const B2DPoint aSplitPoint(interpolate(aCurrentEdge.getStartPoint(), aCurrentEdge.getEndPoint(), fSplitPoint));
-
- aRetval.append(aSplitPoint);
- aCurrentEdge.setStartPoint(aSplitPoint);
- }
- }
-
- // copy remaining segment to target
- aRetval.append(aCurrentEdge.getEndPoint());
- }
-
- // prepare next step
- aCurrentEdge.setStartPoint(aCurrentEdge.getEndPoint());
- }
-
- // copy closed flag and return
- aRetval.setClosed(rCandidate.isClosed());
- return aRetval;
- }
- }
-
B2DPolygon interpolate(const B2DPolygon& rOld1, const B2DPolygon& rOld2, double t)
{
OSL_ENSURE(rOld1.count() == rOld2.count(), "B2DPolygon interpolate: Different geometry (!)");
@@ -3085,139 +2923,6 @@ namespace basegfx
}
}
- bool isPolyPolygonEqualRectangle( const B2DPolyPolygon& rPolyPoly,
- const B2DRange& rRect )
- {
- // exclude some cheap cases first
- if( rPolyPoly.count() != 1 )
- return false;
-
- // fill array with rectangle vertices
- const B2DPoint aPoints[] =
- {
- B2DPoint(rRect.getMinX(),rRect.getMinY()),
- B2DPoint(rRect.getMaxX(),rRect.getMinY()),
- B2DPoint(rRect.getMaxX(),rRect.getMaxY()),
- B2DPoint(rRect.getMinX(),rRect.getMaxY())
- };
-
- const B2DPolygon& rPoly( rPolyPoly.getB2DPolygon(0) );
- const sal_uInt32 nCount( rPoly.count() );
- const double epsilon = ::std::numeric_limits<double>::epsilon();
-
- for(unsigned int j=0; j<4; ++j)
- {
- const B2DPoint &p1 = aPoints[j];
- const B2DPoint &p2 = aPoints[(j+1)%4];
- bool bPointOnBoundary = false;
- for( sal_uInt32 i=0; i<nCount; ++i )
- {
- const B2DPoint p(rPoly.getB2DPoint(i));
-
- // 1 | x0 y0 1 |
- // A = - | x1 y1 1 |
- // 2 | x2 y2 1 |
- double fDoubleArea = p2.getX()*p.getY() -
- p2.getY()*p.getX() -
- p1.getX()*p.getY() +
- p1.getY()*p.getX() +
- p1.getX()*p2.getY() -
- p1.getY()*p2.getX();
-
- if(fDoubleArea < epsilon)
- {
- bPointOnBoundary=true;
- break;
- }
- }
- if(!(bPointOnBoundary))
- return false;
- }
-
- return true;
- }
-
-
- // create simplified version of the original polygon by
- // replacing segments with spikes/loops and self intersections
- // by several trivial sub-segments
- B2DPolygon createSimplifiedPolygon( const B2DPolygon& rCandidate )
- {
- const sal_uInt32 nCount(rCandidate.count());
-
- if(nCount && rCandidate.areControlPointsUsed())
- {
- const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nCount : nCount - 1);
- B2DPolygon aRetval;
- B2DCubicBezier aSegment;
-
- aSegment.setStartPoint(rCandidate.getB2DPoint(0));
- aRetval.append(aSegment.getStartPoint());
-
- for(sal_uInt32 a(0); a < nEdgeCount; a++)
- {
- // fill edge
- const sal_uInt32 nNextIndex((a + 1) % nCount);
- aSegment.setControlPointA(rCandidate.getNextControlPoint(a));
- aSegment.setControlPointB(rCandidate.getPrevControlPoint(nNextIndex));
- aSegment.setEndPoint(rCandidate.getB2DPoint(nNextIndex));
-
- if(aSegment.isBezier())
- {
- double fExtremumPos(0.0);
- sal_uInt32 nExtremumCounter(4);
-
- while(nExtremumCounter-- && aSegment.isBezier() && aSegment.getMinimumExtremumPosition(fExtremumPos))
- {
- // split off left, now extremum-free part and append
- B2DCubicBezier aLeft;
-
- aSegment.split(fExtremumPos, &aLeft, &aSegment);
- aLeft.testAndSolveTrivialBezier();
- aSegment.testAndSolveTrivialBezier();
-
- if(aLeft.isBezier())
- {
- aRetval.appendBezierSegment(aLeft.getControlPointA(), aLeft.getControlPointB(), aLeft.getEndPoint());
- }
- else
- {
- aRetval.append(aLeft.getEndPoint());
- }
- }
-
- // append (evtl. reduced) rest of Segment
- if(aSegment.isBezier())
- {
- aRetval.appendBezierSegment(aSegment.getControlPointA(), aSegment.getControlPointB(), aSegment.getEndPoint());
- }
- else
- {
- aRetval.append(aSegment.getEndPoint());
- }
- }
- else
- {
- // simple edge, append end point
- aRetval.append(aSegment.getEndPoint());
- }
-
- // prepare next edge
- aSegment.setStartPoint(aSegment.getEndPoint());
- }
-
- // copy closed flag and check for double points
- aRetval.setClosed(rCandidate.isClosed());
- aRetval.removeDoublePoints();
-
- return aRetval;
- }
- else
- {
- return rCandidate;
- }
- }
-
// #i76891#
B2DPolygon simplifyCurveSegments(const B2DPolygon& rCandidate)
{
@@ -3511,13 +3216,6 @@ namespace basegfx
return true;
}
- bool equal(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB)
- {
- const double fSmallValue(fTools::getSmallValue());
-
- return equal(rCandidateA, rCandidateB, fSmallValue);
- }
-
// snap points of horizontal or vertical edges to discrete values
B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate)
{