Subject: CGAL users discussion list
List archive
- From: omar rodriguez <>
- To:
- Subject: Re: [cgal-discuss] 3D alpha shapes to Polyhedrons
- Date: Mon, 9 Mar 2009 15:12:05 -0600
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=hxbXUgpgMMt/nFDXeiOUXVgSy/v69akrYy1oUOL1AHZ6qCYbx/Y3BReV7BHsUZac1N tSfAaikrcdGy0zy3myjX311FEJyCdKQjVg9ByziUOfBikgWV3xVSm1OP+GSEmIB9psIe Q1eo/+miI4VwZHe1bdn5Cv1bXi9+vt8jbqoww=
Well, right now I am only using facets classified as Alpha_shape_3::REGULAR
The following is the code that I am using to change from alpha shape
to polyhedron, maybe I am missing something
----
void operator()(HDS& hds){
std::list<FacetA> facets;
std::list<FacetA>::iterator facetIterator;
std::list<Vertex_handleA> vertices;
QHash<QString, int> addedPoints;
std::vector<int> toAdd;
Cell_handleA cellHandler;
int index;
__as->get_alpha_shape_facets(std::back_inserter(facets),
Alpha_shape_3::REGULAR);
__as->get_alpha_shape_vertices(std::back_inserter(vertices),
Alpha_shape_3::REGULAR);
std::cout << "Solids " << __as->number_of_solid_components()
<< "\n";
CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true);
B.begin_surface( vertices.size(), facets.size());
int addedVertices = 0;
for (facetIterator = facets.begin(); facetIterator !=
facets.end();
++facetIterator) {
cellHandler = facetIterator->first;
index = facetIterator->second;
// the following ensures that regular facets are
output
// in ccw order
if ((__as->classify(*facetIterator) ==
Alpha_shape_3::REGULAR) &&
(__as->classify(cellHandler) ==
Alpha_shape_3::INTERIOR)) {
cellHandler = cellHandler->neighbor(index);
index =
cellHandler->index(facetIterator->first);
}
int current;
toAdd.clear();
for (int k = 0; k<3; k++) {
current =
Alpha_shape_3::Triangulation_utils_3::vertex_triple_index(index,
k);
QString key = pointToString(
cellHandler->vertex(current)->point() );
// add vertex to polyhedron only once
if (addedPoints.contains( key ) ) {
toAdd.push_back( addedPoints[ key ] );
}
else {
B.add_vertex(
cellHandler->vertex(current)->point() );
addedPoints[ key ] = addedVertices;
toAdd.push_back(addedVertices);
addedVertices++;
}
}
if ( B.test_facet( toAdd.begin(), toAdd.end() ) ) {
B.begin_facet();
for (int i=0; i < 3; i++) {
B.add_vertex_to_facet(toAdd[i]);
}
B.end_facet();
}
else {
std::cout << " could not add facet \n";
}
}
B.end_surface();
}
-----
Omar
+
On Mon, Mar 9, 2009 at 3:04 AM, Benjamin schwarz
<>
wrote:
> Hello Omar,
>
> May the problem be due to the presence of singular facets or
> quasi-manifolds (for instance two 3-simplices connected only by a
> vertex) ?
>
> Ben
>
> On Sun, Mar 8, 2009 at 6:48 AM, omar rodriguez
> <>
> wrote:
>> Hello, sorry if this topic has been covered already, I tried searching
>> the archives but they seem to be down at the moment.
>>
>>
>> I am using alpha shapes to get a shape from a set of points, and then
>> I convert it to a polyhedron using
>> CGAL::Polyhedron_incremental_builder_3 to get the boundary facets to
>> perform further operations.
>>
>> This works most of the time, but every so often I get the following error :
>>
>> ---
>> CGAL::Polyhedron_incremental_builder_3<HDS>::
>> add_vertex_to_facet(): input error: disconnected facet complexes at vertex
>> 636:
>> involved facets are: 472 470 471 (closed cycle) and.
>>
>> terminate called after throwing an instance of 'CGAL::Assertion_exception'
>> what(): CGAL ERROR: assertion violation!
>> Expr: check_protocoll == 1
>> File: ../../CGAL-3.4/include/CGAL/Polyhedron_incremental_builder_3.h
>> Line: 224
>> ---
>>
>> I have tried using different kernels but the error keeps popping up on
>> the polyhedron builder.
>>
>> Any help would be greatly appreciated.
>>
>> Omar
>>
>> +
>> --
>> You are currently subscribed to cgal-discuss.
>> To unsubscribe or access the archives, go to
>> https://lists-sop.inria.fr/wws/info/cgal-discuss
>>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
- [cgal-discuss] 3D alpha shapes to Polyhedrons, omar rodriguez, 03/08/2009
- Re: [cgal-discuss] 3D alpha shapes to Polyhedrons, Benjamin schwarz, 03/09/2009
- Re: [cgal-discuss] 3D alpha shapes to Polyhedrons, omar rodriguez, 03/09/2009
- Re: [cgal-discuss] 3D alpha shapes to Polyhedrons, Benjamin schwarz, 03/10/2009
- Re: [cgal-discuss] 3D alpha shapes to Polyhedrons, omar rodriguez, 03/10/2009
- Re: [cgal-discuss] 3D alpha shapes to Polyhedrons, Benjamin schwarz, 03/10/2009
- Re: [cgal-discuss] 3D alpha shapes to Polyhedrons, omar rodriguez, 03/09/2009
- Re: [cgal-discuss] 3D alpha shapes to Polyhedrons, Benjamin schwarz, 03/09/2009
Archive powered by MHonArc 2.6.16.