Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Get sub-elements induced by the cut of an element with a curve

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Get sub-elements induced by the cut of an element with a curve


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Get sub-elements induced by the cut of an element with a curve
  • Date: Wed, 26 Jan 2022 09:11:54 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-data: A9a23:PUwd1a+neZTOdkPEM7sqDrUDbHiTJUtcMsCJ2f8bNWPcYEJGY0x3n 2BODD3SM/vYYzCkeNx/YYq29BsEsJPVnNZlHFRlqi9EQiMRo6IpJ/zJdxaqZ3v6wu7rFR88s Z1GMrEsCOhuExcwcz/0auCJQUFUjP3OHvylYAL9EngZqTVMEU/Nsjo+3b5p6mJUqYLhWVnV4 Ims+5S31GKNglaYDEpEs8pvlzs05JweiBtA1rDpTa0jUPf2zhH5PbpHTU2DByOQrrp8QoZWc 93+IISRpQs1yfuC5uSNyd4XemVSKlLb0JPnZnB+A8BOiTAazsA+PzpS2Pc0MS9qZzu1c99Zl +5msMOtdS0VIaDltchDCUkALBl+FPgTkFPHCSDXXc27lQvDdCaznbNrBUAyeIoF5qBwH2EI8 /EEQNwPRknc16Ttm/ThF7Aq1pxLwMrDZOvzvllpyz3DAP89B57KSb/LzdBV2zI9mtpfE//Ve 80DeHxkaxGojxhnZg5PUcJvwI9EgFHQaQxfiQuMvJYpoGf1yy5/15rQPvr8L4niqcJ9xB7A+ zOuE37CKhoVPdjaxTue+W+3ncfUjCbjUcQTEqe5/7hkmjWuKnc7UlsTUgbk/7+8g0+6HtVCN woT5Cpoq6UunKC2cjXjd0KDi3vboyI2Z8VdOsAWtlvdkpXs4y/MUwDoUQV9QNAhscY3Qxkj2 VmIg87lCFRTjVGFdZ6O3uvE/W7iY0D5OUdYPnRUEmPp9vG++Nlbs/7Zcjp0OICP5uAZ9Bmqh TWN8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A7huO2CIgCMl0iqHJFXi6gJ/32NTRgUhm6XVZ10DMwL9S5B4+PiFBGWY90rjzTkhK2 JlLTv8faJxUrEf2ne61G4eVEC7DjajAsFGe6fhjkkk6445qxU5U+rPJQ33IbPHHSSOUfqfqb1W uDwSkdJOqH+mMV1UrciYPT+nIeCSxJAmPxtph5WPDWn5pxY8qvUzUA2m3acBoCAjmertIuC4Kn /xTCrvJ9F+JnumoxikYCbiNb

Hi Efi,

It would not be  a mistake to document the value type of the OutputIterator here

https://doc.cgal.org/latest/Arrangement_on_surface_2/group__PkgArrangementOnSurface2Funcs.html#ga49aa156968945f5533a2b5d9897ca659

Are there more functions like that?

Best,

Andreas


On 1/26/2022 8:29 AM, Efi Fogel ( via cgal-discuss Mailing List) wrote:
typedef boost::variant<Vertex_handle, Halfedge_handle, Face_handle> Zone_result;
std::list<Zone_result> zone_elems;
zone(arr, seg, std::back_inserter(zone_elems));
   ____  _        ____             _   /_____/_) o    /__________  __  //  (____ (   (    (    (_/ (_/-(-'_(/                          _/




On Wed, 26 Jan 2022 at 01:14, Marco Feder <> wrote:
I’m sorry to post again, but I’ve not been able to find the proper way to give that OutputIterator argument.

I was thinking to use std::back_inserter() like this:

std::vector<?> arr_vec;
auto my_zone = CGAL::zone(arr,my_curve,std::back_inserter(arr_vec),pl);

The issue, again, is that I don’t know what is the correct template for arr_vec. Which one should I use?

Best,
Marco

On 22 Jan 2022, at 14:04, Marco Feder <> wrote:

Thanks Efi Fogel,

I’m trying to cook a MWE to handle the situation I have in the attachment, but I have a hard time understanding how to give the OutputIterator argument to the CGAL::zone() function. 

So far I have the following snippet, which does not compile as output_it cannot be constructed. How can I define that output iterator correctly? 

#include <iostream>
#include <iterator>

#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_walk_along_line_point_location.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Cartesian.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/intersections.h>

typedef CGAL::Quotient<CGAL::MP_Float> Number_type;
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
typedef CGAL::Arr_walk_along_line_point_location<Arrangement_2> walk_pl;

int main() {
Arrangement_2 arr;
Segment_2 cv[3];
walk_pl pl(arr);
Point_2 p1(0, 0), p2(0, 4), p3(4, 0);
cv[0] = Segment_2(p1, p2);
cv[1] = Segment_2(p2, p3);
cv[2] = Segment_2(p3, p1);
CGAL::insert(arr, &cv[0], &cv[3]);

Segment_2 my_curve(Point_2(0,1), Point_2(2,2)); // curve is a segment now, it cuts the triangle
insert(arr, my_curve, pl);

// Compute the zone of the curve
std::ostream_iterator<Arrangement_2> output_it(std::cout,'\n); // Error!  
auto my_zone = CGAL::zone(arr,my_curve, output_it,pl);

return 0;
}

Best,
Marco

On 20 Jan 2022, at 15:01, Efi Fogel <> wrote:

If you can reduce the problem to the plane (perhaps it is already in the plane), you can use the Arrangement_2 class template from the "2D Arrangement" package; see https://doc.cgal.org/latest/Arrangement_on_surface_2/index.html.
Construct an arrangement of the type of curves you are interested in, then use the CGAL::zone(c) free function to compute the zone of a given curve c; see 
https://doc.cgal.org/latest/Arrangement_on_surface_2/group__PkgArrangementOnSurface2Funcs.html#ga49aa156968945f5533a2b5d9897ca659

   ____  _        ____             _   /_____/_) o    /__________  __  //  (____ (   (    (    (_/ (_/-(-'_(/                          _/


On Thu, 20 Jan 2022 at 14:27, Marco Feder <> wrote:
Dear all,

I’m completely new to CGAL, and I’d like to understand if it’s possible to perform the following task:

Consider an element T of a 2D mesh, which is cut by a curve \Gamma. Is it possible to define/get the two new elements, say T_1 and T_2, induced by the cut, as showed in the attachment?

If so, could you please point me to the right examples/pages in the manual? 

Best regards,
Marco

<cut.jpeg>


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss

-- 
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project



Archive powered by MHonArc 2.6.19+.

Top of Page