Comments (8)
I don't understand your test-case. usually there are two polygons (A and B) and they result in a third polygon (the NFP). I tried to generate the NFP with the data of rotated_0 and rotated_1 and it works.
Could you maybe post the exact test-case that fails and how you invoke it?
from libnfporb.
basically it checks if a translation would lead to an immediate (and unwanted) intersection of the two polygons. do you have a concrete test-case?
from libnfporb.
……
double angle_double = (double)angle * 3.14 / 180;
libnfporb::polygon_t new_polygons;
auto& points = individual.GetPolygonsOuter();
for (int idx = 0; idx < points.size(); idx++) {
libnfporb::coord_t x = points[idx].x_;
libnfporb::coord_t y = points[idx].y_;
libnfporb::coord_t new_x = x * (libnfporb::coord_t)cos(angle) - y * (libnfporb::coord_t)sin(angle);
libnfporb::coord_t new_y = x * (libnfporb::coord_t)sin(angle) + y * (libnfporb::coord_t)cos(angle);
bg::append(new_polygons.outer(), libnfporb::point_t::point_t(new_x, new_y));
}
……
I rotated the numbers in your data/generated like this code.
I can't upload wkt files. (Github don't support that file type.)
So I copy them here.
rotated_0.wkt :
POLYGON ((640 128, 882 0, 1152 388, 1152 736, 1152 1084, 882 1472, 640 1472, 399 1472, 128 1084, 128 736, 128 388, 399 0, 640 0, 479 128, 320 430, 320 736, 320 1042, 479 1344, 640 1344, 801 1344, 960 1042, 960 736, 960 430, 801 128, 640 128))
rotated_1.wkt :
POLYGON ((320 0, 1024 0, 1024 128, 768 128, 768 1472, 627 1472, 256 1216, 256 1061, 576 1281, 576 128, 320 128, 320 0))
rotated_d.wkt :
POLYGON ((1088 128, 896 310, 748 128, 608 128, 466 128, 320 339, 320 544, 320 751, 466 960, 608 960, 748 960, 896 767, 896 585, 896 484, 1088 1536, 704 1536, 704 1408, 896 1408, 896 884, 843 989, 681 1088, 561 1088, 369 1088, 128 787, 128 544, 128 302, 370 0, 561 0, 681 0, 843 90, 896 185, 896 0, 1280 0, 1280 128, 1088 128))
Please test them. thx!
from libnfporb.
Sorry...I misplaced these files.
rotated_0.wkt :
POLYGON ((-401.19868726354025 514.80444183982331, -395.20092942592805 788.50505729569204, -863.05151125782049 856.03159340972456, -1174.1623501908145 700.10197499677338, -1485.2731891238086 544.17235658382219, -1711.1640182459491 128.94069435355357, -1602.7302031426900 -87.406498237781420, -1494.7444616555599 -302.85969416551592, -1026.4458062075385 -371.28022694314905, -715.33496727454428 -215.35060853019783, -404.22412834155023 -59.420990117246618, -178.78137283553889 356.70466877662255, -286.76711432266887 572.15786470435705, -329.05883506674388 370.87097900013339, -527.80212250957436 93.407277416635367, -801.36510157134501 -43.703249118890710, -1074.9280806331158 -180.81377565441676, -1416.1587780050222 -173.98653821293743, -1488.2986302018187 -30.053075373247566, -1560.4384823986152 113.88038746644224, -1361.6951949557847 391.34408904994029, -1088.1322158940138 528.45461558546640, -814.56923683224318 665.56514212099239, -473.33853946033673 658.73790467951312, -401.19868726354025 514.80444183982331))
rotated_1.wkt :
POLYGON ((-143.38355716133444 286.07893235217853, -458.82738291627021 915.45258352697124, -573.25895585714159 858.09916066243750, -458.55211012807410 629.23601478069463, -1660.0836260072238 27.025074703089899, -1596.9052461330107 -99.028454864588753, -1201.8067886673459 -315.99437133132807, -1063.2373058092594 -246.54296083130669, -1403.3001289627166 -59.040224027545605, -372.52197583127338 457.58865536938748, -257.81513010220584 228.72550948764476, -143.38355716133444 286.07893235217853))
I tried to generate the NFP with the data of rotated_0 and rotated_1 .
rotated_0 is A polygon, rotated_1 is B polygon.
When the program runs to find_feasible.hpp (can't printf next19.svg) , the vectors returned are empty.
from libnfporb.
Please leave ‘rotated_d.wkt’ alone, now don't care it...
from libnfporb.
from libnfporb.
Thanks for spotting this bug! It was caused by a regression that had to do with negative coordinates (see #20). Fixed c056f47
from libnfporb.
Thank you!!
from libnfporb.
Related Issues (20)
- Bad assumptions HOT 3
- Running nfp without boost and libgmp HOT 1
- Is it possible to get an example file without reading .wkt files? HOT 8
- How to rotate polygon_t using boost rotate_transformer?
- How to choose the reference point? HOT 1
- boost version HOT 1
- generateNFP only returns singular points HOT 3
- Runtime error: No touching points with certain simple geometry HOT 3
- Why some results seem to miss a part? HOT 7
- Edge case false positive degenerate case HOT 3
- numerical error prevents discovery of the next slide vector HOT 2
- history based loop prevention allows for oscillation HOT 1
- How to generate the inner fit polygon? HOT 1
- Big files cause a sever performance penalty HOT 24
- inner nfp without output HOT 2
- Cannot compile with boost 1.79 HOT 3
- The resulting polygon is shifted HOT 10
- Investigate libnfporb performance HOT 38
- it seems like there is a bug HOT 2
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 libnfporb.