Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function
Chronological Thread
- From: Efi Fogel <>
- To:
- Subject: Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function
- Date: Thu, 3 Dec 2015 15:37:29 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:XF9DEB3f+9ZrgOX5smDT+DRfVm0co7zxezQtwd8Zse4fLvad9pjvdHbS+e9qxAeQG96LtbQc06L/iOPJZy8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL2PbrnD61zMOABK3bVMzfbSrXNaKx+2MlMmMuLTrKz1SgzS8Zb4gZD6Xli728vcsvI15N6wqwQHIqHYbM85fxGdvOE7B102kvpT4r9Ze9T9Nsach69JYSve9OL8pSKRRSjUgKWE8osPx8gLSSBOGoXoaXGJRmRVBB03J7QrxQ4zq4Rb8rfd3jSmGIdXtH/dzQiWn964tSRnyiS5BOSR+63DSksU3jaRVp1WqqBV7hoLVe4qIL+EtQ6XGYNlPRXZdRt0DEGtaE4akZs0OCfAANKBWtc7mtl4WpFy/AwerQ+jgwzsNin7t1rAhyLccFxrb1lkgA84WqyaT687kMb8bF+Gz1qjBizvZKOhH3C/0r4nOfBdmqv6FWfd8cNHa1FI0RD7DlUia/Iz5IyuOhKNKqHme9+MmVOS1imdhpRs2uSmq3s5ri4/HgcUexVnAsCl4240oPsbrdEkuatGtFN5ctjqRKpBtasIkWWBh/iggmZMcvpvuUSYLgLogyBPbI6iKfYmG5R3uUM6eJD55gDRuf7fp1EX6ylSp1uCpDpr8611NtCcQytQ=
I have no problems compiling the code.
Which platform are you using ?
What errors are you getting.PS, if you expect other people to look at the code, make it look nice.
____ _ ____ _
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
On Thu, Dec 3, 2015 at 2:52 PM, DamienDous <> wrote:
Hi Efi,
I attach the file containing the code.
Thank you for your help.
Damien
Efi Fogel wrote
> On Thu, Dec 3, 2015 at 1:22 PM, DamienDous <
> damien.d@
main.cpp <http://cgal-discuss.949826.n4.nabble.com/file/n4661437/main.cpp>
> > wrote:
>
>> Hi Efi,
>>
>> Thank you for your answer!
>>
>> I tried the example using
>> Exact_predicates_exact_constructions_kernel_with_sqrt and I have a
>> compilation error. It seems that the function
>> linear_least_squares_fitting_2
>> doesn't take this Kernel. Am I using it in the good way?
>>
>
> I don't know.
> I was able to compile something.
> Attach the code, and I'll try it myself.
>
>>
>> I also tried to convert the lines from Epick to Epeck using the mechanism
>> provided in the Algebraic Foundation package but as new user in CGAL I'm
>> kind of lost. I tried to use fraction decomposition in order to decompose
>> lines coefficients with Epick kernel and then recompose the coefficients
>> with Epeck Kernel but that didn't work. Is that the good way to convert
>> the
>> lines from one Kernel to another?
>>
>> Damien
>>
>>
>>
>> Efi Fogel wrote
>> > Hi Damien,
>> >
>> > Use the Exact_predicates_exact_constructions_kernel_with_sqrt kernel
>> or,
>> > when exactness can be compromised in favor of using a kernel that is
>> more
>> > efficient for constructing the arrangement, convert the lines from one
>> > representation to the other using the mechanism provided in the
>> Algebraic
>> > Foundation package.
>> >
>> > Please paste pretty code. (Not only not nicely indented, but also it
>> seems
>> > that the '<' and '>' tags go converted by Nabble to < and > and,
>> in
>> > addition, the ssl header inclusion is missing.)
>> >
>> > Efi
>> >
>> > ____ _ ____ _
>> > /_____/_) o /__________ __ //
>> > (____ ( ( ( (_/ (_/-(-'_(/
>> > _/
>> >
>> >
>> >
>> > On Tue, Dec 1, 2015 at 7:58 PM, DamienDous <
>>
>> > damien.d@
>>
>> > > wrote:
>> >
>> >> Hi,
>> >>
>> >> I need to create an arrangement with lines fitted by
>> >> linear_least_squares_fitting_2 function.
>> >>
>> >> I have a problem when I fit lines on points by using
>> >> linear_least_squares_fitting_2 function and after put the obtained
>> lines
>> >> in
>> >> an arrangement using an Exact_predicates_exact_constructions_kernel.
>> The
>> >> face number processed is incorrect.
>> >>
>> >> The following example fit three lines intersecting at the same point
>> >> using
>> >> Line_2 with Exact_predicates_inexact_constructions_kernel (the
>> >> linear_least_squares_fitting_2 can't take line with
>> >> Exact_predicates_exact_constructions_kernel because the function
>> >> processes
>> >> square root). To put the obtained lines in an arrangement using
>> >> Exact_predicates_exact_constructions_kernel , I convert the lines in
>> >> Segment_2 with Exact_predicates_exact_constructions_kernel and I
>> >> understand
>> >> that the problem come from this transformation but I don't know how to
>> >> use
>> >> linear_least_squares_fitting_2 function and then put the result in an
>> >> arrangement using Exact_predicates_exact_constructions_kernel.
>> >>
>> >> Also, I tried to use an arrangement with
>> >> Exact_predicates_inexact_constructions_kernel but that doesn't work
>> given
>> >> that the precision problem.
>> >>
>> >>
>> >> Here is my code :
>> >>
>> >> #include <CGAL/Arrangement_2.h>
>> >> #include <CGAL/Arr_segment_traits_2.h>
>> >> #include <CGAL/Arr_linear_traits_2.h>
>> >> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
>> >> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
>> >> #include <CGAL/Arr_extended_dcel.h>
>> >>
>> >> typedef CGAL::Exact_predicates_inexact_constructions_kernel
>> >> Kernel1;
>> >> typedef CGAL::Exact_predicates_exact_constructions_kernel
>> >> Kernel2;
>> >> typedef CGAL::Arr_linear_traits_2
>> >
> <Kernel2>
>> >> Traits;
>> >> typedef CGAL::Arr_face_extended_dcel<Traits, bool>
>> >> Dcel_2;
>> >> typedef CGAL::Arrangement_2<Traits, Dcel_2>
>> >> Arrangement;
>> >>
>> >>
>> >> int main()
>> >> {
>> >> // Initialize segments distance and segments number of points
>> >> double distance = 1;
>> >> size_t nbPoints = 100;
>> >>
>> >> // Fill the three points vectors representing the three lines
>> >>
>> >> std::vector<std::vector&lt;CGAL::Point_2&lt;Kernel1>>>
>> >> lines_points;
>> >> lines_points.resize(3);
>> >> double x = 0;
>> >> for (size_t i = 0; i < nbPoints; i++, x += distance /
>> nbPoints)
>> {
>> >> lines_points.at(0).push_back(CGAL::Point_2
>> >
> <Kernel1>
>> > (distance
>> >> - x, x));
>> >> lines_points.at(1).push_back(CGAL::Point_2
>> >
> <Kernel1>
>> > (x,
>> >> x));
>> >> lines_points.at(2).push_back(CGAL::Point_2
>> >
> <Kernel1>
>> > (x,
>> >> distance / 2));
>> >> }
>> >>
>> >> // Fit for each points vector a line using
>> >> linear_least_squares_fitting_2
>> >> // and transform this line in segment with
>> >> Exact_predicates_exact_constructions_kernel
>> >> CGAL::Line_2
>> >
> <Kernel1>
>> > line;
>> >> std::vector<CGAL::Segment_2&lt;Kernel2>>
>> >> segments(lines_points.size());
>> >> for (size_t i = 0; i < lines_points.size(); i++) {
>> >> CGAL::linear_least_squares_fitting_2(lines_points.at
>> >> (i).begin(),
>> >> lines_points.at(i).end(), line, CGAL::Dimension_tag<0>());
>> >> segments.at(i) =
>> >> CGAL::Segment_2
>> >
> <Kernel2>
>> > (CGAL::Point_2
>> >
> <Kernel2>
>> > (0,
>> >> -line.c() / line.b()),
>> >> CGAL::Point_2
>> >
> <Kernel2>
>> > (distance, -(distance *
>> >> line.a() + line.c()) /
>> >> line.b()));
>> >> }
>> >>
>> >> // Put the processed segment in an arrangement
>> >> Arrangement arr;
>> >> CGAL::insert(arr, segments.begin(), segments.end());
>> >>
>> >> // Print the number of bounded face
>> >> std::cout << arr.number_of_faces() -
>> >> arr.number_of_unbounded_faces() <<
>> >> std::endl;
>> >>
>> >> // Print the bounded face of the arrangement
>> >> Arrangement::Ccb_halfedge_const_circulator curr;
>> >> for (Arrangement::Face_const_handle fit = arr.faces_begin();
>> fit
>> >> !=
>> >> arr.faces_end(); ++fit) {
>> >> if (!fit->is_unbounded()) {
>> >> curr = fit->outer_ccb();
>> >> do {
>> >> std::cout << curr->source()->point()
>> <<
>> "
>> >> - ";
>> >> } while (++curr != fit->outer_ccb());
>> >> }
>> >> }
>> >> }
>> >>
>> >>
>> >>
>> >> Is there a Kernel that provide against this problem?
>> >>
>> >> Thank you very much.
>> >> Regards.
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://cgal-discuss.949826.n4.nabble.com/Create-a-correct-arrangement-with-lines-processed-with-linear-least-squares-fitting-2-function-tp4661426.html
>> >> Sent from the cgal-discuss mailing list archive at Nabble.com.
>> >>
>> >> --
>> >> 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
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://cgal-discuss.949826.n4.nabble.com/Create-a-correct-arrangement-with-lines-processed-with-linear-least-squares-fitting-2-function-tp4661426p4661435.html
>> Sent from the cgal-discuss mailing list archive at Nabble.com.
>>
>> --
>> 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
--
View this message in context: http://cgal-discuss.949826.n4.nabble.com/Create-a-correct-arrangement-with-lines-processed-with-linear-least-squares-fitting-2-function-tp4661426p4661437.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, DamienDous, 12/01/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, Efi Fogel, 12/02/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, DamienDous, 12/03/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, Efi Fogel, 12/03/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, DamienDous, 12/03/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, Efi Fogel, 12/03/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, DamienDous, 12/03/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, Efi Fogel, 12/03/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, DamienDous, 12/03/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, Sebastien Loriot (GeometryFactory), 12/04/2015
- Re: [cgal-discuss] Create a correct arrangement with lines processed with linear_least_squares_fitting_2 function, Efi Fogel, 12/02/2015
Archive powered by MHonArc 2.6.18.