36 if(rCandidate.
count())
46 aRetval.
append(rCandidate);
55 aRetval.
append(rCandidate);
64 aRetval.
append(rCandidate);
73 aRetval.
append(rCandidate);
83 const double fSmallExtension((aCandidateRange.
getWidth() + aCandidateRange.
getHeight()) * (0.5 * 0.1));
85 bParallelToXAxis ? aCandidateRange.
getMinX() - fSmallExtension : fValueOnOtherAxis,
86 bParallelToXAxis ? fValueOnOtherAxis : aCandidateRange.
getMinY() - fSmallExtension);
88 bParallelToXAxis ? aCandidateRange.
getMaxX() + fSmallExtension : fValueOnOtherAxis,
89 bParallelToXAxis ? fValueOnOtherAxis : aCandidateRange.
getMaxY() + fSmallExtension);
91 const sal_uInt32 nPointCount(aCandidate.
count());
92 const sal_uInt32 nEdgeCount(aCandidate.
isClosed() ? nPointCount : nPointCount - 1);
96 for(sal_uInt32
a(0);
a < nEdgeCount;
a++)
100 const bool bInside(bParallelToXAxis ?
122 if(bStroke && aRun.
count())
167 for(
const auto& rB2DPolygon : rCandidate )
171 if(aClippedPolyPolygon.
count())
173 aRetval.
append(aClippedPolyPolygon);
207 if(rRange.
isInside(aCandidateRange))
245 if(aRetval.
count() == 1)
257 if(aRetval.
count() == 1)
269 if(aRetval.
count() == 1)
288 if(!rCandidate.
count())
310 for(
const auto& rClippedPoly : rCandidate)
314 if(aClippedPolyPolygon.
count())
316 aRetval.
append(aClippedPolyPolygon);
333 bool bInside,
bool bStroke,
size_t* pPointLimit)
346 for(
const auto& rPolygon : rCandidate)
350 const sal_uInt32 nPointCount(aCandidate.
count());
351 const sal_uInt32 nEdgeCount(aCandidate.
isClosed() ? nPointCount : nPointCount - 1);
355 for(sal_uInt32 b(0); b < nEdgeCount; b++)
431 if(aIntersectionRange.
isEmpty())
469 aMergePolyPolygonA.
flip();
476 if (pPointLimit && !*pPointLimit)
478 SAL_WARN(
"basegfx",
"clipPolyPolygonOnPolyPolygon hit point limit");
488 aRetval.
append(aMergePolyPolygonA);
489 aRetval.
append(aMergePolyPolygonB);
540 struct scissor_plane {
563 scissor_plane
const *pPlane,
567 sal_uInt32 out_count=0;
570 for(sal_uInt32
i=0;
i<in_count;
i++) {
581 out_vertex[out_count++] = *next;
583 else if((clip&0x0f) && (clip&0xf0)) {
585 else if((clip&0x0f) && (clip&0xf0)==0) {
591 double denominator = pPlane->nx*dir.
getX() +
592 pPlane->ny*dir.
getY();
593 double numerator = pPlane->nx*curr->
getX() +
594 pPlane->ny*curr->
getY() +
596 double t = -numerator/denominator;
602 out_vertex[out_count++] = intersection;
604 else if((clip&0x0f)==0 && (clip&0xf0)) {
610 double denominator = pPlane->nx*dir.
getX() +
611 pPlane->ny*dir.
getY();
612 double numerator = pPlane->nx*curr->
getX() +
613 pPlane->ny*curr->
getY() +
615 double t = -numerator/denominator;
621 out_vertex[out_count++] = intersection;
622 out_vertex[out_count++] = *next;
634 if( !(rCandidate.
count()%3) )
636 const int scissor_plane_count = 4;
638 scissor_plane sp[scissor_plane_count];
658 const sal_uInt32 nVertexCount = rCandidate.
count();
757 unsigned int clipflag = 0;
767 clipflag |= unsigned(!(rRange.
isInside(stack[2])));
781 sal_uInt32 vertex_count = 3;
790 if(vertex_count >= 3)
795 for(sal_uInt32
i=2;
i<vertex_count; ++
i)
const B2DPoint & getStartPoint() const
const B2DPoint & getControlPointB() const
B2DPoint interpolatePoint(double t) const
const B2DPoint & getEndPoint() const
const B2DPoint & getControlPointA() const
Base Point class with two double values.
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
B2DRange getB2DRange() const
Get the B2DRange (Rectangle dimensions) of this B2DPolyPolygon.
void remove(sal_uInt32 nIndex, sal_uInt32 nCount=1)
void clear()
clear all points
bool isClosed() const
closed state interface
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
Coordinate interface.
void getBezierSegment(sal_uInt32 nIndex, B2DCubicBezier &rTarget) const
bezier segment access
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void removeDoublePoints()
remove double points, at the begin/end and follow-ups, too
sal_uInt32 count() const
member count
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.
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.
void intersect(const Range2D &rRange)
calc set intersection
bool isInside(const Tuple2D< TYPE > &rTuple) const
yields true if given point is contained in set
bool isEmpty() const
Check if the interval set is empty.
bool equal(const Range2D &rRange) const
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.
#define SAL_WARN(area, stream)
B2DPolygon addPointsAtCuts(const B2DPolygon &rCandidate, const B2DPoint &rStart, const B2DPoint &rEnd)
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
Create a polygon from a rectangle.
B2DPolyPolygon clipPolyPolygonOnRange(const B2DPolyPolygon &rCandidate, const B2DRange &rRange, bool bInside, bool bStroke)
bool isInside(const B2DPolygon &rCandidate, const B2DPoint &rPoint, bool bWithBorder)
sal_uInt32 getCohenSutherlandClipFlags(const Point &rP, const Rect &rR)
Calc clip mask for Cohen-Sutherland rectangle clip.
B2DPolyPolygon correctOrientations(const B2DPolyPolygon &rCandidate)
static sal_uInt32 scissorLineSegment(::basegfx::B2DPoint *in_vertex, sal_uInt32 in_count, ::basegfx::B2DPoint *out_vertex, scissor_plane const *pPlane, const ::basegfx::B2DRectangle &rR)
B2DPolygon clipTriangleListOnRange(const B2DPolygon &rCandidate, const B2DRange &rRange)
void closeWithGeometryChange(B2DPolygon &rCandidate)
B2DPolyPolygon stripNeutralPolygons(const B2DPolyPolygon &rCandidate)
Strip neutral polygons from PolyPolygon.
bool isRectangle(const B2DPolygon &rPoly)
Predicate whether a given polygon is a rectangle.
B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon &rCandidate, const B2DPolyPolygon &rClip, bool bInside, bool bStroke, size_t *pPointLimit)
B2DPolyPolygon clipPolygonOnPolyPolygon(const B2DPolygon &rCandidate, const B2DPolyPolygon &rClip, bool bInside, bool bStroke)
B2DPolyPolygon clipPolygonOnParallelAxis(const B2DPolygon &rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke)
B2DPolyPolygon solveCrossovers(const B2DPolyPolygon &rCandidate, size_t *pPointLimit)
Solve all crossovers (aka self-intersections) in a polyPolygon.
B2DPolyPolygon clipPolyPolygonOnParallelAxis(const B2DPolyPolygon &rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke)
B2DPolyPolygon stripDispensablePolygons(const B2DPolyPolygon &rCandidate, bool bKeepAboveZero)
Remove unnecessary/non-displayed polygons.
B2DPolyPolygon clipPolygonOnRange(const B2DPolygon &rCandidate, const B2DRange &rRange, bool bInside, bool bStroke)
B2DRange getRange(const B2DPolygon &rCandidate)
Get the range of a polygon.
B2DRange B2DRectangle
Alias name for interface clarity (not everybody is aware of the identity)