CGAL: Polygon overlap test











up vote
0
down vote

favorite












I am looking for a function which tests whether in 2D a simple polygon completely contains another simple polygon. do_intersect as mentioned here, returns true even if polygons are partially overlapping. What is the appropriate function to check complete overlap?










share|improve this question
























  • Not sure what the exact capabiliites of cgal are, but things that could work: is the symmetric difference of the polygons equal to their difference? Or is the intersection of the polygons equal to the second polygon?
    – jakub_d
    Nov 7 at 15:25















up vote
0
down vote

favorite












I am looking for a function which tests whether in 2D a simple polygon completely contains another simple polygon. do_intersect as mentioned here, returns true even if polygons are partially overlapping. What is the appropriate function to check complete overlap?










share|improve this question
























  • Not sure what the exact capabiliites of cgal are, but things that could work: is the symmetric difference of the polygons equal to their difference? Or is the intersection of the polygons equal to the second polygon?
    – jakub_d
    Nov 7 at 15:25













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am looking for a function which tests whether in 2D a simple polygon completely contains another simple polygon. do_intersect as mentioned here, returns true even if polygons are partially overlapping. What is the appropriate function to check complete overlap?










share|improve this question















I am looking for a function which tests whether in 2D a simple polygon completely contains another simple polygon. do_intersect as mentioned here, returns true even if polygons are partially overlapping. What is the appropriate function to check complete overlap?







c++ cgal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 at 13:28

























asked Nov 7 at 13:22









Shibli

2,42974095




2,42974095












  • Not sure what the exact capabiliites of cgal are, but things that could work: is the symmetric difference of the polygons equal to their difference? Or is the intersection of the polygons equal to the second polygon?
    – jakub_d
    Nov 7 at 15:25


















  • Not sure what the exact capabiliites of cgal are, but things that could work: is the symmetric difference of the polygons equal to their difference? Or is the intersection of the polygons equal to the second polygon?
    – jakub_d
    Nov 7 at 15:25
















Not sure what the exact capabiliites of cgal are, but things that could work: is the symmetric difference of the polygons equal to their difference? Or is the intersection of the polygons equal to the second polygon?
– jakub_d
Nov 7 at 15:25




Not sure what the exact capabiliites of cgal are, but things that could work: is the symmetric difference of the polygons equal to their difference? Or is the intersection of the polygons equal to the second polygon?
– jakub_d
Nov 7 at 15:25












2 Answers
2






active

oldest

votes

















up vote
1
down vote













You can use do_intersect() function first and if you have no intersection take any point for P1 and check whether it is inside P2 using has_on_bounded_side(). Then if P1 is not included in P2, do same for a point of P2 with reference to P1 in order to conclude.






share|improve this answer




























    up vote
    0
    down vote













    A convex polygon is completely contained in another convex polygon if and only all its vertices are contained inside the containing polygon.



    To test if a point is contained inside the polygon you can use the OpenCV function pointPolygonTest() (see description here) (see example use here)






    share|improve this answer





















    • I am looking for a solution in CGAL context though.
      – Shibli
      Nov 7 at 13:59










    • Can't you use something from doc.cgal.org/latest/Point_set_2/… ?
      – Cristi
      Nov 7 at 14:22













    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53190342%2fcgal-polygon-overlap-test%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    You can use do_intersect() function first and if you have no intersection take any point for P1 and check whether it is inside P2 using has_on_bounded_side(). Then if P1 is not included in P2, do same for a point of P2 with reference to P1 in order to conclude.






    share|improve this answer

























      up vote
      1
      down vote













      You can use do_intersect() function first and if you have no intersection take any point for P1 and check whether it is inside P2 using has_on_bounded_side(). Then if P1 is not included in P2, do same for a point of P2 with reference to P1 in order to conclude.






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        You can use do_intersect() function first and if you have no intersection take any point for P1 and check whether it is inside P2 using has_on_bounded_side(). Then if P1 is not included in P2, do same for a point of P2 with reference to P1 in order to conclude.






        share|improve this answer












        You can use do_intersect() function first and if you have no intersection take any point for P1 and check whether it is inside P2 using has_on_bounded_side(). Then if P1 is not included in P2, do same for a point of P2 with reference to P1 in order to conclude.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 7 at 16:09









        sloriot

        3,7841122




        3,7841122
























            up vote
            0
            down vote













            A convex polygon is completely contained in another convex polygon if and only all its vertices are contained inside the containing polygon.



            To test if a point is contained inside the polygon you can use the OpenCV function pointPolygonTest() (see description here) (see example use here)






            share|improve this answer





















            • I am looking for a solution in CGAL context though.
              – Shibli
              Nov 7 at 13:59










            • Can't you use something from doc.cgal.org/latest/Point_set_2/… ?
              – Cristi
              Nov 7 at 14:22

















            up vote
            0
            down vote













            A convex polygon is completely contained in another convex polygon if and only all its vertices are contained inside the containing polygon.



            To test if a point is contained inside the polygon you can use the OpenCV function pointPolygonTest() (see description here) (see example use here)






            share|improve this answer





















            • I am looking for a solution in CGAL context though.
              – Shibli
              Nov 7 at 13:59










            • Can't you use something from doc.cgal.org/latest/Point_set_2/… ?
              – Cristi
              Nov 7 at 14:22















            up vote
            0
            down vote










            up vote
            0
            down vote









            A convex polygon is completely contained in another convex polygon if and only all its vertices are contained inside the containing polygon.



            To test if a point is contained inside the polygon you can use the OpenCV function pointPolygonTest() (see description here) (see example use here)






            share|improve this answer












            A convex polygon is completely contained in another convex polygon if and only all its vertices are contained inside the containing polygon.



            To test if a point is contained inside the polygon you can use the OpenCV function pointPolygonTest() (see description here) (see example use here)







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 7 at 13:45









            Cristi

            1801314




            1801314












            • I am looking for a solution in CGAL context though.
              – Shibli
              Nov 7 at 13:59










            • Can't you use something from doc.cgal.org/latest/Point_set_2/… ?
              – Cristi
              Nov 7 at 14:22




















            • I am looking for a solution in CGAL context though.
              – Shibli
              Nov 7 at 13:59










            • Can't you use something from doc.cgal.org/latest/Point_set_2/… ?
              – Cristi
              Nov 7 at 14:22


















            I am looking for a solution in CGAL context though.
            – Shibli
            Nov 7 at 13:59




            I am looking for a solution in CGAL context though.
            – Shibli
            Nov 7 at 13:59












            Can't you use something from doc.cgal.org/latest/Point_set_2/… ?
            – Cristi
            Nov 7 at 14:22






            Can't you use something from doc.cgal.org/latest/Point_set_2/… ?
            – Cristi
            Nov 7 at 14:22




















             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53190342%2fcgal-polygon-overlap-test%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini