Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Delaunay 3D: Get triangle with info in vertices.
- Date: Mon, 06 May 2013 07:59:27 +0200
- Organization: GeometryFactory
On 05/04/2013 02:10 PM, Michael Kalygin wrote:
Hello everyone! I was trying to find a solution on the forum. But itNo, but you can still store the information outside of the class of use
seems that the problem is quite specific. Let me describe it. First of
all I'm using the next data structures:
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_with_info_3<double, K> Vb;
typedef CGAL::Triangulation_data_structure_3 Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay;
typedef K::Segment_3 Segment;
typedef K::Point_3 Point;
Note, that I'm using vertices with info, I need info() field to store my
custom data about vertices.
*The Method:* I have a method in my class, which finds a triangle of
Delaunay triangulation intersecting with segment [p, 0), where p and 0
are vectors in 3D space (p is an input parameter). The intersection
exists with guarantee and this intersection is a point. When the method
finds an intersection, it returns founded triangle. As a side effect it
assigns point of intersection to p.
*The Problem:* When I get triangle in the method, I actually lose info()
in its vertices. I need to get this info without any additional
operations. Previously, I was using nearest_vertex() method of a
triangulation, but it looks like a needless operation which slows down
my algorithm.
tr.vertex(0).info();*// This field doesn't exist.*
*The question:* Is there a way to get a triangle with info() in its
vertices?
a Facet together with the triangle (or simply use a Facet and create the
triangle on-the-fly is you only need it once).
*Additional question:* Is there a simple way to mark a cell, from whichYou can locate a cell containing p (using "locate" function) and walk from cells to cells.
I need to start a search of such triangle?
Sebastien.
*The Code:*
Delaunay::Triangle ADMath::ProjectAndLocatePoint(Point&p)
{
const double EPS = 0.01;
Delaunay::Triangle tr;
Segment seg = Segment(p, Point(p.x() * EPS, p.y() * EPS, p.z() * EPS));
// Segment with excluded (0, 0, 0).
CGAL::Object intersection;
for (Delaunay::Finite_facets_iterator fit =
ADMath::triangulation->finite_facets_begin(); fit !=
ADMath::triangulation->finite_facets_end(); ++fit) {
tr = ADMath::triangulation->triangle(*fit);*// THE PROBLEM IS HERE*
if (CGAL::do_intersect(seg, tr)) {
intersection = CGAL::intersection(seg, tr);
p = *CGAL::object_cast(&intersection); // Set p to its
projection on the triangle.
break;
}
}
return tr;
}
------------------------------------------------------------------------
View this message in context: Delaunay 3D: Get triangle with info in
vertices.
<http://cgal-discuss.949826.n4.nabble.com/Delaunay-3D-Get-triangle-with-info-in-vertices-tp4657355.html>
Sent from the cgal-discuss mailing list archive
<http://cgal-discuss.949826.n4.nabble.com/> at Nabble.com.
- [cgal-discuss] Delaunay 3D: Get triangle with info in vertices., Michael Kalygin, 05/04/2013
- Re: [cgal-discuss] Delaunay 3D: Get triangle with info in vertices., Sebastien Loriot (GeometryFactory), 05/06/2013
- [cgal-discuss] Re: Delaunay 3D: Get triangle with info in vertices., Michael Kalygin, 05/08/2013
- Re: [cgal-discuss] Delaunay 3D: Get triangle with info in vertices., Sebastien Loriot (GeometryFactory), 05/06/2013
Archive powered by MHonArc 2.6.18.