Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Finding intersection segment

Subject: CGAL users discussion list

List archive

[cgal-discuss] Finding intersection segment


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To: "" <>
  • Subject: [cgal-discuss] Finding intersection segment
  • Date: Tue, 20 Mar 2012 11:12:11 +0100

Note that the intersection might be not a segment.
See
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Function_intersection.html

Also if the triangle comes from the same polyhedron, you might want to use incidence of faces using opposite relations of halfedges.

Sebastien
Is the vector empty or
On Tuesday, March 20, 2012, Oleg <> wrote:
> Hi all! Another newbie question. I want to find intersection segment of two
> triangles. I take Polyhedron\polyhedron_self_intersection.cpp example as the
> starting point and add this piece of code:
>
> --> std::vector<Segment> segments;
> ...
> Triangle t1( h->vertex()->point(),
>                 h->next()->vertex()->point(),
>                 h->next()->next()->vertex()->point());
> Triangle t2( g->vertex()->point(),
>                 g->next()->vertex()->point(),
>                 g->next()->next()->vertex()->point());
> if ( CGAL::do_intersect( t1, t2)) {
> //cerr << "Triangles intersect:\n    T1: " << t1 << "\n    T2 :"
> //     << t2 << endl;
> triangles.push_back(t1);
> triangles.push_back(t2);
> --> CGAL::Object obj = CGAL::intersection(t1, t2);
> --> Segment seg;
> --> if (assign(seg, obj)) segments.push_back(seg);
> }
> ...
>
> In the output I get empty vector segments. What I'm doing wrong?
>
> --
> View this message in context: http://cgal-discuss.949826.n4.nabble.com/Finding-intersection-segment-tp4488033p4488033.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://lists-sop.inria.fr/wws/info/cgal-discuss
>
>


Archive powered by MHonArc 2.6.16.

Top of Page