Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Triange/Triangle Intersection

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Triange/Triangle Intersection


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Triange/Triangle Intersection
  • Date: Thu, 12 May 2011 15:13:59 +0200

This is a documentation bug, the return type can also be Triangle_3.

S.

Bernhard Kornberger wrote:
Hello,

In CGAL 3.8 there is an option to intersect two 3D triangles,
where the return type is Point_3, Segment_3 or vector<Point_3>.

http://tinyurl.com/3ezcvbd

The return type "vector<Point_3>" seems to be undocumented, and I
assume that such a vector is returned in case of coplanar inter-
secting triangles, when the intersection is an area, right? I made
a test, and it does not work as expected, here is a minimal
example:


#include <stdio.h>
#include <iostream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef K::Triangle_3 Triangle_3;
typedef K::Point_3 Point_3;
typedef K::Segment_3 Segment_3;


using namespace std;


int main(int argc,char* argv[])
{

Point_3 a(0,0,0);
Point_3 b(0,1,0);
Point_3 c(1,1,0);
Point_3 d(0.5,1,0);
Point_3 e(3,1,0);
Triangle_3 t0(a,c,b);
Triangle_3 t1(a,e,d);

if(!do_intersect(t0,t1))
{
cout<<"No intersection"<<endl;
return 0;
}

vector<Point_3> vPoints;
Point_3 p;
Segment_3 seg;

CGAL::Object obj=CGAL::intersection(t0,t1);
if(CGAL::assign(p,obj)) cout<<"Intersection type: Point"<<endl;
else if(CGAL::assign(seg,obj)) cout<<"Intersection type: Segment"<<endl;
else if(CGAL::assign(vPoints,obj)) cout<<"Intersection type: Area"<<endl;
else cout<<"Hm?"<<endl;


return 0;
}

...says just "Hm?". Any hints?

Best regards
Bernhard Kornberger











Archive powered by MHonArc 2.6.16.

Top of Page