Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9066315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:42:22+00:00 2026-06-16T16:42:22+00:00

I have two concave polygons on input represented as two vectors of points. I

  • 0

I have two concave polygons on input represented as two vectors of points. I want to do some polygon operation on it – union, intersection and difference. I found intersection points between these polygons and insert them into the right place in each polygon. Then I give an information about its position (Inner – it is inside the other polygon, Outer – it is outside the other polygon, Intersection – point, where two edges of polygons intersects) to each vertex. Now I know which points create the union of these polygons (Outer and Intersection) etc., but I need to know how to sort them to the right order. In case of the intersection operation I need to divide these sorted points into the right number of sets, because the result of intersection could be more than one polygon.

I am using C++, but I don’t need necessarily the code, I only want to need how to sort these final polygon points. And I don’t want to use any library for these operations because I already have my own functions and want to use them.

I looked at this question How to intersect two polygons? and also some others but none of them is solving final sorting of points.
I also read this article http://www.gvu.gatech.edu/~jarek/graphics/papers/04PolygonBooleansMargalit.pdf , but I probably don’t get it.

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:42:23+00:00Added an answer on June 16, 2026 at 4:42 pm

    If you follow all my recommendations from my comments:

    • Distinguish between intersection and touching points
    • Keep a link between the two equivalents of the intersection points in the two polygons

    The solution for the union will be:

    1. Consider only outer, touching and intersection points
    2. Make sure the points in the two polygons are ordered in different direction (one of the sets is in clockwise direction, the other one in counter-clockwise)
    3. Start from random point in any of the two polygons.
    4. For every vertex in any of the two polygons keep if you have visited it
    5. Every time you encounter an intersection point keep on traversing from the next to follow point in the other polygon after the equivalent of the intersection point.
    6. If you come back to the point you started from this closes one of the components of the join of the two polygons. If not all vertices were traversed repeat the whole of it from any unvisited vertex.
    7. In the end calculate the area of all the polygons you have found. The largest in area will be the real union. The rest will be holes in the union.

    The solution for the join will be:

    1. Consider only inner and intersection points
    2. Make sure the points in the two polygons are ordered in the same direction
    3. Start from random point in any of the two polygons.
    4. For every vertex in any of the two polygons keep if you have visited it
    5. Every time you encounter an intersection point keep on traversing from the next to follow point in the other polygon after the equivalent of the intersection point.
    6. If you come back to the point you started from this closes one of the components of the join of the two polygons. If not all vertices were traversed repeat the whole of it from any unvisited vertex.

    EDIT: As I already mentioned, I have the god feeling my approach with the polygon orientation needs to be revised. However, when searching through the web I found a description of algorithm that might do the work for you: The Vatti clipping algorithm

    EDIT2 One more article describing such clipping algorithm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have two concave 2d polygons(A, B), that don't intersect. The problem
I have two update panels on a page. And I want to update both
I have two clients (A and B) and Servlet. I want, when A client
I have a simple polygon (convex or concave, but no holes) that I need
I have two tables, say teacher and student. I want to build a third
Have two fields start and end, both are dates, I want to write a
Im looking for some fairly easy (I know polygon union is NOT an easy
I have two edittext input box. First one is for username and the second
I have two AFP files and I want to concatenate them together, how can
I have two buttons play and stop. When I click play I want the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.