24#include <osl/diagnose.h>
25#include <rtl/math.hxx>
38#define ANGLE_BOUND_START_VALUE (2.25)
39#define ANGLE_BOUND_MINIMUM_VALUE (0.1)
40#define STEPSPERQUARTER (3)
49 if(rCandidate.
count())
96 OSL_ENSURE(
nIndex < rCandidate.
count(),
"getIndexOfPredecessor: Access to polygon out of range (!)");
102 else if(rCandidate.
count())
104 return rCandidate.
count() - 1;
114 OSL_ENSURE(
nIndex < rCandidate.
count(),
"getIndexOfPredecessor: Access to polygon out of range (!)");
142 if(fSignedArea > 0.0)
146 else if(fSignedArea < 0.0)
164 const sal_uInt32 nPointCount(rCandidate.
count());
170 const sal_uInt32 nEdgeCount(rCandidate.
isClosed() ? nPointCount : nPointCount - 1);
175 aRetval.
reserve(nPointCount*4);
180 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
183 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
194 if(fDistanceBound == 0.0)
200 fBound = fRoughLength * 0.01;
205 fBound = fDistanceBound;
247 const sal_uInt32 nPointCount(rCandidate.
count());
253 const sal_uInt32 nEdgeCount(rCandidate.
isClosed() ? nPointCount : nPointCount - 1);
258 aRetval.
reserve(nPointCount*4);
264 if(fAngleBound == 0.0)
273 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
276 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
323 const sal_uInt32 nPointCount(aCandidate.
count());
329 for(sal_uInt32
a(0);
a < nPointCount;
a++)
331 const B2DPoint aPreviousPoint(aCurrentPoint);
335 const bool bCompYA(aPreviousPoint.
getY() > rPoint.
getY());
336 const bool bCompYB(aCurrentPoint.
getY() > rPoint.
getY());
338 if(bCompYA != bCompYB)
341 const bool bCompXA(aPreviousPoint.
getX() > rPoint.
getX());
342 const bool bCompXB(aCurrentPoint.
getX() > rPoint.
getX());
344 if(bCompXA == bCompXB)
353 const double fCompare(
354 aCurrentPoint.
getX() - (aCurrentPoint.
getY() - rPoint.
getY()) *
355 (aPreviousPoint.
getX() - aCurrentPoint.
getX()) /
356 (aPreviousPoint.
getY() - aCurrentPoint.
getY()));
359 if(fCompare > rPoint.
getX())
376 const sal_uInt32 nPointCount(aPolygon.
count());
378 for(sal_uInt32
a(0);
a < nPointCount;
a++)
382 if(!
isInside(aCandidate, aTestPoint, bWithBorder))
401 const sal_uInt32 nPointCount(aCandidate.
count());
405 for(sal_uInt32
a(0);
a < nPointCount;
a++)
410 fRetval += aPreviousPoint.
getX() * aCurrentPoint.
getY();
411 fRetval -= aPreviousPoint.
getY() * aCurrentPoint.
getX();
433 const double fZero(0.0);
446 const sal_uInt32 nPointCount(rCandidate.
count());
447 OSL_ENSURE(
nIndex < nPointCount,
"getEdgeLength: Access to polygon out of range (!)");
452 const sal_uInt32 nNextIndex((
nIndex + 1) % nPointCount);
480 const sal_uInt32 nPointCount(rCandidate.
count());
484 const sal_uInt32 nEdgeCount(rCandidate.
isClosed() ? nPointCount : nPointCount - 1);
491 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
493 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
506 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
508 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
523 const sal_uInt32 nPointCount(rCandidate.
count());
525 if( nPointCount == 1 )
530 else if(nPointCount > 1)
532 const sal_uInt32 nEdgeCount(rCandidate.
isClosed() ? nPointCount : nPointCount - 1);
534 bool bIndexDone(
false);
548 sal_uInt32
nCount(sal_uInt32(-fDistance / fLength));
549 fDistance += double(
nCount + 1) * fLength;
564 sal_uInt32
nCount(sal_uInt32(fDistance / fLength));
565 fDistance -=
static_cast<double>(
nCount) * fLength;
591 fDistance -= fEdgeLength;
611 const sal_uInt32 nNextIndex((
nIndex + 1) % nPointCount);
621 const sal_uInt32 nNextIndex((
nIndex + 1) % nPointCount);
647 const double fRelativeInEdge(fDistance / fEdgeLength);
648 aRetval =
interpolate(aRetval, aNextPoint, fRelativeInEdge);
672 const sal_uInt32 nPointCount(rCandidate.
count());
697 fFrom = fTo = (fFrom + fTo) / 2.0;
708 const sal_uInt32 nEdgeCount(rCandidate.
isClosed() ? nPointCount : nPointCount - 1);
709 double fPositionOfStart(0.0);
710 bool bStartDone(
false);
711 bool bEndDone(
false);
713 for(sal_uInt32
a(0); !(bStartDone && bEndDone) &&
a < nEdgeCount;
a++)
744 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
760 const double fBezierDistance(aBezierSegmentHelper.
distanceToRelative(fFrom - fPositionOfStart));
763 aBezierSegment.
split(fBezierDistance,
nullptr, &aRight);
772 const double fRelValue((fFrom - fPositionOfStart) / fEdgeLength);
780 if(rtl::math::approxEqual(fFrom, fTo))
792 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
802 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
818 const double fBezierDistance(aBezierSegmentHelper.
distanceToRelative(fTo - fPositionOfStart));
821 aBezierSegment.
split(fBezierDistance, &aLeft,
nullptr);
830 const double fRelValue((fTo - fPositionOfStart) / fEdgeLength);
843 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
854 fPositionOfStart += fEdgeLength;
870 double* pCut1,
double* pCut2)
885 if(rEdge1Start.
equal(rEdge2Start))
895 const B2DPoint aEnd1(rEdge1Start + rEdge1Delta);
896 const B2DPoint aEnd2(rEdge2Start + rEdge2Delta);
898 if(aEnd1.
equal(aEnd2))
909 const B2DPoint aEnd2(rEdge2Start + rEdge2Delta);
911 if(rEdge1Start.
equal(aEnd2))
923 const B2DPoint aEnd1(rEdge1Start + rEdge1Delta);
925 if(rEdge2Start.
equal(aEnd1))
940 if(
isPointOnEdge(rEdge1Start, rEdge2Start, rEdge2Delta, &fCut2))
950 if(
isPointOnEdge(rEdge2Start, rEdge1Start, rEdge1Delta, &fCut1))
960 const B2DPoint aEnd1(rEdge1Start + rEdge1Delta);
972 const B2DPoint aEnd2(rEdge2Start + rEdge2Delta);
984 fCut1 = (rEdge1Delta.
getX() * rEdge2Delta.
getY()) - (rEdge1Delta.
getY() * rEdge2Delta.
getX());
988 fCut1 = (rEdge2Delta.
getY() * (rEdge2Start.
getX() - rEdge1Start.
getX())
989 + rEdge2Delta.
getX() * (rEdge1Start.
getY() - rEdge2Start.
getY())) / fCut1;
991 const double fZero(0.0);
992 const double fOne(1.0);
999 if(fabs(rEdge2Delta.
getX()) > fabs(rEdge2Delta.
getY()))
1001 fCut2 = (rEdge1Start.
getX() + fCut1
1002 * rEdge1Delta.
getX() - rEdge2Start.
getX()) / rEdge2Delta.
getX();
1006 fCut2 = (rEdge1Start.
getY() + fCut1
1007 * rEdge1Delta.
getY() - rEdge2Start.
getY()) / rEdge2Delta.
getY();
1042 const double fZero(0.0);
1043 const double fOne(1.0);
1045 if(bDeltaXIsZero && bDeltaYIsZero)
1050 else if(bDeltaXIsZero)
1055 double fValue = (rPoint.
getY() - rEdgeStart.
getY()) / rEdgeDelta.
getY();
1068 else if(bDeltaYIsZero)
1073 double fValue = (rPoint.
getX() - rEdgeStart.
getX()) / rEdgeDelta.
getX();
1089 double fTOne = (rPoint.
getX() - rEdgeStart.
getX()) / rEdgeDelta.
getX();
1090 double fTTwo = (rPoint.
getY() - rEdgeStart.
getY()) / rEdgeDelta.
getY();
1096 double fValue = (fTOne + fTTwo) / 2.0;
1116 const std::vector<double>& rDotDashArray,
1119 double fDotDashLength)
1124 pLineTarget->
clear();
1129 pGapTarget->
clear();
1134 nullptr == pLineTarget
1138 nullptr == pGapTarget
1167 rTargetCallback(rLast);
1175 rTargetCallback(rSnippet);
1195 rTargetCallback(rLast);
1200 rTargetCallback(rFirst);
1206 const std::vector<double>& rDotDashArray,
1209 double fDotDashLength)
1211 const sal_uInt32 nPointCount(rCandidate.
count());
1212 const sal_uInt32 nDotDashCount(rDotDashArray.size());
1216 fDotDashLength = std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0);
1219 if(
fTools::lessOrEqual(fDotDashLength, 0.0) || (!aLineTargetCallback && !aGapTargetCallback) || !nPointCount)
1222 if(aLineTargetCallback)
1224 aLineTargetCallback(rCandidate);
1227 if(aGapTargetCallback)
1229 aGapTargetCallback(rCandidate);
1238 static const double fNumberOfAllowedSnippets(65535.0 * 2.0);
1239 const double fAllowedLength((fNumberOfAllowedSnippets * fDotDashLength) /
double(rDotDashArray.size()));
1241 std::vector<double> aDotDashArray(rDotDashArray);
1243 if(fCandidateLength > fAllowedLength)
1252 assert(
true &&
"applyLineDashing: potentially too expensive to do the requested dismantle - please consider stretched LineDash pattern (!)");
1256 const double fFactor(fCandidateLength / fAllowedLength);
1257 std::for_each(aDotDashArray.begin(), aDotDashArray.end(), [&fFactor](
double &f){ f *= fFactor; });
1262 const bool bIsClosed(rCandidate.
isClosed());
1263 const sal_uInt32 nEdgeCount(bIsClosed ? nPointCount : nPointCount - 1);
1267 sal_uInt32 nDotDashIndex(0);
1269 double fDotDashMovingLength(aDotDashArray[0]);
1278 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
1281 double fLastDotDashMovingLength(0.0);
1282 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
1294 const double fEdgeLength(aCubicBezierHelper.
getLength());
1301 const bool bHandleLine(bIsLine && aLineTargetCallback);
1302 const bool bHandleGap(!bIsLine && aGapTargetCallback);
1304 if(bHandleLine || bHandleGap)
1306 const double fBezierSplitStart(aCubicBezierHelper.
distanceToRelative(fLastDotDashMovingLength));
1307 const double fBezierSplitEnd(aCubicBezierHelper.
distanceToRelative(fDotDashMovingLength));
1310 if(!aSnippet.
count())
1331 fLastDotDashMovingLength = fDotDashMovingLength;
1332 fDotDashMovingLength += aDotDashArray[(++nDotDashIndex) % nDotDashCount];
1337 const bool bHandleLine(bIsLine && aLineTargetCallback);
1338 const bool bHandleGap(!bIsLine && aGapTargetCallback);
1340 if(bHandleLine || bHandleGap)
1343 const double fBezierSplit(aCubicBezierHelper.
distanceToRelative(fLastDotDashMovingLength));
1345 aCurrentEdge.
split(fBezierSplit,
nullptr, &aRight);
1347 if(!aSnippet.
count())
1356 fDotDashMovingLength -= fEdgeLength;
1369 const bool bHandleLine(bIsLine && aLineTargetCallback);
1370 const bool bHandleGap(!bIsLine && aGapTargetCallback);
1372 if(bHandleLine || bHandleGap)
1374 if(!aSnippet.
count())
1395 fLastDotDashMovingLength = fDotDashMovingLength;
1396 fDotDashMovingLength += aDotDashArray[(++nDotDashIndex) % nDotDashCount];
1401 const bool bHandleLine(bIsLine && aLineTargetCallback);
1402 const bool bHandleGap(!bIsLine && aGapTargetCallback);
1404 if(bHandleLine || bHandleGap)
1406 if(!aSnippet.
count())
1415 fDotDashMovingLength -= fEdgeLength;
1424 if(aSnippet.
count())
1426 const bool bHandleLine(bIsLine && aLineTargetCallback);
1427 const bool bHandleGap(!bIsLine && aGapTargetCallback);
1440 if(bIsClosed && aLineTargetCallback)
1445 if(bIsClosed && aGapTargetCallback)
1458 const B2DVector aEdge(rEdgeEnd - rEdgeStart);
1459 bool bDoDistanceTestStart(
false);
1460 bool bDoDistanceTestEnd(
false);
1465 bDoDistanceTestStart =
true;
1472 (aPerpend.
getY() * (rTestPosition.
getX() - rEdgeStart.
getX())
1473 + aPerpend.
getX() * (rEdgeStart.
getY() - rTestPosition.
getY())) /
1475 const double fZero(0.0);
1476 const double fOne(1.0);
1481 bDoDistanceTestStart =
true;
1486 bDoDistanceTestEnd =
true;
1492 const B2DVector aDelta(rTestPosition - aCutPoint);
1493 const double fDistanceSquare(aDelta.
scalar(aDelta));
1495 return fDistanceSquare <= fDistance * fDistance;
1499 if(bDoDistanceTestStart)
1501 const B2DVector aDelta(rTestPosition - rEdgeStart);
1502 const double fDistanceSquare(aDelta.
scalar(aDelta));
1504 if(fDistanceSquare <= fDistance * fDistance)
1509 else if(bDoDistanceTestEnd)
1511 const B2DVector aDelta(rTestPosition - rEdgeEnd);
1512 const double fDistanceSquare(aDelta.
scalar(aDelta));
1514 if(fDistanceSquare <= fDistance * fDistance)
1530 const sal_uInt32 nPointCount(aCandidate.
count());
1535 const sal_uInt32 nEdgeCount(aCandidate.
isClosed() ? nPointCount : nPointCount - 1);
1541 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
1543 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
1574 SAL_WARN_IF(fAngle < 0 || fAngle > M_PI_2,
"basegfx",
"angle not suitable for approximate circle");
1575 if (0 <= fAngle && fAngle <= M_PI_2)
1577 return 4.0/3.0 * ( tan(fAngle/4.0));
1585 const double fZero(0.0);
1586 const double fOne(1.0);
1588 fRadiusX = std::clamp(fRadiusX, 0.0, 1.0);
1589 fRadiusY = std::clamp(fRadiusY, 0.0, 1.0);
1591 if(rtl::math::approxEqual(fZero, fRadiusX) || rtl::math::approxEqual(fZero, fRadiusY))
1608 aPolygon.setClosed(
true );
1612 else if(rtl::math::approxEqual(fOne, fRadiusX) && rtl::math::approxEqual(fOne, fRadiusY))
1616 const double fRectRadiusX(rRect.
getWidth() / 2.0);
1617 const double fRectRadiusY(rRect.
getHeight() / 2.0);
1624 const double fBowX((rRect.
getWidth() / 2.0) * fRadiusX);
1625 const double fBowY((rRect.
getHeight() / 2.0) * fRadiusY);
1629 if(!rtl::math::approxEqual(fOne, fRadiusX))
1632 aRetval.
append(aBottomCenter);
1675 if(rtl::math::approxEqual(fOne, fRadiusX) || rtl::math::approxEqual(fOne, fRadiusY))
1694 aPolygon.setClosed(
true );
1701 static auto const singleton = [] {
1729 B2DPoint aForward(1.0, fSegmentKappa);
1730 B2DPoint aBackward(1.0, -fSegmentKappa);
1732 if(nStartQuadrant != 0)
1735 aPoint *= aQuadrantMatrix;
1736 aBackward *= aQuadrantMatrix;
1737 aForward *= aQuadrantMatrix;
1740 aUnitCircle.
append(aPoint);
1744 aPoint *= aRotateMatrix;
1745 aBackward *= aRotateMatrix;
1747 aForward *= aRotateMatrix;
1758 static auto const singleton = [] {
1763 B2DPoint aForward(1.0, fSegmentKappa);
1764 B2DPoint aBackward(1.0, -fSegmentKappa);
1766 aUnitHalfCircle.
append(aPoint);
1770 aPoint *= aRotateMatrix;
1771 aBackward *= aRotateMatrix;
1773 aForward *= aRotateMatrix;
1775 return aUnitHalfCircle;
1782 switch(nStartQuadrant % 4)
1855 const sal_uInt32 nStartSegment(sal_uInt32(fStart / fAnglePerSegment) % nSegments);
1856 const sal_uInt32 nEndSegment(sal_uInt32(fEnd / fAnglePerSegment) % nSegments);
1859 B2DPoint aSegStart(cos(fStart), sin(fStart));
1860 aRetval.
append(aSegStart);
1862 if(nStartSegment == nEndSegment &&
fTools::more(fEnd, fStart))
1865 const B2DPoint aSegEnd(cos(fEnd), sin(fEnd));
1875 double fSegEndRad((nStartSegment + 1) * fAnglePerSegment);
1877 B2DPoint aSegEnd(cos(fSegEndRad), sin(fSegEndRad));
1884 sal_uInt32 nSegment((nStartSegment + 1) % nSegments);
1885 aSegStart = aSegEnd;
1887 while(nSegment != nEndSegment)
1890 fSegEndRad = (nSegment + 1) * fAnglePerSegment;
1891 aSegEnd =
B2DPoint(cos(fSegEndRad), sin(fSegEndRad));
1894 aSegStart + (
B2DPoint(-aSegStart.
getY(), aSegStart.
getX()) * fSegmentKappa),
1898 nSegment = (nSegment + 1) % nSegments;
1899 aSegStart = aSegEnd;
1903 const double fSegStartRad(nSegment * fAnglePerSegment);
1905 aSegEnd =
B2DPoint(cos(fEnd), sin(fEnd));
1932 OSL_ENSURE(!rCandidate.
areControlPointsUsed(),
"hasNeutralPoints: ATM works not for curves (!)");
1933 const sal_uInt32 nPointCount(rCandidate.
count());
1935 if(nPointCount <= 2)
1941 for(sal_uInt32
a(0);
a < nPointCount;
a++)
1944 const B2DVector aPrevVec(aPrevPoint - aCurrPoint);
1945 const B2DVector aNextVec(aNextPoint - aCurrPoint);
1956 aPrevPoint = aCurrPoint;
1957 aCurrPoint = aNextPoint;
1968 const sal_uInt32 nPointCount(rCandidate.
count());
1973 for(sal_uInt32
a(0);
a < nPointCount;
a++)
1976 const B2DVector aPrevVec(aPrevPoint - aCurrPoint);
1977 const B2DVector aNextVec(aNextPoint - aCurrPoint);
1983 aCurrPoint = aNextPoint;
1988 aRetval.
append(aCurrPoint);
1991 aPrevPoint = aCurrPoint;
1992 aCurrPoint = aNextPoint;
2015 const sal_uInt32 nPointCount(rCandidate.
count());
2017 if(nPointCount <= 2)
2022 B2DVector aCurrVec(aPrevPoint - aCurrPoint);
2025 for(sal_uInt32
a(0);
a < nPointCount;
a++)
2028 const B2DVector aNextVec(aNextPoint - aCurrPoint);
2034 aOrientation = aCurrentOrientation;
2046 aCurrPoint = aNextPoint;
2047 aCurrVec = -aNextVec;
2055 OSL_ENSURE(
nIndex < rCandidate.
count(),
"getOrientationForIndex: index out of range (!)");
2067 if(rCandidate.
equal(rStart) || rCandidate.
equal(rEnd))
2072 else if(rStart.
equal(rEnd))
2079 const B2DVector aEdgeVector(rEnd - rStart);
2080 const B2DVector aTestVector(rCandidate - rStart);
2084 const double fZero(0.0);
2085 const double fOne(1.0);
2086 const double fParamTestOnCurr(fabs(aEdgeVector.
getX()) > fabs(aEdgeVector.
getY())
2087 ? aTestVector.
getX() / aEdgeVector.
getX()
2088 : aTestVector.
getY() / aEdgeVector.
getY());
2103 const sal_uInt32 nPointCount(aCandidate.
count());
2107 const sal_uInt32 nLoopCount(aCandidate.
isClosed() ? nPointCount : nPointCount - 1);
2110 for(sal_uInt32
a(0);
a < nLoopCount;
a++)
2114 if(
isPointOnLine(aCurrentPoint, aNextPoint, rPoint, bWithPoints))
2119 aCurrentPoint = aNextPoint;
2122 else if(nPointCount && bWithPoints)
2148 const B2DVector aLineVector(rEnd - rStart);
2149 const B2DVector aVectorToA(rEnd - rCandidateA);
2150 const double fCrossA(aLineVector.
cross(aVectorToA));
2160 const B2DVector aVectorToB(rEnd - rCandidateB);
2161 const double fCrossB(aLineVector.
cross(aVectorToB));
2171 return ((fCrossA > 0.0) == (fCrossB > 0.0));
2202 int lcl_sgn(
const double n )
2204 return n == 0.0 ? 0 : 1 - 2*
int(std::signbit(n));
2213 rPoly.
count() < 4 ||
2222 int nVerticalEdgeType=0;
2223 int nHorizontalEdgeType=0;
2224 bool bNullVertex(
true);
2225 bool bCWPolygon(
false);
2227 bool bOrientationSet(
false);
2241 int nCurrVerticalEdgeType( lcl_sgn( rPoint1.
getY() - rPoint0.
getY() ) );
2245 int nCurrHorizontalEdgeType( lcl_sgn(rPoint1.
getX() - rPoint0.
getX()) );
2247 if( nCurrVerticalEdgeType && nCurrHorizontalEdgeType )
2250 const bool bCurrNullVertex( !nCurrVerticalEdgeType && !nCurrHorizontalEdgeType );
2254 if( bCurrNullVertex )
2265 const int nCrossProduct( nHorizontalEdgeType*nCurrVerticalEdgeType -
2266 nVerticalEdgeType*nCurrHorizontalEdgeType );
2268 if( !nCrossProduct )
2274 if( !bOrientationSet )
2276 bCWPolygon = nCrossProduct == 1;
2277 bOrientationSet =
true;
2285 if( (nCrossProduct == 1) != bCWPolygon )
2298 nVerticalEdgeType = nCurrVerticalEdgeType;
2299 nHorizontalEdgeType = nCurrHorizontalEdgeType;
2300 bNullVertex =
false;
2320 for(sal_uInt32
a(0);
a < rCandidate.
count();
a++)
2359 if(rPointA.
equal(rPointB))
2362 const B2DVector aVector(rTestPoint - rPointA);
2368 const B2DVector aVector1(rPointB - rPointA);
2369 const B2DVector aVector2(rTestPoint - rPointA);
2370 const double fDividend((aVector2.
getX() * aVector1.
getX()) + (aVector2.
getY() * aVector1.
getY()));
2371 const double fDivisor((aVector1.
getX() * aVector1.
getX()) + (aVector1.
getY() * aVector1.
getY()));
2372 const double fCut(fDividend / fDivisor);
2384 const B2DVector aVector(rTestPoint - rPointB);
2390 const B2DPoint aCutPoint(rPointA + fCut * aVector1);
2391 const B2DVector aVector(rTestPoint - aCutPoint);
2400 double fRetval(DBL_MAX);
2401 const sal_uInt32 nPointCount(rCandidate.
count());
2405 const double fZero(0.0);
2406 const sal_uInt32 nEdgeCount(rCandidate.
isClosed() ? nPointCount : nPointCount - 1);
2410 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
2412 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
2415 double fNewCut(0.0);
2416 bool bEdgeIsCurve(
false);
2435 if(fRetval == DBL_MAX || fEdgeDist < fRetval)
2437 fRetval = fEdgeDist;
2453 if(rtl::math::approxEqual(1.0, rCut))
2463 if(rEdgeIndex != nEdgeCount - 1)
2483 const double fRelativeX((rCandidate.
getX() - rOriginal.
getMinX()) / rOriginal.
getWidth());
2485 const double fOneMinusRelativeX(1.0 - fRelativeX);
2486 const double fOneMinusRelativeY(1.0 - fRelativeY);
2487 const double fNewX(fOneMinusRelativeY * (fOneMinusRelativeX * rTopLeft.
getX() + fRelativeX * rTopRight.
getX()) +
2488 fRelativeY * (fOneMinusRelativeX * rBottomLeft.
getX() + fRelativeX * rBottomRight.
getX()));
2489 const double fNewY(fOneMinusRelativeX * (fOneMinusRelativeY * rTopLeft.
getY() + fRelativeY * rBottomLeft.
getY()) +
2490 fRelativeX * (fOneMinusRelativeY * rTopRight.
getY() + fRelativeY * rBottomRight.
getY()));
2498 const sal_uInt32 nPointCount(rCandidate.
count());
2504 for(sal_uInt32
a(0);
a < nPointCount;
a++)
2535 for(sal_uInt32
a(0);
a < rCandidate.
count();
a++)
2545 OSL_ENSURE(
nIndex < rCandidate.
count(),
"expandToCurveInPoint: Access to polygon out of range (!)");
2546 bool bRetval(
false);
2547 const sal_uInt32 nPointCount(rCandidate.
count());
2560 const sal_uInt32 nPrevIndex((
nIndex + (nPointCount - 1)) % nPointCount);
2575 const sal_uInt32 nNextIndex((
nIndex + 1) % nPointCount);
2587 OSL_ENSURE(
nIndex < rCandidate.
count(),
"setContinuityInPoint: Access to polygon out of range (!)");
2588 bool bRetval(
false);
2589 const sal_uInt32 nPointCount(rCandidate.
count());
2608 const sal_uInt32 nPrevIndex((
nIndex + (nPointCount - 1)) % nPointCount);
2624 const sal_uInt32 nNextIndex((
nIndex + 1) % nPointCount);
2640 const double fLenPrev(aVectorPrev.
getLength());
2641 const double fLenNext(aVectorNext.
getLength());
2652 const sal_uInt32 nPrevIndex((
nIndex + (nPointCount - 1)) % nPointCount);
2653 const sal_uInt32 nNextIndex((
nIndex + 1) % nPointCount);
2658 aCurrentPoint + (aVectorPrev * fLenPrevEdge),
2659 aCurrentPoint + (aVectorNext * fLenNextEdge));
2671 aCurrentPoint - (aNormalizedPerpendicular * fLenPrev),
2672 aCurrentPoint + (aNormalizedPerpendicular * fLenNext));
2677 aCurrentPoint + (aNormalizedPerpendicular * fLenPrev),
2678 aCurrentPoint - (aNormalizedPerpendicular * fLenNext));
2693 const double fCommonLength((aVectorPrev.
getLength() + aVectorNext.
getLength()) / 2.0);
2701 const B2DVector aScaledDirection(aVectorPrev * fCommonLength);
2704 aCurrentPoint + aScaledDirection,
2705 aCurrentPoint - aScaledDirection);
2711 const B2DVector aPerpendicular(aNormalizedPerpendicular * fCommonLength);
2716 aCurrentPoint - aPerpendicular,
2717 aCurrentPoint + aPerpendicular);
2722 aCurrentPoint + aPerpendicular,
2723 aCurrentPoint - aPerpendicular);
2750 const sal_uInt32 nPointCount(rCandidate.
count());
2757 for(sal_uInt32
a(0);
a < nPointCount;
a++)
2760 const B2DVector aBack(aPrev - aCurrent);
2761 const B2DVector aForw(aNext - aCurrent);
2790 const sal_uInt32 nPointCount(rCandidate.
count());
2792 if(nPointCount && nSegments)
2795 const sal_uInt32 nSegmentCount(rCandidate.
isClosed() ? nPointCount : nPointCount - 1);
2797 if(nSegmentCount == nSegments)
2799 aRetval = rCandidate;
2803 const double fLength(
getLength(rCandidate));
2804 const sal_uInt32 nLoopCount(rCandidate.
isClosed() ? nSegments : nSegments + 1);
2806 for(sal_uInt32
a(0);
a < nLoopCount;
a++)
2808 const double fRelativePos(
static_cast<double>(
a) /
static_cast<double>(nSegments));
2810 aRetval.
append(aNewPoint);
2823 OSL_ENSURE(rOld1.
count() == rOld2.
count(),
"B2DPolygon interpolate: Different geometry (!)");
2839 for(sal_uInt32
a(0);
a < rOld1.
count();
a++)
2843 if(bInterpolateVectors)
2857 const sal_uInt32 nPointCount(rCandidate.
count());
2862 const sal_uInt32 nEdgeCount(rCandidate.
isClosed() ? nPointCount : nPointCount - 1);
2868 aRetval.
reserve( nEdgeCount+1);
2873 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
2876 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
2917 const sal_uInt32 nPointCount(rCandidate.
count());
2919 if(nPointCount > 2 && nIndexOfNewStatPoint != 0 && nIndexOfNewStatPoint < nPointCount)
2921 OSL_ENSURE(rCandidate.
isClosed(),
"makeStartPoint: only valid for closed polygons (!)");
2924 for(sal_uInt32
a(0);
a < nPointCount;
a++)
2926 const sal_uInt32 nSourceIndex((
a + nIndexOfNewStatPoint) % nPointCount);
2970 const sal_uInt32 nPointCount(aCandidate.
count());
2975 const sal_uInt32 nEdgeCount(aCandidate.
isClosed() ? nPointCount : nPointCount - 1);
2977 double fPositionInEdge(fStart);
2978 double fAbsolutePosition(fStart);
2980 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
2982 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
2984 const B2DVector aEdge(aNext - aCurrent);
2992 const double fScalar(fPositionInEdge / fEdgeLength);
2993 aRetval.
append(aCurrent + (aEdge * fScalar));
2994 fPositionInEdge += fLength;
2998 fAbsolutePosition += fLength;
3008 fPositionInEdge -= fEdgeLength;
3011 if(bEndActive &&
fTools::more(fAbsolutePosition, fEnd))
3026 aRetval = aCandidate;
3037 if(fWaveWidth < 0.0)
3042 if(fWaveHeight < 0.0)
3062 const sal_uInt32 nPointCount(aEqualLenghEdges.
count());
3068 aRetval.
append(aCurrent);
3070 for(sal_uInt32
a(0);
a < nPointCount - 1;
a++)
3072 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
3074 const B2DVector aEdge(aNext - aCurrent);
3076 const B2DVector aControlOffset((aEdge * 0.467308) - (aPerpendicular * fWaveHeight));
3080 aCurrent + aControlOffset,
3081 aNext - aControlOffset,
3092 aRetval = rCandidate;
3106 const sal_uInt32 nPointCount(rCandidate.
count());
3121 for(sal_uInt32
a(0);
a < nPointCount;
a++)
3124 const bool bLastRun(
a + 1 == nPointCount);
3125 const sal_uInt32 nNextIndex(bLastRun ? 0 :
a + 1);
3130 const bool bPrevVertical(aPrevTuple.
getX() == aCurrTuple.
getX());
3131 const bool bNextVertical(aNextTuple.
getX() == aCurrTuple.
getX());
3132 const bool bPrevHorizontal(aPrevTuple.
getY() == aCurrTuple.
getY());
3133 const bool bNextHorizontal(aNextTuple.
getY() == aCurrTuple.
getY());
3134 const bool bSnapX(bPrevVertical || bNextVertical);
3135 const bool bSnapY(bPrevHorizontal || bNextHorizontal);
3137 if(bSnapX || bSnapY)
3140 bSnapX ? aCurrTuple.
getX() : aCurrPoint.
getX(),
3141 bSnapY ? aCurrTuple.
getY() : aCurrPoint.
getY());
3149 aPrevTuple = aCurrTuple;
3150 aCurrPoint = aNextPoint;
3151 aCurrTuple = aNextTuple;
3175 const bool bClosed(rCandidate.
isClosed());
3219 const bool bClosed(rCandidate.
isClosed());
3220 sal_uInt32 nCurrent(
nIndex);
3238 nCurrent = bClosed ? (nCurrent + 1) %
nCount : nCurrent + 1 <
nCount ? nCurrent + 1 :
nIndex;
3240 while(nCurrent !=
nIndex);
3248 const css::drawing::PointSequence& rPointSequenceSource)
3251 const sal_uInt32
nLength(rPointSequenceSource.getLength());
3256 const css::awt::Point* pArray = rPointSequenceSource.getConstArray();
3257 const css::awt::Point* pArrayEnd = pArray + rPointSequenceSource.getLength();
3259 for(;pArray != pArrayEnd; pArray++)
3273 css::drawing::PointSequence& rPointSequenceRetval)
3279 OSL_ENSURE(
false,
"B2DPolygonToUnoPointSequence: Source contains bezier segments, wrong UNO API data type may be used (!)");
3283 const sal_uInt32 nPointCount(aPolygon.
count());
3290 const bool bIsClosed(aPolygon.
isClosed());
3292 rPointSequenceRetval.realloc(bIsClosed ? nPointCount + 1 : nPointCount);
3293 css::awt::Point* pSequence = rPointSequenceRetval.getArray();
3295 for(sal_uInt32 b(0); b < nPointCount; b++)
3300 *pSequence = aAPIPoint;
3307 *pSequence = *rPointSequenceRetval.getConstArray();
3312 rPointSequenceRetval.realloc(0);
3320 const css::drawing::PointSequence& rPointSequenceSource,
3321 const css::drawing::FlagSequence& rFlagSequenceSource)
3323 const sal_uInt32
nCount(
static_cast<sal_uInt32
>(rPointSequenceSource.getLength()));
3324 OSL_ENSURE(
nCount ==
static_cast<sal_uInt32
>(rFlagSequenceSource.getLength()),
3325 "UnoPolygonBezierCoordsToB2DPolygon: Unequal count of Points and Flags (!)");
3334 const css::awt::Point* pPointSequence = rPointSequenceSource.getConstArray();
3335 const css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceSource.getConstArray();
3338 B2DPoint aNewCoordinatePair(pPointSequence->X, pPointSequence->Y); pPointSequence++;
3339 css::drawing::PolygonFlags ePolygonFlag(*pFlagSequence); pFlagSequence++;
3344 OSL_ENSURE(ePolygonFlag != css::drawing::PolygonFlags_CONTROL,
3345 "UnoPolygonBezierCoordsToB2DPolygon: Start point is a control point, illegal input polygon (!)");
3348 aRetval.
append(aNewCoordinatePair);
3350 for(sal_uInt32 b(1); b <
nCount;)
3353 bool bControlA(
false);
3354 bool bControlB(
false);
3357 aNewCoordinatePair =
B2DPoint(pPointSequence->X, pPointSequence->Y);
3358 ePolygonFlag = *pFlagSequence;
3359 pPointSequence++; pFlagSequence++; b++;
3361 if(b <
nCount && ePolygonFlag == css::drawing::PolygonFlags_CONTROL)
3363 aControlA = aNewCoordinatePair;
3367 aNewCoordinatePair =
B2DPoint(pPointSequence->X, pPointSequence->Y);
3368 ePolygonFlag = *pFlagSequence;
3369 pPointSequence++; pFlagSequence++; b++;
3372 if(b <
nCount && ePolygonFlag == css::drawing::PolygonFlags_CONTROL)
3374 aControlB = aNewCoordinatePair;
3378 aNewCoordinatePair =
B2DPoint(pPointSequence->X, pPointSequence->Y);
3379 ePolygonFlag = *pFlagSequence;
3380 pPointSequence++; pFlagSequence++; b++;
3385 SAL_WARN_IF(ePolygonFlag == css::drawing::PolygonFlags_CONTROL || bControlA != bControlB,
3386 "basegfx",
"UnoPolygonBezierCoordsToB2DPolygon: Illegal source polygon (!)");
3397 && aControlA.
equal(aControlB)
3411 aRetval.
append(aNewCoordinatePair);
3425 css::drawing::PointSequence& rPointSequenceRetval,
3426 css::drawing::FlagSequence& rFlagSequenceRetval)
3428 const sal_uInt32 nPointCount(rPolygon.
count());
3433 const bool bClosed(rPolygon.
isClosed());
3438 const sal_uInt32 nLoopCount(bClosed ? nPointCount : nPointCount - 1);
3444 std::vector< css::awt::Point > aCollectPoints;
3445 std::vector< css::drawing::PolygonFlags > aCollectFlags;
3448 const sal_uInt32 nMaxTargetCount((nLoopCount * 3) + 1);
3449 aCollectPoints.reserve(nMaxTargetCount);
3450 aCollectFlags.reserve(nMaxTargetCount);
3456 for(sal_uInt32
a(0);
a < nLoopCount;
a++)
3459 const sal_uInt32 nStartPointIndex(aCollectPoints.size());
3460 aCollectPoints.emplace_back(
3463 aCollectFlags.push_back(css::drawing::PolygonFlags_NORMAL);
3466 const sal_uInt32 nNextIndex((
a + 1) % nPointCount);
3474 aCollectPoints.emplace_back(
3477 aCollectFlags.push_back(css::drawing::PolygonFlags_CONTROL);
3479 aCollectPoints.emplace_back(
3482 aCollectFlags.push_back(css::drawing::PolygonFlags_CONTROL);
3492 aCollectFlags[nStartPointIndex] = css::drawing::PolygonFlags_SMOOTH;
3496 aCollectFlags[nStartPointIndex] = css::drawing::PolygonFlags_SYMMETRIC;
3507 aCollectPoints.push_back(aCollectPoints[0]);
3508 aCollectFlags.push_back(css::drawing::PolygonFlags_NORMAL);
3514 aCollectPoints.emplace_back(
3517 aCollectFlags.push_back(css::drawing::PolygonFlags_NORMAL);
3521 const sal_uInt32 nTargetCount(aCollectPoints.size());
3522 OSL_ENSURE(nTargetCount == aCollectFlags.size(),
"Unequal Point and Flag count (!)");
3524 rPointSequenceRetval.realloc(
static_cast<sal_Int32
>(nTargetCount));
3525 rFlagSequenceRetval.realloc(
static_cast<sal_Int32
>(nTargetCount));
3526 css::awt::Point* pPointSequence = rPointSequenceRetval.getArray();
3527 css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceRetval.getArray();
3529 for(sal_uInt32
a(0);
a < nTargetCount;
a++)
3531 *pPointSequence = aCollectPoints[
a];
3532 *pFlagSequence = aCollectFlags[
a];
3541 const sal_uInt32 nTargetCount(nPointCount + (bClosed ? 1 : 0));
3543 rPointSequenceRetval.realloc(
static_cast<sal_Int32
>(nTargetCount));
3544 rFlagSequenceRetval.realloc(
static_cast<sal_Int32
>(nTargetCount));
3546 css::awt::Point* pPointSequence = rPointSequenceRetval.getArray();
3547 css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceRetval.getArray();
3549 for(sal_uInt32
a(0);
a < nPointCount;
a++)
3552 const css::awt::Point aAPIPoint(
3556 *pPointSequence = aAPIPoint;
3557 *pFlagSequence = css::drawing::PolygonFlags_NORMAL;
3565 *pPointSequence = *rPointSequenceRetval.getConstArray();
3566 *pFlagSequence = css::drawing::PolygonFlags_NORMAL;
3572 rPointSequenceRetval.realloc(0);
3573 rFlagSequenceRetval.realloc(0);
double distanceToRelative(double fDistance) const
void setStartPoint(const B2DPoint &rValue)
const B2DPoint & getStartPoint() const
SAL_DLLPRIVATE B2DCubicBezier snippet(double fStart, double fEnd) const
const B2DPoint & getControlPointB() const
SAL_DLLPRIVATE void adaptiveSubdivideByAngle(B2DPolygon &rTarget, double fAngleBound) const
adaptive subdivide by angle criteria no start point is added, but all necessary created edges and the...
double getLength(double fDeviation=0.01) const
get length of edge
SAL_DLLPRIVATE double getSmallestDistancePointToBezierSegment(const B2DPoint &rTestPoint, double &rCut) const
void setControlPointA(const B2DPoint &rValue)
void setEndPoint(const B2DPoint &rValue)
void setControlPointB(const B2DPoint &rValue)
B2DPoint interpolatePoint(double t) const
void testAndSolveTrivialBezier()
void split(double t, B2DCubicBezier *pBezierA, B2DCubicBezier *pBezierB) const
const B2DPoint & getEndPoint() const
const B2DPoint & getControlPointA() const
SAL_DLLPRIVATE double getControlPolygonLength() const
B2DVector getTangent(double t) const
get the tangent in point t
SAL_DLLPRIVATE double getEdgeLength() const
void adaptiveSubdivideByDistance(B2DPolygon &rTarget, double fDistanceBound, int nRecurseLimit=30) const
Subdivide cubic bezier segment.
Base Point class with two double values.
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
bool isPrevControlPointUsed(sal_uInt32 nIndex) const
void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint &rValue)
bool isNextControlPointUsed(sal_uInt32 nIndex) const
void clear()
clear all points
void resetNextControlPoint(sal_uInt32 nIndex)
void setPrevControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint &rValue)
bool isClosed() const
closed state interface
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
Coordinate interface.
void transform(const basegfx::B2DHomMatrix &rMatrix)
apply transformation given in matrix form
void getBezierSegment(sal_uInt32 nIndex, B2DCubicBezier &rTarget) const
bezier segment access
void setNextControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint &rValue)
basegfx::B2DPoint getPrevControlPoint(sal_uInt32 nIndex) const
Basic ControlPoint interface.
void setControlPoints(sal_uInt32 nIndex, const basegfx::B2DPoint &rPrev, const basegfx::B2DPoint &rNext)
bool areControlPointsUsed() const
ControlPoint checks.
B2VectorContinuity getContinuityInPoint(sal_uInt32 nIndex) const
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void reserve(sal_uInt32 nCount)
B2DRange const & getB2DRange() const
Get the B2DRange (Rectangle dimensions) of this B2DPolygon.
void removeDoublePoints()
remove double points, at the begin/end and follow-ups, too
sal_uInt32 count() const
member count
void setClosed(bool bNew)
B2DPolygon const & getDefaultAdaptiveSubdivision() const
Default adaptive subdivision access.
void resetPrevControlPoint(sal_uInt32 nIndex)
ControlPoint resets.
void remove(sal_uInt32 nIndex, sal_uInt32 nCount=1)
remove points
basegfx::B2DPoint getNextControlPoint(sal_uInt32 nIndex) const
void appendBezierSegment(const basegfx::B2DPoint &rNextControlPoint, const basegfx::B2DPoint &rPrevControlPoint, const basegfx::B2DPoint &rPoint)
Bezier segment append with control points. The current last polygon point is implicitly taken as star...
A two-dimensional interval over doubles.
B2DPoint getCenter() const
return center point of set. returns (0,0) for empty sets.
Base Point class with two double values.
B2DVector & normalize()
Normalize this 2D Vector.
double scalar(const B2DVector &rVec) const
Calculate the Scalar with another 2D Vector.
double cross(const B2DVector &rVec) const
Calculate the length of the cross product with another 2D Vector.
double getLength() const
Calculate the length of this 2D Vector.
Base class for all Points/Vectors with two sal_Int32 values.
Base Point class with three double values.
void append(const B3DPoint &rPoint, sal_uInt32 nCount=1)
B3DPoint const & getB3DPoint(sal_uInt32 nIndex) const
void setClosed(bool bNew)
TYPE getMaxX() const
get upper bound of the set. returns arbitrary values for empty sets.
TYPE getWidth() const
return difference between upper and lower X value. returns 0 for empty sets.
TYPE getMinX() const
get lower bound of the set. returns arbitrary values for empty sets.
TYPE getMinY() const
get lower bound of the set. returns arbitrary values for empty sets.
TYPE getMaxY() const
get upper bound of the set. returns arbitrary values for empty sets.
TYPE getHeight() const
return difference between upper and lower Y value. returns 0 for empty sets.
bool equal(const Tuple2D< TYPE > &rTup) const
TYPE getX() const
Get X-Coordinate of 2D Tuple.
TYPE getY() const
Get Y-Coordinate of 2D Tuple.
TYPE getX() const
Get X-Coordinate of 3D Tuple.
TYPE getY() const
Get Y-Coordinate of 3D Tuple.
#define SAL_WARN_IF(condition, area, stream)
::std::vector< B2DTriangle > B2DTriangleVector
B2DPolygon removeNeutralPoints(const B2DPolygon &rCandidate)
double getArea(const B2DPolygon &rCandidate)
B2VectorContinuity getContinuityInPoint(const B2DPolygon &rCandidate, sal_uInt32 nIndex)
bool isPointOnLine(const B2DPoint &rStart, const B2DPoint &rEnd, const B2DPoint &rCandidate, bool bWithPoints)
B2DPolygon const & createHalfUnitCircle()
create half circle centered on (0,0) from [0 .. M_PI]
static void implHandleSnippet(const B2DPolygon &rSnippet, const std::function< void(const basegfx::B2DPolygon &rSnippet)> &rTargetCallback, B2DPolygon &rFirst, B2DPolygon &rLast)
CutFlagValue findCut(const B2DPoint &rEdge1Start, const B2DVector &rEdge1Delta, const B2DPoint &rEdge2Start, const B2DVector &rEdge2Delta, CutFlagValue aCutFlags, double *pCut1, double *pCut2)
void addTriangleFan(const B2DPolygon &rCandidate, triangulator::B2DTriangleVector &rTarget)
double getLength(const B2DPolygon &rCandidate)
get length of polygon
bool arePointsOnSameSideOfLine(const B2DPoint &rStart, const B2DPoint &rEnd, const B2DPoint &rCandidateA, const B2DPoint &rCandidateB, bool bWithLine)
B2DPolygon reSegmentPolygon(const B2DPolygon &rCandidate, sal_uInt32 nSegments)
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
B2DPolygon createEdgesOfGivenLength(const B2DPolygon &rCandidate, double fLength, double fStart, double fEnd)
create edges of given length along given B2DPolygon
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
Create a polygon from a rectangle.
B2DPolygon UnoPointSequenceToB2DPolygon(const css::drawing::PointSequence &rPointSequenceSource)
converters for css::drawing::PointSequence
B2DPolygon interpolate(const B2DPolygon &rOld1, const B2DPolygon &rOld2, double t)
B2DPolygon expandToCurve(const B2DPolygon &rCandidate)
B2DPolygon growInNormalDirection(const B2DPolygon &rCandidate, double fValue)
double getSmallestDistancePointToEdge(const B2DPoint &rPointA, const B2DPoint &rPointB, const B2DPoint &rTestPoint, double &rCut)
B2DPoint getPositionAbsolute(const B2DPolygon &rCandidate, double fDistance, double fLength)
B2DPolygon adaptiveSubdivideByDistance(const B2DPolygon &rCandidate, double fDistanceBound, int nRecurseLimit)
void applyLineDashing(const B2DPolygon &rCandidate, const std::vector< double > &rDotDashArray, B2DPolyPolygon *pLineTarget, B2DPolyPolygon *pGapTarget, double fDotDashLength)
sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B2DPolygon &rCandidate)
B2VectorOrientation getOrientationForIndex(const B2DPolygon &rCandidate, sal_uInt32 nIndex)
B2VectorOrientation getOrientation(const B2DPolygon &rCandidate)
B2DPolygon const & createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant)
create a polygon which describes the unit circle and close it
double getSignedArea(const B2DPolygon &rCandidate)
bool isInside(const B2DPolygon &rCandidate, const B2DPoint &rPoint, bool bWithBorder)
B2DPoint distort(const B2DPoint &rCandidate, const B2DRange &rOriginal, const B2DPoint &rTopLeft, const B2DPoint &rTopRight, const B2DPoint &rBottomLeft, const B2DPoint &rBottomRight)
B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon &rCandidate, double fAngleBound)
B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon &rCandidate, double fZCoordinate)
B2DPolygon createWaveline(const B2DPolygon &rCandidate, double fWaveWidth, double fWaveHeight)
Create Waveline along given polygon The implementation is based on createEdgesOfGivenLength and creat...
void B2DPolygonToUnoPolygonBezierCoords(const B2DPolygon &rPolygon, css::drawing::PointSequence &rPointSequenceRetval, css::drawing::FlagSequence &rFlagSequenceRetval)
B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon &rCandidate)
snap some polygon coordinates to discrete coordinates
B2DPolygon createPolygonFromCircle(const B2DPoint &rCenter, double fRadius)
Create a circle polygon with given radius.
void closeWithGeometryChange(B2DPolygon &rCandidate)
bool isPointOnPolygon(const B2DPolygon &rCandidate, const B2DPoint &rPoint, bool bWithPoints)
bool expandToCurveInPoint(B2DPolygon &rCandidate, sal_uInt32 nIndex)
bool isInEpsilonRange(const B2DPoint &rEdgeStart, const B2DPoint &rEdgeEnd, const B2DPoint &rTestPosition, double fDistance)
bool isPointOnEdge(const B2DPoint &rPoint, const B2DPoint &rEdgeStart, const B2DVector &rEdgeDelta, double *pCut)
B2DPolygon createB2DPolygonFromB3DPolygon(const B3DPolygon &rCandidate, const B3DHomMatrix &rMat)
bool isRectangle(const B2DPolygon &rPoly)
Predicate whether a given polygon is a rectangle.
static B2DPolygon impCreateUnitCircle(sal_uInt32 nStartQuadrant)
void openWithGeometryChange(B2DPolygon &rCandidate)
sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const B2DPolygon &rCandidate)
B2DVector getTangentLeavingPoint(const B2DPolygon &rCandidate, sal_uInt32 nIndex)
get the tangent with which the given point is left seen from the following polygon path data.
B2DPolygon getSnippetAbsolute(const B2DPolygon &rCandidate, double fFrom, double fTo, double fLength)
static double impDistanceBezierPointToControl(double fAngle)
B2DPolygon createPolygonFromEllipseSegment(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd)
Create a unit ellipse polygon with the given angles, from start to end.
bool hasNeutralPoints(const B2DPolygon &rCandidate)
B2DPoint getPositionRelative(const B2DPolygon &rCandidate, double fDistance, double fLength)
void B2DPolygonToUnoPointSequence(const B2DPolygon &rPolygon, css::drawing::PointSequence &rPointSequenceRetval)
B2DVector getTangentEnteringPoint(const B2DPolygon &rCandidate, sal_uInt32 nIndex)
get the tangent with which the given point is entered seen from the previous polygon path data.
double getEdgeLength(const B2DPolygon &rCandidate, sal_uInt32 nIndex)
get length of polygon edge from point nIndex to nIndex + 1
B2DHomMatrix createRotateB2DHomMatrix(double fRadiant)
double getSmallestDistancePointToPolygon(const B2DPolygon &rCandidate, const B2DPoint &rTestPoint, sal_uInt32 &rEdgeIndex, double &rCut)
bool setContinuityInPoint(B2DPolygon &rCandidate, sal_uInt32 nIndex, B2VectorContinuity eContinuity)
B2DPolygon simplifyCurveSegments(const B2DPolygon &rCandidate)
B2DPolygon UnoPolygonBezierCoordsToB2DPolygon(const css::drawing::PointSequence &rPointSequenceSource, const css::drawing::FlagSequence &rFlagSequenceSource)
static void implHandleFirstLast(const std::function< void(const basegfx::B2DPolygon &rSnippet)> &rTargetCallback, B2DPolygon &rFirst, B2DPolygon &rLast)
bool isConvex(const B2DPolygon &rCandidate)
B2DPolygon const & createUnitPolygon()
Create the unit polygon.
B2DPolygon createPolygonFromEllipse(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, sal_uInt32 nStartQuadrant)
Create an ellipse polygon with given radii.
void checkClosed(B2DPolygon &rCandidate)
Check if given polygon is closed.
B2DPolygon createPolygonFromUnitEllipseSegment(double fStart, double fEnd)
B2DPolygon makeStartPoint(const B2DPolygon &rCandidate, sal_uInt32 nIndexOfNewStatPoint)
bool isPointInTriangle(const B2DPoint &rA, const B2DPoint &rB, const B2DPoint &rC, const B2DPoint &rCandidate, bool bWithBorder)
B2DRange getRange(const B2DPolygon &rCandidate)
Get the range of a polygon.
B2VectorContinuity
Descriptor for the mathematical continuity of two 2D Vectors.
@ C1
mathematically negative oriented
@ C2
mathematically neutral, thus parallel
bool areParallel(const B2DVector &rVecA, const B2DVector &rVecB)
Test two vectors which need not to be normalized for parallelism.
B2VectorOrientation
Descriptor for the mathematical orientations of two 2D Vectors.
@ Positive
mathematically positive oriented
@ Neutral
mathematically neutral, thus parallel
@ Negative
mathematically negative oriented
B2DVector getNormalizedPerpendicular(const B2DVector &rVec)
Calculate a perpendicular 2D Vector to the given one, normalize the given one as preparation.
B2DVector getPerpendicular(const B2DVector &rNormalizedVec)
Calculate a perpendicular 2D Vector to the given one.
B2IRange fround(const B2DRange &rRange)
Round double to nearest integer for 2D range.
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
css::drawing::Direction3D aDirection