Menu

#89 selfintersection and SimpilfyPolygon

*
closed
nobody
None
1
2014-08-14
2014-02-21
VLV
No

Thanks for providing us a very robust library and it works great.
I have one issue and I would like to ask your suggetion.
I am using clipper cpp 6.1.3a

define PolyScale 1e04L

this is a portion of my code

ClipperLib::Path inpoly;
for (int k = 0; k < Pt0.size() ; ++k) {
float x = pt0[k].first;
float y = pt0[k].second;

int64_t intx = x*PolyScale;
int64_t inty = y*PolyScale;
inpoly.push_back (ClipperLib::IntPoint (intx, inty));

}
ClipperLib::Paths out_polys;
out_polys.clear();
ClipperLib::PolyFillType fillType = ClipperLib::pftNonZero;
ClipperLib::SimplifyPolygon (inpoly, out_polys, fillType);
for ( int m =0; m < out_polys.size(); ++m) {
ClipperLib::CleanPolygon (out_polys [m], 0.0001*PolyScale); //i am not using the default sqrt (2);
bool ret1 = ClipperLib::Orientation (out_polys [m]);
}

I am getting out_polys.size() =1 for a case I have attached the coordinates and image. I expected 2 polygons and ClipperLib have been successful to split in various other places.

Thanks alot.

1 Attachments

Discussion

  • Angus Johnson

    Angus Johnson - 2014-02-22

    This is now fixed in Clipper ver 6.1.5 (currently only in the SF repository).

     
    • VLV

      VLV - 2014-02-23

      Thank you very much.
      I download generally from http://sourceforge.net/projects/polyclipping/.
      Can you please tell me how can I download from sourceforge repository.
      Thanks again and the speed of Clipper C++ library is remarkable.

       
  • Angus Johnson

    Angus Johnson - 2014-02-23

    Can you please tell me how can I download from sourceforge repository.


    If you don't have subversion to checkout the repository, then you can only download individual files by navigating to a specific file (eg http://sourceforge.net/p/polyclipping/code/HEAD/tree/trunk/cpp/clipper.cpp) and clicking the 'download this file' link near the top of the page.

     
  • Anonymous

    Anonymous - 2014-02-26

    Thanks . I took the Clipper.cpp and Clipper.hpp of version 5.
    In some aspects, 6.1.3a works better. However, when horizontal line connects two polygons, the 6.1.5 works better than 6.1.3a.
    Thanks for the library again and will you please close this ticket.

     
  • Angus Johnson

    Angus Johnson - 2014-02-26

    In some aspects, 6.1.3a works better.


    I'm curious about which ways 6.1.3a works better. Could you please clarify.

     
  • Anonymous

    Anonymous - 2014-02-27

    I tested a case where 6.1.3a had only one issue that I posted where as I got 4 other small issues with 6.1.5. I will post the coordinates when you get some time to look at it and I am sure you will have suggestions how to avoid it. However, the issue for which I posted the ticket got resolved. Thanks a lot. Clipper Library is not only amazingly fast, but also it resolves several self_intersections.

     
  • VLV

    VLV - 2014-02-27

    Forgot to log in. I had some small issues ( a couple of them) with 6.1.5 and I had only one issue with 6.1.3. however they are small issues and may be you will have suggestions how to resolve. i will post them by tomorrow in this ticket. However the issue for which I posted got resolved. the library is not only fast, but also removes several tiny self_intersections.

     
  • VLV

    VLV - 2014-02-28

    i have attached the 3 of the polygons that I had issue with 6.1.5. I did not have problem with 6.1.3a on these three except the one bug that I had posted.
    Thank you.

     

    Last edit: VLV 2014-02-28
  • VLV

    VLV - 2014-02-28

    i am attaching the 3rd file.

     
  • Angus Johnson

    Angus Johnson - 2014-03-01

    Hi again VLV. I'm afraid I have no idea what clipping operation(s) you're performing on these 3 polygons, nor do I know what the problem is that you're encountering.

     
  • VLV

    VLV - 2014-03-01

    i will post my code and the snapshot.
    Thanks.

     
  • VLV

    VLV - 2014-03-02

    i had posted the original ticket and code for a self_intersection issue , that I had with 6.1.3a. That issue got resolved with 6.1.5. However, I had posted 3 polygons above that have self_intersections. 6.1.3a seems to resolve well in those cases and for me 6.1.5 did not remove those self_intersections. I had attached my code.

     

    Last edit: VLV 2014-03-02
  • Angus Johnson

    Angus Johnson - 2014-03-02

    However, I had posted 3 polygons above that have self_intersections.

    Are you sure? I can't see them. How are you determining that?

     
  • Anonymous

    Anonymous - 2014-03-03

    Thanks for pointing about the evaluation.
    I appreciate your time and for the clipper library.
    I am using Arcmap 10 or qgis for evaluating self-intersections in shp files.
    In 6.1.3a, poly3526_out and poly_1040.out did not split at the common point (for Part1 and 2)
    (-79.6949, 43.5042 , 1040.out ) and
    (-89.905 32.680, poly 3526.out).
    but they are split in 6.1.5 at the common point and I think that version is the best.
    However, arcmap and qgis complain because two holes can not share the same point.
    However, the holes can share the same point as long as they don't cross. So, 6.1.3a did not have a problem.
    So, may be this is the evaluation software policy (even smoothing did not separate the vertex) and Clipper is just fine and works as expected.

    In 6491.out (enclosed)
    there are 4 points
    -88.501 31.251
    -88.506 31.240
    -88.505 31.242--------------> it causes self-intersection
    -88.495 31.238

    and in 6.1.3a there are 3 points only clipper output.
    -88.501 31.251
    -88.506 31.240
    -88.495 31.238

    My input and coding is identical as enclosed above.

    Thanks again for your time.

     
  • VLV

    VLV - 2014-03-03

    sorry , I posted without logging into my account.

     
  • VLV

    VLV - 2014-03-07

    if there is any update for resolving the cases above, please let me know.
    I am using 6.1.3a currently.

     
  • Angus Johnson

    Angus Johnson - 2014-03-15

    VLV, I'm having considerable trouble deciphering all your code and your data.
    With all your attachments above I can't figure out what is input to clipping operations and what is output, so please start again and do the following ...

    1. provide one sample that highlights the problem you're encountering.
    2. indicate which input data (integers only please) are the subject polygons and which are the clip polygons
    3. specify the clipping operation (if any) and include fill types etc.
    4. specify other operations (SimplifyPolygons, CleanPolygons etc) that your doing after clipping
    5. finally indicate when the self-intersection occurs, after clipping and or after SimplifyPolygons.

    Thanks.

     
  • VLV

    VLV - 2014-03-16

    I will post very clearly. Thanks for the time.
    I will find my input file and will post one case clearly.
    Thanks.

     
  • VLV

    VLV - 2014-03-25

    sorry for the delay. Found the materials. Will post it.
    There can be one or 2 bugs, however they work for several cases correctly.
    The speed is unremarkable.

     
  • Angus Johnson

    Angus Johnson - 2014-03-28
    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB