summaryrefslogtreecommitdiff
path: root/basegfx/source/polygon
diff options
context:
space:
mode:
authorElton Chung <elton@layerjet.com>2012-02-20 00:30:16 +0800
committerMichael Meeks <michael.meeks@suse.com>2012-02-20 12:08:10 +0000
commitdbff99a60ec5268c92f1404cb01754de9186c2e8 (patch)
tree20236b586ab80745426b4e51f0b8df56bdfcb0d0 /basegfx/source/polygon
parent9846e25d94d6029f3a0726ae35e96db342506c80 (diff)
Remove unused code
Diffstat (limited to 'basegfx/source/polygon')
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx302
-rw-r--r--basegfx/source/polygon/b2dpolypolygontools.cxx22
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx99
-rw-r--r--basegfx/source/polygon/b3dpolypolygontools.cxx7
4 files changed, 0 insertions, 430 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)
{
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index c49f6a8ab3c9..34721d20207d 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -382,21 +382,6 @@ namespace basegfx
return aRetval;
}
- B2DPolyPolygon rotateAroundPoint(const B2DPolyPolygon& rCandidate, const B2DPoint& rCenter, double fAngle)
- {
- const sal_uInt32 nPolygonCount(rCandidate.count());
- B2DPolyPolygon aRetval;
-
- for(sal_uInt32 a(0L); a < nPolygonCount; a++)
- {
- const B2DPolygon aCandidate(rCandidate.getB2DPolygon(a));
-
- aRetval.append(rotateAroundPoint(aCandidate, rCenter, fAngle));
- }
-
- return aRetval;
- }
-
B2DPolyPolygon expandToCurve(const B2DPolyPolygon& rCandidate)
{
const sal_uInt32 nPolygonCount(rCandidate.count());
@@ -533,13 +518,6 @@ namespace basegfx
return true;
}
- bool equal(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB)
- {
- const double fSmallValue(fTools::getSmallValue());
-
- return equal(rCandidateA, rCandidateB, fSmallValue);
- }
-
B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate)
{
B2DPolyPolygon aRetval;
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index b31712a04780..65a7f6b800db 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -217,105 +217,6 @@ namespace basegfx
return fRetval;
}
- B3DPoint getPositionAbsolute(const B3DPolygon& rCandidate, double fDistance, double fLength)
- {
- B3DPoint aRetval;
- const sal_uInt32 nPointCount(rCandidate.count());
-
- if(nPointCount > 1L)
- {
- sal_uInt32 nIndex(0L);
- bool bIndexDone(false);
- const double fZero(0.0);
- double fEdgeLength(fZero);
-
- // get length if not given
- if(fTools::equalZero(fLength))
- {
- fLength = getLength(rCandidate);
- }
-
- // handle fDistance < 0.0
- if(fTools::less(fDistance, fZero))
- {
- if(rCandidate.isClosed())
- {
- // if fDistance < 0.0 increment with multiple of fLength
- sal_uInt32 nCount(sal_uInt32(-fDistance / fLength));
- fDistance += double(nCount + 1L) * fLength;
- }
- else
- {
- // crop to polygon start
- fDistance = fZero;
- bIndexDone = true;
- }
- }
-
- // handle fDistance >= fLength
- if(fTools::moreOrEqual(fDistance, fLength))
- {
- if(rCandidate.isClosed())
- {
- // if fDistance >= fLength decrement with multiple of fLength
- sal_uInt32 nCount(sal_uInt32(fDistance / fLength));
- fDistance -= (double)(nCount) * fLength;
- }
- else
- {
- // crop to polygon end
- fDistance = fZero;
- nIndex = nPointCount - 1L;
- bIndexDone = true;
- }
- }
-
- // look for correct index. fDistance is now [0.0 .. fLength[
- if(!bIndexDone)
- {
- do
- {
- // get length of next edge
- fEdgeLength = getEdgeLength(rCandidate, nIndex);
-
- if(fTools::moreOrEqual(fDistance, fEdgeLength))
- {
- // go to next edge
- fDistance -= fEdgeLength;
- nIndex++;
- }
- else
- {
- // it's on this edge, stop
- bIndexDone = true;
- }
- } while (!bIndexDone);
- }
-
- // get the point using nIndex
- aRetval = rCandidate.getB3DPoint(nIndex);
-
- // if fDistance != 0.0, move that length on the edge. The edge
- // length is in fEdgeLength.
- if(!fTools::equalZero(fDistance))
- {
- sal_uInt32 nNextIndex(getIndexOfSuccessor(nIndex, rCandidate));
- const B3DPoint aNextPoint(rCandidate.getB3DPoint(nNextIndex));
- double fRelative(fZero);
-
- if(!fTools::equalZero(fEdgeLength))
- {
- fRelative = fDistance / fEdgeLength;
- }
-
- // add calculated average value to the return value
- aRetval += interpolate(aRetval, aNextPoint, fRelative);
- }
- }
-
- return aRetval;
- }
-
void applyLineDashing(const B3DPolygon& rCandidate, const ::std::vector<double>& rDotDashArray, B3DPolyPolygon* pLineTarget, B3DPolyPolygon* pGapTarget, double fDotDashLength)
{
const sal_uInt32 nPointCount(rCandidate.count());
diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx
index 62fd440ec0ee..928fb3132921 100644
--- a/basegfx/source/polygon/b3dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolypolygontools.cxx
@@ -540,13 +540,6 @@ namespace basegfx
return true;
}
- bool equal(const B3DPolyPolygon& rCandidateA, const B3DPolyPolygon& rCandidateB)
- {
- const double fSmallValue(fTools::getSmallValue());
-
- return equal(rCandidateA, rCandidateB, fSmallValue);
- }
-
} // end of namespace tools
} // end of namespace basegfx