Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Problem working on very large union_of_balls mesh

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Problem working on very large union_of_balls mesh


Chronological Thread 
  • From: Nico Kruithof <>
  • To:
  • Subject: Re: [cgal-discuss] Problem working on very large union_of_balls mesh
  • Date: Thu, 03 Apr 2008 08:41:59 +0200

Hi,

I don't know too much about the mesh simplification algorithm, so I
can't help you there. From the skin surface point of view, I would
suggest to put
---
Union_of_balls_3 union_of_balls(ball_set.begin(), ball_set.end(),
Traits(), true);
CGAL::mesh_union_of_balls_3(union_of_balls, p);
---
in a block:
---
{
Union_of_balls_3 union_of_balls(ball_set.begin(), ball_set.end(),
Traits(), true);
CGAL::mesh_union_of_balls_3(union_of_balls, p);
}
---
This because the Union_of_balls_3 constructs a rather large
triangulation internally to be able to mesh the union of ball. The block
will make sure that the destructor of union_of_balls is called and the
memory is freed. Especially since you have many points.

Could you check as well that the polyhedron is valid (p.is_valid())
after mesh_union_of_balls_3()? Just to make sure you have a valid
polyhedron to start the simplification with.

Nico

>
On Wed, 2008-04-02 at 17:54 +0200,

wrote:
> I am having a problem operating on a union of balls mesh. Code compiles
> and runs without errors, but it seems when the number of vertices goes over
> about 2 million, I get a run-time error if I either a)try to output the
> mesh to an OFF or b) try to simplify the mesh using the mesh simplification
> routine. Code works fine when there is under 2 million vertices. Here are
> my constructors:
>
> ///////////////////////
> typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
> typedef CGAL::Skin_surface_traits_3<K> Traits;
> typedef CGAL::Union_of_balls_3<Traits>
> Union_of_balls_3;
> typedef Union_of_balls_3::Weighted_point Weighted_point;
> typedef Weighted_point::Point Bare_point;
> typedef CGAL::Polyhedron_3<K,
> CGAL::Skin_surface_polyhedral_items_3<Union_of_balls_3> > Polyhedron;
>
> namespace SMS = CGAL::Surface_mesh_simplification ;
>
> Polyhedron p;
> //////////////////////
>
> after adding the balls, here is my code to create the mesh and simplify,
> just as with the related example from the manual:
>
> ///////////////////////
> Union_of_balls_3 union_of_balls(ball_set.begin(), ball_set.end(),
> Traits(), true);
> CGAL::mesh_union_of_balls_3(union_of_balls, p);
>
> SMS::Count_stop_predicate<Polyhedron> stop(ball_set.size());
>
> // This the actual call to the simplification algorithm.
> // The surface and stop conditions are mandatory arguments.
> // The index maps are needed because the vertices and edges
> // of this surface lack an "id()" field.
> int r = SMS::edge_collapse
> (p
> ,stop
> ,CGAL::vertex_index_map(boost::get(CGAL::vertex_external_index,
> p))
> .edge_index_map (boost::get(CGAL::edge_external_index ,
> p))
> );
>
> std::ofstream out("output.off");
> out << p;
> /////////////////////////
>
> Is there some hard limit to the number of vertices that can be processed?
> Am I using the wrong kernel? Any help is appreciated.
>
> BM




Archive powered by MHonArc 2.6.16.

Top of Page