#i106127# perf: consecutive polygon segments always touch so costly decisions based only on the touch-criterion should be avoided for this case

This commit is contained in:
hdu
2009-10-22 11:39:42 +02:00
parent 350ea03970
commit ab818b36b5
4 changed files with 50 additions and 7 deletions

View File

@@ -7,7 +7,6 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b1drange.hxx,v $
* $Revision: 1.15 $
*
* This file is part of OpenOffice.org.
*
@@ -131,6 +130,11 @@ namespace basegfx
return maRange.overlaps(rRange.maRange);
}
bool overlapsMore(const B1DRange& rRange) const
{
return maRange.overlapsMore(rRange.maRange);
}
void expand(double fValue)
{
maRange.expand(fValue);

View File

@@ -7,7 +7,6 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b2drange.hxx,v $
* $Revision: 1.19 $
*
* This file is part of OpenOffice.org.
*
@@ -222,6 +221,14 @@ namespace basegfx
);
}
bool overlapsMore(const B2DRange& rRange) const
{
return (
maRangeX.overlapsMore(rRange.maRangeX)
&& maRangeY.overlapsMore(rRange.maRangeY)
);
}
void expand(const B2DTuple& rTuple)
{
maRangeX.expand(rTuple.getX());

View File

@@ -7,7 +7,6 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: basicrange.hxx,v $
* $Revision: 1.15 $
*
* This file is part of OpenOffice.org.
*
@@ -142,6 +141,14 @@ namespace basegfx
}
}
bool overlapsMore(const BasicRange& rRange) const
{
if(isEmpty() || rRange.isEmpty())
return false;
// returns true if the overlap is more than just a touching at the limits
return ((rRange.mnMaximum > mnMinimum) && (rRange.mnMinimum < mnMaximum));
}
bool operator==( const BasicRange& rRange ) const
{
return (mnMinimum == rRange.mnMinimum && mnMaximum == rRange.mnMaximum);

View File

@@ -567,7 +567,14 @@ namespace basegfx
const bool bEdgeBIsCurve(aCubicB.isBezier());
const B2DRange aRangeB(aCubicB.getRange());
if(aRangeA.overlaps(aRangeB))
// only overlapping segments need to be tested
// consecutive segments touch of course
bool bOverlap = false;
if( b > a+1)
bOverlap = aRangeA.overlaps(aRangeB);
else
bOverlap = aRangeA.overlapsMore(aRangeB);
if( bOverlap)
{
if(bEdgeAIsCurve && bEdgeBIsCurve)
{
@@ -609,7 +616,13 @@ namespace basegfx
const B2DPoint aNextB(rCandidate.getB2DPoint(b + 1L == nPointCount ? 0L : b + 1L));
const B2DRange aRangeB(aCurrB, aNextB);
if(aRangeA.overlaps(aRangeB))
// consecutive segments touch of course
bool bOverlap = false;
if( b > a+1)
bOverlap = aRangeA.overlaps(aRangeB);
else
bOverlap = aRangeA.overlapsMore(aRangeB);
if( bOverlap)
{
findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPoints, rTempPoints);
}
@@ -806,7 +819,13 @@ namespace basegfx
const bool bEdgeBIsCurve(aCubicB.isBezier());
const B2DRange aRangeB(aCubicB.getRange());
if(aRangeA.overlaps(aRangeB))
// consecutive segments touch of course
bool bOverlap = false;
if( b > a+1)
bOverlap = aRangeA.overlaps(aRangeB);
else
bOverlap = aRangeA.overlapsMore(aRangeB);
if( bOverlap)
{
if(bEdgeAIsCurve && bEdgeBIsCurve)
{
@@ -848,7 +867,13 @@ namespace basegfx
const B2DPoint aNextB(rCandidateB.getB2DPoint(b + 1L == nPointCountB ? 0L : b + 1L));
const B2DRange aRangeB(aCurrB, aNextB);
if(aRangeA.overlaps(aRangeB))
// consecutive segments touch of course
bool bOverlap = false;
if( b > a+1)
bOverlap = aRangeA.overlaps(aRangeB);
else
bOverlap = aRangeA.overlapsMore(aRangeB);
if( bOverlap)
{
// test for simple edge-edge cuts
findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPointsA, rTempPointsB);