summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basegfx/inc/basegfx/point/b3dhompoint.hxx10
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygon.hxx8
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygontools.hxx14
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx7
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx10
-rw-r--r--basegfx/inc/basegfx/tuple/b2dtuple.hxx8
-rw-r--r--basegfx/inc/basegfx/tuple/b3dtuple.hxx10
-rw-r--r--basegfx/inc/basegfx/vector/b2dvector.hxx26
-rw-r--r--basegfx/source/point/b2dhompoint.cxx8
-rw-r--r--basegfx/source/polygon/b2dpolygon.cxx16
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx72
-rw-r--r--basegfx/source/polygon/b2dpolypolygon.cxx21
-rw-r--r--basegfx/source/polygon/b2dpolypolygoncutter.cxx38
-rw-r--r--basegfx/source/tuple/b2dtuple.cxx6
-rw-r--r--basegfx/source/tuple/b3dtuple.cxx6
-rw-r--r--basegfx/source/vector/b2dvector.cxx31
16 files changed, 203 insertions, 88 deletions
diff --git a/basegfx/inc/basegfx/point/b3dhompoint.hxx b/basegfx/inc/basegfx/point/b3dhompoint.hxx
index d661d2f500dc..7cd82c364a7f 100644
--- a/basegfx/inc/basegfx/point/b3dhompoint.hxx
+++ b/basegfx/inc/basegfx/point/b3dhompoint.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dhompoint.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:30:24 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -375,9 +375,9 @@ namespace basegfx
inline B3DHomPoint interpolate(B3DHomPoint& rOld1, B3DHomPoint& rOld2, double t)
{
B3DHomPoint aInt(
- ((rOld2.getX() - rOld1.getX()) + t) + rOld1.getX(),
- ((rOld2.getY() - rOld1.getY()) + t) + rOld1.getY(),
- ((rOld2.getZ() - rOld1.getZ()) + t) + rOld1.getZ());
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+ ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ());
return aInt;
}
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
index 40a45c800a4f..3ce8fff7bf8c 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygon.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:30:24 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -157,10 +157,6 @@ namespace basegfx
// remove double points, at the begin/end and follow-ups, too
void removeDoublePoints();
-
- // isInside tests for B2dPoint and other B2dPolygon. On border is not inside.
- sal_Bool isInside(const ::basegfx::point::B2DPoint& rPoint);
- sal_Bool isInside(const B2DPolygon& rPolygon);
};
} // end of namespace polygon
} // end of namespace basegfx
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
index 740d82060283..ae69b4078280 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygontools.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:30:24 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,9 +120,10 @@ namespace basegfx
// Get orientation of Polygon
::basegfx::vector::B2DVectorOrientation getOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate);
- // isInside tests for B2dPoint and other B2dPolygon. On border is not inside.
- sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::point::B2DPoint& rPoint);
- sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::polygon::B2DPolygon& rPolygon);
+ // isInside tests for B2dPoint and other B2dPolygon. On border is not inside as long as
+ // not sal_True is given in bWithBorder flag.
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::point::B2DPoint& rPoint, sal_Bool bWithBorder = sal_False);
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::polygon::B2DPolygon& rPolygon, sal_Bool bWithBorder = sal_False);
// get size of polygon
::basegfx::range::B2DRange getRange(const ::basegfx::polygon::B2DPolygon& rCandidate);
@@ -149,6 +150,9 @@ namespace basegfx
// get orientation at given polygon point
::basegfx::vector::B2DVectorOrientation getPointOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex);
+ // Continuity check for point with given index
+ ::basegfx::vector::B2DVectorContinuity getContinuityInPoint(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
// Definitions for the cut flags used from the findCut methods
typedef sal_uInt16 CutFlagValue;
diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
index 658f9b33d6b3..acd385099ebe 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygon.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:30:25 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -110,6 +110,9 @@ namespace basegfx
B2DPolygon getPolygon(sal_uInt32 nIndex) const;
void setPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon);
+ // test for curve
+ sal_Bool areControlPointsUsed() const;
+
// insert/append single polygon
void insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
void append(const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx
index 578df5a36965..c118076d82fe 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygoncutter.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:28:48 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -125,8 +125,10 @@ namespace basegfx
void swapOrientation();
::basegfx::range::B2DRange getRange() const;
- sal_Bool isInside(const ::basegfx::point::B2DPoint& rPnt) const;
- sal_Bool isPolygonInside(B2DPolygonNode* pPoly) const;
+ // isInside tests for B2dPoint and other B2DPolygonNode Polygon. On border is not inside as long as
+ // not sal_True is given in bWithBorder flag.
+ sal_Bool isInside(const ::basegfx::point::B2DPoint& rPnt, sal_Bool bWithBorder = sal_False) const;
+ sal_Bool isPolygonInside(B2DPolygonNode* pPoly, sal_Bool bWithBorder = sal_False) const;
};
// a type definition to have a vector of pointers to B2DPolygonNodes
diff --git a/basegfx/inc/basegfx/tuple/b2dtuple.hxx b/basegfx/inc/basegfx/tuple/b2dtuple.hxx
index 71300b00b6a1..dd775d8c399e 100644
--- a/basegfx/inc/basegfx/tuple/b2dtuple.hxx
+++ b/basegfx/inc/basegfx/tuple/b2dtuple.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dtuple.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-11-05 12:25:45 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -290,8 +290,8 @@ namespace basegfx
inline B2DTuple interpolate(const B2DTuple& rOld1, const B2DTuple& rOld2, double t)
{
B2DTuple aInt(
- ((rOld2.getX() - rOld1.getX()) + t) + rOld1.getX(),
- ((rOld2.getY() - rOld1.getY()) + t) + rOld1.getY());
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY());
return aInt;
}
diff --git a/basegfx/inc/basegfx/tuple/b3dtuple.hxx b/basegfx/inc/basegfx/tuple/b3dtuple.hxx
index 2098433a2af3..24ab97aad569 100644
--- a/basegfx/inc/basegfx/tuple/b3dtuple.hxx
+++ b/basegfx/inc/basegfx/tuple/b3dtuple.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dtuple.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-11-05 12:25:46 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -374,9 +374,9 @@ namespace basegfx
inline B3DTuple interpolate(const B3DTuple& rOld1, const B3DTuple& rOld2, double t)
{
B3DTuple aInt(
- ((rOld2.getX() - rOld1.getX()) + t) + rOld1.getX(),
- ((rOld2.getY() - rOld1.getY()) + t) + rOld1.getY(),
- ((rOld2.getZ() - rOld1.getZ()) + t) + rOld1.getZ());
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+ ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ());
return aInt;
}
diff --git a/basegfx/inc/basegfx/vector/b2dvector.hxx b/basegfx/inc/basegfx/vector/b2dvector.hxx
index 8a7127d42ab3..91f25e436b65 100644
--- a/basegfx/inc/basegfx/vector/b2dvector.hxx
+++ b/basegfx/inc/basegfx/vector/b2dvector.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dvector.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:30:26 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,6 +90,20 @@ namespace basegfx
ORIENTATION_NEUTRAL
};
+ /** Descriptor for the mathematical continuity of two 2D Vectors
+ */
+ enum B2DVectorContinuity
+ {
+ /// none
+ CONTINUITY_NONE = 0,
+
+ /// mathematically negative oriented
+ CONTINUITY_C1,
+
+ /// mathematically neutral, thus parallel
+ CONTINUITY_C2
+ };
+
/** Base Point class with two double values
This class derives all operators and common handling for
@@ -244,6 +258,14 @@ namespace basegfx
matrix are disregarded.
*/
B2DVector operator*( const matrix::B2DHomMatrix& rMat, const B2DVector& rVec );
+
+ /** Test continuity between given vectors.
+
+ The two given vectors are assumed to describe control points on a
+ common point. Calculate if there is a continuity between them.
+ */
+ ::basegfx::vector::B2DVectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector );
+
} // end of namespace vector
} // end of namespace basegfx
diff --git a/basegfx/source/point/b2dhompoint.cxx b/basegfx/source/point/b2dhompoint.cxx
index 75a5b5f0e782..575657491120 100644
--- a/basegfx/source/point/b2dhompoint.cxx
+++ b/basegfx/source/point/b2dhompoint.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dhompoint.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2003-11-05 12:25:53 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -228,8 +228,8 @@ namespace basegfx
B2DHomPoint interpolate(B2DHomPoint& rOld1, B2DHomPoint& rOld2, double t)
{
B2DHomPoint aInt(
- ((rOld2.getX() - rOld1.getX()) + t) + rOld1.getX(),
- ((rOld2.getY() - rOld1.getY()) + t) + rOld1.getY());
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY());
return aInt;
}
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index e5bcd66a2e04..09d4429aa181 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygon.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:30:29 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,6 +118,10 @@ public:
{
}
+ ~CoordinateDataArray2D()
+ {
+ }
+
sal_uInt32 count() const
{
return maVector.size();
@@ -182,7 +186,7 @@ public:
{
const sal_uInt32 nHalfSize(maVector.size() >> 1L);
CoordinateData2DVector::iterator aStart(maVector.begin());
- CoordinateData2DVector::iterator aEnd(maVector.end());
+ CoordinateData2DVector::iterator aEnd(maVector.end() - 1L);
for(sal_uInt32 a(0); a < nHalfSize; a++)
{
@@ -290,6 +294,10 @@ public:
}
}
+ ~ControlVectorArray2D()
+ {
+ }
+
sal_uInt32 count() const
{
return maVector.size();
@@ -1137,7 +1145,7 @@ namespace basegfx
void B2DPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount)
{
- DBG_ASSERT(nIndex + nCount > mpPolygon->count(), "B2DPolygon Remove outside range (!)");
+ DBG_ASSERT(nIndex + nCount <= mpPolygon->count(), "B2DPolygon Remove outside range (!)");
if(nCount)
{
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index c7211c12bd07..5061acfbfae4 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygontools.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:30:29 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,15 +86,11 @@ namespace basegfx
// B2DPolygon tools
void checkClosed(polygon::B2DPolygon& rCandidate)
{
- while(rCandidate.count() > 1L)
+ while(rCandidate.count() > 1L
+ && rCandidate.getB2DPoint(0L).equal(rCandidate.getB2DPoint(rCandidate.count() - 1L)))
{
- sal_Bool bFirstLastPointEqual(rCandidate.getB2DPoint(0L).equal(rCandidate.getB2DPoint(rCandidate.count() - 1L)));
-
- if(bFirstLastPointEqual)
- {
- rCandidate.setClosed(sal_True);
- rCandidate.remove(rCandidate.count() - 1L);
- }
+ rCandidate.setClosed(sal_True);
+ rCandidate.remove(rCandidate.count() - 1L);
}
}
@@ -134,6 +130,8 @@ namespace basegfx
// is none. Same for successor.
sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const ::basegfx::polygon::B2DPolygon& rCandidate)
{
+ DBG_ASSERT(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)");
+
if(nIndex)
{
return nIndex - 1L;
@@ -150,6 +148,8 @@ namespace basegfx
sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const ::basegfx::polygon::B2DPolygon& rCandidate)
{
+ DBG_ASSERT(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)");
+
if(nIndex + 1L < rCandidate.count())
{
return nIndex + 1L;
@@ -162,9 +162,12 @@ namespace basegfx
sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const ::basegfx::polygon::B2DPolygon& rCandidate)
{
+ sal_uInt32 nNewIndex(nIndex);
+ DBG_ASSERT(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)");
+
if(rCandidate.count() > 1)
{
- sal_uInt32 nNewIndex = getIndexOfPredecessor(nIndex, rCandidate);
+ nNewIndex = getIndexOfPredecessor(nIndex, rCandidate);
::basegfx::point::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex));
while(nNewIndex != nIndex
@@ -174,14 +177,17 @@ namespace basegfx
}
}
- return nIndex;
+ return nNewIndex;
}
sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const ::basegfx::polygon::B2DPolygon& rCandidate)
{
+ sal_uInt32 nNewIndex(nIndex);
+ DBG_ASSERT(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)");
+
if(rCandidate.count() > 1)
{
- sal_uInt32 nNewIndex = getIndexOfSuccessor(nIndex, rCandidate);
+ nNewIndex = getIndexOfSuccessor(nIndex, rCandidate);
::basegfx::point::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex));
while(nNewIndex != nIndex
@@ -191,7 +197,7 @@ namespace basegfx
}
}
- return nIndex;
+ return nNewIndex;
}
::basegfx::vector::B2DVectorOrientation getOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate)
@@ -207,7 +213,24 @@ namespace basegfx
return eRetval;
}
- sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::point::B2DPoint& rPoint)
+ ::basegfx::vector::B2DVectorContinuity getContinuityInPoint(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex)
+ {
+ DBG_ASSERT(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)");
+ ::basegfx::vector::B2DVectorContinuity eRetval(::basegfx::vector::CONTINUITY_NONE);
+
+ if(rCandidate.count() > 1L && rCandidate.areControlPointsUsed())
+ {
+ sal_uInt32 nPrevInd(getIndexOfPredecessor(nIndex, rCandidate));
+ const ::basegfx::vector::B2DVector aForwardVector(rCandidate.getControlVectorA(nIndex));
+ const ::basegfx::vector::B2DVector aBackVector(rCandidate.getControlVectorB(nPrevInd));
+
+ eRetval = ::basegfx::vector::getContinuity(aBackVector, aForwardVector);
+ }
+
+ return eRetval;
+ }
+
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::point::B2DPoint& rPoint, sal_Bool bWithBorder)
{
sal_Bool bRetval(sal_False);
const sal_uInt32 nPointCount(rCandidate.count());
@@ -215,9 +238,14 @@ namespace basegfx
for(sal_uInt32 a(0L); a < nPointCount; a++)
{
const ::basegfx::point::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a));
- const ::basegfx::point::B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L));
+
+ if(bWithBorder && aCurrentPoint.equal(rPoint))
+ {
+ return sal_True;
+ }
// cross-over in Y?
+ const ::basegfx::point::B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L));
const sal_Bool bCompYA(::basegfx::numeric::fTools::more(aPreviousPoint.getY(), rPoint.getY()));
const sal_Bool bCompYB(::basegfx::numeric::fTools::more(aCurrentPoint.getY(), rPoint.getY()));
@@ -240,7 +268,11 @@ namespace basegfx
(aPreviousPoint.getX() - aCurrentPoint.getX()) /
(aPreviousPoint.getY() - aCurrentPoint.getY());
- if(::basegfx::numeric::fTools::more(fCompare, rPoint.getX()))
+ if(bWithBorder && ::basegfx::numeric::fTools::more(fCompare, rPoint.getX()))
+ {
+ bRetval = !bRetval;
+ }
+ else if(::basegfx::numeric::fTools::moreOrEqual(fCompare, rPoint.getX()))
{
bRetval = !bRetval;
}
@@ -251,7 +283,7 @@ namespace basegfx
return bRetval;
}
- sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::polygon::B2DPolygon& rPolygon)
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::polygon::B2DPolygon& rPolygon, sal_Bool bWithBorder)
{
const sal_uInt32 nPointCount(rPolygon.count());
@@ -259,7 +291,7 @@ namespace basegfx
{
const ::basegfx::point::B2DPoint aTestPoint(rPolygon.getB2DPoint(a));
- if(!isInside(rCandidate, aTestPoint))
+ if(!isInside(rCandidate, aTestPoint, bWithBorder))
{
return sal_False;
}
@@ -313,6 +345,7 @@ namespace basegfx
double getEdgeLength(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex)
{
+ DBG_ASSERT(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)");
double fRetval(0.0);
const sal_uInt32 nPointCount(rCandidate.count());
@@ -476,6 +509,7 @@ namespace basegfx
::basegfx::vector::B2DVectorOrientation getPointOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex)
{
+ DBG_ASSERT(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)");
::basegfx::vector::B2DVectorOrientation eRetval(::basegfx::vector::ORIENTATION_NEUTRAL);
if(rCandidate.count() > 2)
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 7b15b1282a71..fdd1e30276d3 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygon.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:30:29 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -312,6 +312,21 @@ namespace basegfx
}
}
+ sal_Bool B2DPolyPolygon::areControlPointsUsed() const
+ {
+ for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++)
+ {
+ const ::basegfx::polygon::B2DPolygon& rPolygon = mpPolyPolygon->getPolygon(a);
+
+ if(rPolygon.areControlPointsUsed())
+ {
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+ }
+
void B2DPolyPolygon::insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount)
{
DBG_ASSERT(nIndex <= mpPolyPolygon->count(), "B2DPolyPolygon Insert outside range (!)");
@@ -354,7 +369,7 @@ namespace basegfx
void B2DPolyPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount)
{
- DBG_ASSERT(nIndex + nCount > mpPolyPolygon->count(), "B2DPolyPolygon Remove outside range (!)");
+ DBG_ASSERT(nIndex + nCount <= mpPolyPolygon->count(), "B2DPolyPolygon Remove outside range (!)");
if(nCount)
{
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index 46b86ab10e40..31df5fee4628 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygoncutter.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:29:33 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -242,21 +242,26 @@ namespace basegfx
return aRetval;
}
- sal_Bool B2DPolygonNode::isInside(const ::basegfx::point::B2DPoint& rPnt) const
+ sal_Bool B2DPolygonNode::isInside(const ::basegfx::point::B2DPoint& rPoint, sal_Bool bWithBorder) const
{
sal_Bool bInside(sal_False);
const B2DPolygonNode* pCurrent = this;
do
{
+ if(bWithBorder && pCurrent->getPosition().equal(rPoint))
+ {
+ return sal_True;
+ }
+
B2DPolygonNode* pNext = pCurrent->getNext();
- const sal_Bool bCompYA(::basegfx::numeric::fTools::more(pCurrent->getPosition().getY(), rPnt.getY()));
- const sal_Bool bCompYB(::basegfx::numeric::fTools::more(pNext->getPosition().getY(), rPnt.getY()));
+ const sal_Bool bCompYA(::basegfx::numeric::fTools::more(pCurrent->getPosition().getY(), rPoint.getY()));
+ const sal_Bool bCompYB(::basegfx::numeric::fTools::more(pNext->getPosition().getY(), rPoint.getY()));
if(bCompYA != bCompYB)
{
- const sal_Bool bCompXA(::basegfx::numeric::fTools::more(pCurrent->getPosition().getX(), rPnt.getX()));
- const sal_Bool bCompXB(::basegfx::numeric::fTools::more(pNext->getPosition().getX(), rPnt.getX()));
+ const sal_Bool bCompXA(::basegfx::numeric::fTools::more(pCurrent->getPosition().getX(), rPoint.getX()));
+ const sal_Bool bCompXB(::basegfx::numeric::fTools::more(pNext->getPosition().getX(), rPoint.getX()));
if(bCompXA == bCompXB)
{
@@ -268,11 +273,15 @@ namespace basegfx
else
{
double fCmp =
- pNext->getPosition().getX() - (pNext->getPosition().getY() - rPnt.getY()) *
+ pNext->getPosition().getX() - (pNext->getPosition().getY() - rPoint.getY()) *
(pCurrent->getPosition().getX() - pNext->getPosition().getX()) /
(pCurrent->getPosition().getY() - pNext->getPosition().getY());
- if(::basegfx::numeric::fTools::more(fCmp, rPnt.getX()))
+ if(bWithBorder && ::basegfx::numeric::fTools::more(fCmp, rPoint.getX()))
+ {
+ bInside = !bInside;
+ }
+ else if(::basegfx::numeric::fTools::moreOrEqual(fCmp, rPoint.getX()))
{
bInside = !bInside;
}
@@ -287,13 +296,13 @@ namespace basegfx
return bInside;
}
- sal_Bool B2DPolygonNode::isPolygonInside(B2DPolygonNode* pPoly) const
+ sal_Bool B2DPolygonNode::isPolygonInside(B2DPolygonNode* pPoly, sal_Bool bWithBorder) const
{
B2DPolygonNode* pTest = pPoly;
sal_Bool bAllAInside(sal_True);
do {
- bAllAInside = isInside(pTest->getPosition());
+ bAllAInside = isInside(pTest->getPosition(), bWithBorder);
pTest = pTest->getNext();
} while(bAllAInside && pTest != pPoly);
@@ -397,8 +406,8 @@ namespace basegfx
if(a != b && doRangesInclude(rInfoA.getRange(), rInfoB.getRange()))
{
- // volume B in A, test pA, pB for inclusion
- if(maPolygonList[a]->isPolygonInside(maPolygonList[b]))
+ // volume B in A, test pA, pB for inclusion, with border
+ if(maPolygonList[a]->isPolygonInside(maPolygonList[b], sal_True))
{
// pB is inside pA
rInfoB.changeDepth(rInfoA.getOrientation());
@@ -567,10 +576,9 @@ namespace basegfx
if(nCount > 2L)
{
B2DPolygon aNewPolygon;
- nCount = 0L;
do {
- aNewPolygon.setB2DPoint(nCount++, pAct->getPosition());
+ aNewPolygon.append(pAct->getPosition());
pAct = pAct->getNext();
} while(pAct != pCand);
diff --git a/basegfx/source/tuple/b2dtuple.cxx b/basegfx/source/tuple/b2dtuple.cxx
index 367ea17285dd..a8cdfa54d663 100644
--- a/basegfx/source/tuple/b2dtuple.cxx
+++ b/basegfx/source/tuple/b2dtuple.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dtuple.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2003-11-05 12:25:56 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,7 +72,7 @@ namespace basegfx
namespace tuple
{
// initialize static member
- B2DTuple B2DTuple::maEmptyTuple(0.0, 0.0);
+ ::basegfx::tuple::B2DTuple B2DTuple::maEmptyTuple(0.0, 0.0);
sal_Bool B2DTuple::equalZero() const
{
diff --git a/basegfx/source/tuple/b3dtuple.cxx b/basegfx/source/tuple/b3dtuple.cxx
index 3022d1fba2ac..f1e7691adfb3 100644
--- a/basegfx/source/tuple/b3dtuple.cxx
+++ b/basegfx/source/tuple/b3dtuple.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dtuple.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:14:00 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,7 +68,7 @@ namespace basegfx
namespace tuple
{
// initialize static member
- B3DTuple B3DTuple::maEmptyTuple(0.0, 0.0, 0.0);
+ ::basegfx::tuple::B3DTuple B3DTuple::maEmptyTuple(0.0, 0.0, 0.0);
} // end of namespace tuple
} // end of namespace basegfx
diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx
index 92931c563125..1177396fefd1 100644
--- a/basegfx/source/vector/b2dvector.cxx
+++ b/basegfx/source/vector/b2dvector.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dvector.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2003-11-06 16:30:30 $
+ * last change: $Author: aw $ $Date: 2003-11-10 11:45:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -163,13 +163,13 @@ namespace basegfx
sal_Bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB )
{
- double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecA.getX());
+ double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX());
return ::basegfx::numeric::fTools::equalZero(fVal);
}
B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB )
{
- double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecA.getX());
+ double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX());
if(fVal > 0.0)
{
@@ -195,6 +195,29 @@ namespace basegfx
B2DVector aRes( rVec );
return aRes*=rMat;
}
+
+ ::basegfx::vector::B2DVectorContinuity getContinuity(const B2DVector& rBackVector, const B2DVector& rForwardVector )
+ {
+ ::basegfx::vector::B2DVectorContinuity eRetval(::basegfx::vector::CONTINUITY_NONE);
+
+ if(!rBackVector.equalZero() && !rForwardVector.equalZero())
+ {
+ const B2DVector aInverseForwardVector(-rForwardVector.getX(), -rForwardVector.getY());
+
+ if(rBackVector.equal(aInverseForwardVector))
+ {
+ // same direction and same length -> C2
+ eRetval = ::basegfx::vector::CONTINUITY_C2;
+ }
+ else if(areParallel(rBackVector, aInverseForwardVector))
+ {
+ // same direction -> C1
+ eRetval = ::basegfx::vector::CONTINUITY_C1;
+ }
+ }
+
+ return eRetval;
+ }
} // end of namespace vector
} // end of namespace basegfx