Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Question about mesh simplification

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Question about mesh simplification


Chronological Thread 
  • From: "Pablo Carneiro Elias" <>
  • To:
  • Subject: Re: [cgal-discuss] Question about mesh simplification
  • Date: Thu, 29 Nov 2007 15:51:47 -0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=kqT+xPJsJyGFoUbNj8TT3l1YWlUL/jTYMo82sBizCQsFP9rkqNmLK0QqPrReZyKJWIGTi2l60gN7RNqKs7o/UKV3xzSdU6I2ags7dlvWocV23lpawMIIHAJ+F/hMYUgrkSQq1Dn5piSPLW70DikS7vjUR91HDf0ijIx4R3YdW/s=

Hi, thanks for the fast reply... I've tried it using the default criteria too (LindstromTurk) and the stop criteria as Count_stop_predicate. But the result was the same... no edges removed... I'm importing the model from the OpenSceneGraph loader and then for each triangle in the model I'm pushing it to a Polyhedron_3: here's how I create the triangles within the Polyhedron:

(The below function is called for each triangle in the model)

inline void operator() ( const osg::Vec3 &v1, const osg::Vec3 &v2, const osg::Vec3 &v3, bool )
  {
        if ( &v1 == &v2 || &v1 == &v3 || &v2 == &v3 )
            return;
            _p->make_triangle(
                                             CGAL::Point_3<Kernel>( v1[0], v1[1], v1[2] ),
                                             CGAL::Point_3<Kernel>( v2[0], v2[1], v2[2] ), 
                                             CGAL::Point_3<Kernel>( v3[0], v3[1], v3[2] )
                                       );

    }



then, by this point all triangles were pushed into the Polyhedron named 'P'.. it is going to be used below...

    // This is a stop predicate (defines when the algorithm terminates).
    // In this example, the simplification stops when the number of undirected edges
    // left in the surface drops below the specified number (1000)
    SMS::Count_stop_predicate<Surface> stop(1000);

    // 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::cout << "\nFinished...\n" << r << " edges removed.\n"
        << (P.size_of_halfedges()/2) << " final edges.\n" ;


No edges were removed... but rendering the model using lines I can see there are many walls composed by many triangles combined together, and so there many "removable" edges that I wish to remove...

thanks

[]'s

2007/11/29, Fernando Cacciola <>:
Hello Pablo,

> Hi, every one, I'm trying to use CGAL to simplify a mesh which is already
> simple, but has some unnecessary edges. The mesh is a model created by 3d
> MAX of a building. The walls hav sometimes many triangles in it which adds
> many unnecessary edges... My goal is to remove this triangles.. a simple
> test is to check if adjacent triangle has very near normals, but I dont want
> to do this by my self, im trying to use cgal to do something like this. I
> have taken all triangles from the model and I've added it to a Polyhedron
> just like in the examples provided in the official website (Polyhedron P;
> P.make_triangle( P1, P2, P3) .... for each triangle)...
>
> The result is that no edges were removed... so I don't know what do i need
> to do.. My polycies are :
> SMS::Edge_length_cost   and SMS::Midpoint_placement using the ratio stop
> criteria... Shouldn't the walls composed by many triangles be simplified?
>

What's the stop condition?

What happens if you use the LindstromTurk policies?
(which btw are much more likely to give you the expected results)


HTH

Fernando Cacciola
GeometryFactory
--
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