Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?
Chronological Thread
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?
- Date: Mon, 27 Jun 2011 15:16:15 +0200
As Mariette indicated, what is observed in your case is due to the fact
that your inputs are on a regular grid (thus a degenerate input).
Consider the case of a triangulation in 2D of four points on a circle. The circumcenter of the two triangles is the same.
Sebastien.
randooom wrote:
Following a minimal(-ish) example, which mostly resembles my actual code.
I hope it is clear as is, but if not please feel free to ask for
clarification.
Compiled with gcc version 4.6.0. with following flags:
g++ -lCGAL -lCGAL_Core -lmpfr -lgmp -frounding-math -W -Wall -Wextra
-Wshadow -Wfloat-equal -Werror -g -O0 Test.cpp -o Test
Now the code:
///////////////////////////////////////////////////////////////////Test.cpp////////////////
#include <iostream>
#include <vector>
#include
<CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
#include <CGAL/Regular_triangulation_3.h>
#include <CGAL/Regular_triangulation_euclidean_traits_3.h>
int main()
{
typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt
Kernel;
typedef CGAL::Regular_triangulation_euclidean_traits_3<Kernel>
RegularTriangulationTraits;
typedef CGAL::Regular_triangulation_3<RegularTriangulationTraits>
Regular_Triangulation;
typedef Regular_Triangulation::Finite_facets_iterator
Finite_facets_iterator;
typedef RegularTriangulationTraits::Weighted_point_3 Weighted_point;
typedef RegularTriangulationTraits::Bare_point Point;
typedef Kernel::FT FT;
typedef std::vector<Weighted_point> WeightedPointContainer;
WeightedPointContainer weightedPoints;
/////////////////////
// This part basically takes one point and continues it in 26 space
directions by offset.
// So each point input generates 27 points in space.
FT x(0.5);
FT y(0.5);
FT z(0.5);
FT weight(1);
FT offset(1);
const int a[3] = {-1 , 0, 1};
for(int iX = 0; iX < 3; ++iX)
{
for(int iY = 0; iY < 3; ++iY)
{
for(int iZ = 0; iZ < 3; ++iZ)
{
weightedPoints.push_back(Weighted_point(Point(x + a[iX] *
offset,
y + a[iY] *
offset,
z + a[iZ] *
offset),
weight));
}
}
}
/////////////////////
/////////////////////
// Following the triangulation of the afore generated points and
// checking the dual edges of each finite_facet.
Regular_Triangulation triangulation(weightedPoints.begin(),
weightedPoints.end());
assert(triangulation.is_valid());
for(Finite_facets_iterator itFinFacet =
triangulation.finite_facets_begin();
itFinFacet != triangulation.finite_facets_end(); ++ itFinFacet)
{
typedef Kernel::Segment_3 Segment;
CGAL::Object o = triangulation.dual(*itFinFacet);
const Segment * pSegment = CGAL::object_cast<Segment>(&o);
if(!pSegment)
{
// check only the Segments.
continue;
}
assert(pSegment->source() != pSegment->target());
}
/////////////////////
return 0;
}
///////////////////////////////////////////////////////////////////Test.cpp
Code aborts with "[...]Assertion `pSegment->source() != pSegment->target()'
failed."
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Why-does-Regular-triangulation-3-dual-Facet-f-sometimes-return-a-edge-with-identical-source-and-targ-tp3625888p3627638.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, randooom, 06/26/2011
- [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, randooom, 06/26/2011
- Re: [cgal-discuss] Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, Sebastien Loriot (GeometryFactory), 06/27/2011
- Re: [cgal-discuss] Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, Mariette Yvinec, 06/27/2011
- [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, randooom, 06/27/2011
- Re: [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, Sebastien Loriot (GeometryFactory), 06/27/2011
- [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, randooom, 06/27/2011
- Re: [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, Sebastien Loriot (GeometryFactory), 06/27/2011
- Re: [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, Mariette Yvinec, 06/27/2011
- Re: [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, Monique Teillaud, 06/27/2011
- [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, randooom, 06/27/2011
- Re: [cgal-discuss] Re: Why does Regular_triangulation_3::dual( Facet f) sometimes return a edge with identical source and target?, Sebastien Loriot (GeometryFactory), 06/27/2011
Archive powered by MHonArc 2.6.16.