Subject: CGAL users discussion list
List archive
- From: gupta61 <>
- To:
- Subject: [cgal-discuss] Re: CGAL "intersection" bug - URGENT
- Date: Fri, 6 Apr 2012 02:26:30 -0700 (PDT)
Hi Sebastian,
I apologize for writing urgent in the title. I was not aware of this policy. Thanks for the report. I will let you know if I find any other bugs relating to this file. Thanks.
Regards,
Piyush Gupta
UIUC
--
University of Illinois at Urbana-Champaign
On Fri, Apr 6, 2012 at 2:50 AM, Sebastien Loriot (GeometryFactory) [via cgal-discuss] <[hidden email]> wrote:
Hello,
Please stop posting messages with URGENT in the title, it has no
influence on the treatment. Moreover, I don't want that we end up
having URGENT in the title of each message of the list :)
For your problem, you cannot rely on a kernel with inexact
constructions to make a bug report. Here is what you should have used:
typedef CGAL::Exact_predicates_exact_constructions_kernel EKernel;
CGAL::Cartesian_converter<Kernel,EKernel> convert;
CGAL::Object object = CGAL::intersection(convert(segment_query),
convert(triangle));
CGAL_assertion(object.empty());
For more details, please read:
http://www.cgal.org/FAQ.html#inexact_NT
But the bug was really here (because your points are aligned even with
floating point coordinates).
I joint the patch as well as the patched file
CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h
Thanks for the bug report,
Sebastien.
PS-SPAM: If you have URGENT questions that cannot wait the usual
answering delay of the list, note that GeometryFactory is selling
support licenses for a reasonable price. You can contact
[hidden email] to know more about these.
On 04/05/2012 11:44 PM, gupta61 wrote:> Sent from the cgal-discuss mailing list archive at Nabble.com.
> Hi,
>
> I am reporting a problem with the "Segment-Triangle" intersection. If you
> look at the code below I am trying to find a intersection between a Segment
> and a Triangle. The answer should be that they do not intersect. When I use
> "do_intersect" to find if they intersect, it gives me the correct result.
> However when I ask "intersection" to tell me if it has an intersection, then
> it gives me a segment as the intersection which is obviously wrong. Let me
> know if I am missing something. I am mentioning the various things I have
> tried.
>
>
>
> I have tried with this problem with three versions of CGAL (3.8, 3.9,
> 4.0-beta1).
>
> I also tried these kernels:
>
> #include<CGAL/Exact_predicates_exact_constructions_kernel.h>
> typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
>
> #include<CGAL/Simple_cartesian.h>
> typedef CGAL::Simple_cartesian<double> Kernel;
>
> and got the same wrong results...
>
>
>
> I am also mentioning the code which we used for this.
>
>
> #include<cstdlib>
> #include<string>
> #include<cstdio>
>
> #include<CGAL/Exact_predicates_inexact_constructions_kernel.h>
> typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
>
> //#include<CGAL/Exact_predicates_exact_constructions_kernel.h>
> //typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
>
> //#include<CGAL/Simple_cartesian.h>
> //typedef CGAL::Simple_cartesian<double> Kernel;
>
>
> #include<CGAL/intersections.h>
> #include<CGAL/Bbox_3.h>
>
> typedef CGAL::Point_3<Kernel> CGALPoint3;
> typedef CGAL::Segment_3<Kernel> CGALSegment3;
> typedef CGAL::Triangle_3<Kernel> CGALTriangle3;
>
> int main(int argc, char** argv) {
>
> CGALSegment3 segment_query( CGALPoint3(0.125, 0, -0.125),
> CGALPoint3(0.25, 0, -0.125) );
>
> CGALTriangle3 triangle( CGALPoint3(0.2500001, 0, -0.125) /* vertex 6*/,
> CGALPoint3(1.0278171, 0, -0.125) /* vertex 10*/,
> CGALPoint3(1.0278171, 0, -0.250001) /* vertex 9*/ );
>
> std::cout<< std::setw(12)<< std::setprecision( 15 )
> << "\nSegment query: "<< segment_query<< std::endl;
> std::cout<< std::setw(12)<< std::setprecision( 15 )
> << "\nTriangle: "<< triangle<< std::endl;
>
> bool do_intersect = CGAL::do_intersect(segment_query, triangle);
> std::cout<< "\nCGAL::do_intersect (0/1) = "<< do_intersect<< std::endl;
>
>
> // Compute actual intersection(s)
> CGAL::Object object = CGAL::intersection(segment_query, triangle);
>
> // check if it is a point
> const CGALPoint3* p_point=0;
> const CGALSegment3* p_segm=0;
> if( (p_point = CGAL::object_cast<CGALPoint3>(&object)) ) {
> std::cout<< "\nEncountered intersection object is a point"<<
> std::endl;
> std::cout<< std::setw(12)<< std::setprecision( 15 )<< (*p_point)<<
> std::endl;
> }
> else if ( (p_segm = CGAL::object_cast<CGALSegment3>(&object)) ) {
> // Check if it is a segment otherwise error out
>
> std::cout<< "\nEncountered intersection object is a segment"<<
> std::endl;
> std::cout<< std::setw(12)<< std::setprecision( 15 )<< (*p_segm)<<
> std::endl;
> }
> else {
> std::cerr<< "\nInvalid object returned by aaa_bb tree"<< std::endl;
> }
>
> return 0;
> }
>
>
> We got the following result which is obviously wrong as explained before.
>
> Segment query: 0.125 0 -0.125 0.25 0 -0.125
>
> Triangle: 0.2500001 0 -0.125 1.0278171 0 -0.125 1.0278171 0 -0.250001
>
> CGAL::do_intersect (0/1) = 0
>
> Encountered intersection object is a segment
> 0.125 0 -0.125 0.25 0 -0.125
>
>
> Can you explain why I am getting this result or if you can confirm if it is
> a bug ?
>
> Thanks,
> Piyush Gupta
> UIUC
>
> -----
> Piyush Gupta
> UIUC
> --
> View this message in context: http://cgal-discuss.949826.n4.nabble.com/CGAL-intersection-bug-URGENT-tp4536168p4536168.html
>
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
If you reply to this email, your message will be added to the discussion below:http://cgal-discuss.949826.n4.nabble.com/CGAL-intersection-bug-URGENT-tp4536168p4536884.html
Regards,
Piyush GuptaUniversity of Illinois at Urbana-Champaign
PhD candidate in Civil Engineering
Graduate Research Assistant
When I look in the glass I see that every line in my face means pessimism, but in spite of my face - that is my experience - I remain an optimist.
Graduate College Senator - Illinois Student Senate
When I look in the glass I see that every line in my face means pessimism, but in spite of my face - that is my experience - I remain an optimist.
Piyush Gupta
UIUC
UIUC
View this message in context: Re: CGAL "intersection" bug - URGENT
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] CGAL "intersection" bug - URGENT, gupta61, 04/05/2012
- Re: [cgal-discuss] CGAL "intersection" bug - URGENT, Sebastien Loriot (GeometryFactory), 04/06/2012
- [cgal-discuss] Re: CGAL "intersection" bug - URGENT, gupta61, 04/06/2012
- Re: [cgal-discuss] CGAL "intersection" bug - URGENT, Sebastien Loriot (GeometryFactory), 04/06/2012
Archive powered by MHonArc 2.6.16.