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

  • Home
  • SEARCH
  • 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 1113609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:53:02+00:00 2026-05-17T02:53:02+00:00

I have a simple polygon (convex or concave, but no holes) that I need

  • 0

I have a simple polygon (convex or concave, but no holes) that I need to slice into parts with a line segment. I’m not sure how to actually determine how many polygons result after the slice, or how to group the vertices.

Basic convex cases the always results in 2 sub-polygons are easy, but how would I deal with a complicated concave shape? Take an “E” shape polygon for example. A vertical slice can yield 4 polygons. How can I determine which vertices make up each one of those sub-polygons?

Defining the Polygon: I have two options here. My polygon can be an ordered list of vertices, or it can be an array of triangles. I would prefer a solution that uses the array of triangles. It should be pretty easy to loop through every triangle and slice it with the line if they intersect. But then I have no idea how to group those triangles into the sub-polygons that result.

Pseudo-code or even general advice is good; a C# implementation is ideal.

  • 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-05-17T02:53:03+00:00Added an answer on May 17, 2026 at 2:53 am

    A while back I gave this answer to a somewhat different question.

    That answer gives a way of establishing an outline of a shape, given a triangular decomposition of that shape.

    The basic idea is to consider the edges of all the triangles as directed vectors, and then cancel out equal but opposite edges.

    In your case, you would have a bunch of triangles representing the original shape. You would slice the individual triangles with the line. You would then regather the triangles into shapes using the method outlined above, with the proviso that sliced edges would not cancel.

    There are details and pictures in the answer referred to above. But to summarize the steps would be

    1. Perform the triangle splits

    2. For each resulting triangle, add the three directed edges to a set. To determine clockwise order, check out the the answers to this question.

    3. Go through the edge set removing pairs of edges that are are equal but opposite (unless they are slice edges)

    4. Pick an edge in the set, then find the edge whose tail matches the head of the first edge. Then repeat for that edge, until you get to the beginning edge. Remove each edge from the edge set as you get to it. Whenever you get to the beginning edge you have a closed loop representing one of the result polygons.

    5. Perform Step 4 until there are no edges left.

    All of this accommodates your wish to start from a triangulation of your polygon. But as one of the commenters to your original question has pointed out, you may want to consider the alternatives given at Generate new polygons from a cut polygon (2D).

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

Sidebar

Related Questions

I have two geo-spatial simple convex polygon areas, in latitudes and longitudes (decimal degrees)
i have an application that shows a simple square polygon represented on a GLSurfaceView.
I have simple php validation form that is halfway working. If you leave the
I have simple win service, that executes few tasks periodically. How should I pass
I have an OpenGL-related issue. Whenever I attempt to draw a simple polygon using
I have a very simple code, that just draws a building, I want to
I need to solve a relatively simple thing -- I've got n-vertices convex 2D
I have a simple .NET dll built with VS2010 C# that exposes 2 static
I am looking for a fast polygon triangulation algorithm that can triangulate not very
I'm working with a simple rotating polygon that should speed up when the user

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.