Comments (3)
the red clip rect is long and narrow and it should not appear in the solution.
The red clip rect region was only included in the image above to show the location of the clipping rect.
It's not part of the solution.
The only parts of the solution in the image above are the 4 dark green very narrow rectangles.
These correspond to the 4 regions indicated by the coordinates in the box immediately above the image.
the solution's bounding box should have similar width and height as the rect, for below unittest, it will fail.
RectClip is an INTERSECTION operation so the solution will only be those regions where subject and clip rectangle overlap. So in this case, the width of a rectangle that bounds the solution would be considerably smaller than the width of the clip rect itself.
from clipper2.
void Test()
{
Paths64 sub, clp, sol;
Rect64 rect;
sub.push_back(MakePath({ 559306,72464, 559090,72464, 559090,72454, 558178,72454, 558178,72464,
557962,72464, 557962,72284, 558534,72284, 558534,72274, 558734,72274,
558734,72284, 559306,72284 }));
sub.push_back(MakePath({ 557306,72464, 557090,72464, 557090,72454, 556178,72454, 556178,72464,
555962,72464, 555962,72284, 556534,72284, 556534,72274, 556734,72274,
556734,72284, 557306,72284 }));
rect = Rect64(551604, 72454, 560834, 72459);
sol = ExecuteRectClip(rect, sub, false);
std::cout << sol << std::endl;
clp.push_back(rect.AsPath());
SvgWriter svg;
SvgAddSubject(svg, sub, FillRule::NonZero);
SvgAddClip(svg, clp, FillRule::NonZero);
SvgAddSolution(svg, sol, FillRule::NonZero, false);
SvgSaveToFile(svg, "c:\\temp\\tmp.svg", 600,600);
System("c:\\temp\\tmp.svg");
}
Looks fine to me.
558178,72454 , 558178,72459 , 557962,72459 , 557962,72454
559306,72454 , 559306,72459 , 559090,72459 , 559090,72454
556178,72454 , 556178,72459 , 555962,72459 , 555962,72454
557306,72454 , 557306,72459 , 557090,72459 , 557090,72454
from clipper2.
@AngusJohnson the red clip rect is long and narrow and it should not appear in the solution. the solution's bounding box should have similar width and height as the rect, for below unittest, it will fail.
Paths64 sub, sol;
Rect64 rect;
sub.push_back(MakePath({559306,72464, 559090,72464, 559090,72454, 558178,72454, 558178,72464,
557962,72464, 557962,72284, 558534,72284, 558534,72274, 558734,72274,
558734,72284, 559306,72284}));
sub.push_back(MakePath({ 557306,72464, 557090,72464, 557090,72454, 556178,72454, 556178,72464,
555962,72464, 555962,72284, 556534,72284, 556534,72274, 556734,72274,
556734,72284, 557306,72284 }));
rect = Rect64(551604, 72454, 560834, 72459);
sol = ExecuteRectClip(rect, sub, false);
const auto sol_bounds = GetBounds(sol);
EXPECT_EQ(sol_bounds.Width(), rect.Width());
EXPECT_EQ(sol_bounds.Height(), rect.Height());
from clipper2.
Related Issues (20)
- Regression when removing type casting in IsCollinear() HOT 4
- Minkowski in export header HOT 4
- Clipper2 slower than clipper1 HOT 2
- New release? HOT 1
- can this library cut a hole in a polygon?
- How to handle path value of double type HOT 1
- [new API request] API using PolyTree for RectClip HOT 1
- Dose Clipper support to get Inscribed rectangle ?
- How Clipper2 is used in iOS project(Cocoaspod)
- Union returns self-intersecting polygon HOT 1
- Why is Rect empty when bottom <= top?
- Union of forms that touch but don't intersect
- Union of forms that share an edge
- Empty polytree when taking the union of 3 closed polygons. HOT 6
- Is there a plan for the clipper to support circular arc structures
- `RectClip` not always preserving orientation HOT 3
- Range error in TClipperOffset.BuildNormals (Delphi) HOT 1
- update vcpkg & docs HOT 1
- Negative offset should be empty but is not HOT 4
- Handling Large Shrinking Deltas for Polygons
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clipper2.