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 6182265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:10:10+00:00 2026-05-24T01:10:10+00:00

I have a set of polygons and I want to test intersection between it

  • 0

I have a set of polygons and I want to test intersection between it and a segment.
I checked the manual but I cannot find a matching function.
The intersection between points, lines, segments, triangles, planes do exist.
And the intersection between polygons are also there.
My question is:

  1. Is there such a function?
  2. If not, does it mean I need to break down the polygons into segments and do intersection among these segments? (The reason that I am reluctant to do this is, I thought CGAL might in fact use this way to do intersections between polygons. How come there is no such a function for intersecting a line and a polygon?) Or is there any other better way to do it?
  • 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-24T01:10:12+00:00Added an answer on May 24, 2026 at 1:10 am

    The easiest method is to create a Polygon_set_2 object which may contain several polygons. To test an intersection of an external polygon with this set you simply apply the do_intersect method.

    For example:

    typedef CGAL::Polygon_set_2<Kernel, std::vector<Kernel::Point_2>> Polygon_set_2;
    Polygon_set_2 ps;
    Polygon_2     poly;
    Polygon_2     line; // line is a polygon defined by 2 points
    
    ps.insert(poly);
    bool intersect = ps.do_intersect(line);
    

    More on polygon_set_2:

    • http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/Boolean_set_operations_2_ref/Class_General_polygon_set_2.html
    • http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/Boolean_set_operations_2_ref/Class_Polygon_set_2.html

    I hope it’s clear,
    Kiril

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

Sidebar

Related Questions

I have a set of vertices(called A) and I want to find all the
I have set permission to allow anonymous user to create page. but when the
I have a set of points (stored as lat/lon) for a polygon, I want
I have a set of simple (no holes, no self-intersections) polygons, and I need
So, i have a set of points (x,y), and i want to be able
Let's say we have a set of polygons, can change the camera view angle
I have a set of regions (geo-fences) which are polygons. This set of data
I have set up multiple targets in a single xml file. I expect all
I have set up 2 servers which are linked. From my LOCAL SERVER, I
I have :set hlsearch as default value. When I search for something, search terms

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.