Is it possible to keep track of edges are collapsing in surface mesh?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to keep track of edges are collapsing in surface mesh?

Shrabani Ghosh
Hi,
I am working on surface_mesh_simplification.
I am referencing here this example.

https://doc.cgal.org/latest/Surface_mesh_simplification/Surface_mesh_simplification_2edge_collapse_visitor_surface_mesh_8cpp-example.html

I want to keep track of the edges are collapsing for further use.
Let's say, in my mesh, there are 10 edges.

I want to use keep trace if edges 5,6,7,8 are collapsing.
if 6 and 7 number edges are collapsed, I want to save the edge numbers.

And after collapsing edges on the first iteration, the ids of the edges
changes from the original mesh?

Thank you.
Shrabani Ghosh



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to keep track of edges are collapsing in surface mesh?

Sebastien Loriot (GeometryFactory)
You have the information about what will be collapsed in the visitor.
You are free to assign an id to the edge if needed using a hash map
if needed.

Sebastien.

On 10/11/19 5:57 AM, Shrabani Ghosh wrote:

> Hi,
> I am working on surface_mesh_simplification.
> I am referencing here this example.
>
> https://doc.cgal.org/latest/Surface_mesh_simplification/Surface_mesh_simplification_2edge_collapse_visitor_surface_mesh_8cpp-example.html
>
> I want to keep track of the edges are collapsing for further use.
> Let's say, in my mesh, there are 10 edges.
>
> I want to use keep trace if edges 5,6,7,8 are collapsing.
> if 6 and 7 number edges are collapsed, I want to save the edge numbers.
>
> And after collapsing edges on the first iteration, the ids of the edges
> changes from the original mesh?
>
> Thank you.
> Shrabani Ghosh
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to keep track of edges are collapsing in surface mesh?

Shrabani Ghosh
Thank You for your response.



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to keep track of edges are collapsing in surface mesh?

Shrabani Ghosh
In reply to this post by Sebastien Loriot (GeometryFactory)
Hi,

I assigned id to the halfedges. Like this : 
  for( Surface_mesh::Halfedge_iterator eb = surface_mesh.halfedges_begin()
     , ee = surface_mesh.halfedges_end()
     ; eb != ee
     ; ++ eb
     )
    eb->id() = index++;

But in the visitor, it does not print the original edges ids but just prints the increment numbers. How can I print in the visitor so that it shows the edge->id and I want to see the sequence of edge collapse? 

Edges collected: 23
Edges collapsed: 1
Edges collapsed: 2
Edges collapsed: 3
Edges collapsed: 4
Edges collapsed: 5
Edges collapsed: 6
Edges collapsed: 7
Edges collapsed: 8
Edges collapsed: 9
Edges non_collapsable: 1
Edges non_collapsable: 2
Edges non_collapsable: 3

Edges collected: 23
Edges processed: 12
Edges collapsed: 9

Edges not collapsed due to topological constraints: 3
Edge not collapsed due to cost computation constraints: 0
Edge not collapsed due to placement computation constraints: 0

Finished...
20 edges removed.
6 final  half edges.

These are the final halfedges ids. 
28
29
32
33
36
37


Thank You
Shrabani Ghosh

On Wed, Oct 16, 2019 at 3:10 AM Sebastien Loriot (GeometryFactory) <[hidden email]> wrote:
You have the information about what will be collapsed in the visitor.
You are free to assign an id to the edge if needed using a hash map
if needed.

Sebastien.

On 10/11/19 5:57 AM, Shrabani Ghosh wrote:
> Hi,
> I am working on surface_mesh_simplification.
> I am referencing here this example.
>
> https://doc.cgal.org/latest/Surface_mesh_simplification/Surface_mesh_simplification_2edge_collapse_visitor_surface_mesh_8cpp-example.html
>
> I want to keep track of the edges are collapsing for further use.
> Let's say, in my mesh, there are 10 edges.
>
> I want to use keep trace if edges 5,6,7,8 are collapsing.
> if 6 and 7 number edges are collapsed, I want to save the edge numbers.
>
> And after collapsing edges on the first iteration, the ids of the edges
> changes from the original mesh?
>
> Thank you.
> Shrabani Ghosh
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to keep track of edges are collapsing in surface mesh?

Sebastien Loriot (GeometryFactory)
If you assigned your ids like you shown, then the number printed in the
visitor should be the same.
If not there must be some issue in your code as no new halfedge is
created by the simplification package.

Sebastien.

On 10/17/19 4:18 AM, Shrabani Ghosh wrote:

> Hi,
>
> I assigned id to the halfedges. Like this :
>    for( Surface_mesh::Halfedge_iterator eb = surface_mesh.halfedges_begin()
>       , ee = surface_mesh.halfedges_end()
>       ; eb != ee
>       ; ++ eb
>       )
>      eb->id() = index++;
>
> But in the visitor, it does not print the original edges ids but just
> prints the increment numbers. How can I print in the visitor so that it
> shows the edge->id and I want to see the sequence of edge collapse?
>
> Edges collected: 23
> Edges collapsed: 1
> Edges collapsed: 2
> Edges collapsed: 3
> Edges collapsed: 4
> Edges collapsed: 5
> Edges collapsed: 6
> Edges collapsed: 7
> Edges collapsed: 8
> Edges collapsed: 9
> Edges non_collapsable: 1
> Edges non_collapsable: 2
> Edges non_collapsable: 3
>
> Edges collected: 23
> Edges processed: 12
> Edges collapsed: 9
>
> Edges not collapsed due to topological constraints: 3
> Edge not collapsed due to cost computation constraints: 0
> Edge not collapsed due to placement computation constraints: 0
>
> Finished...
> 20 edges removed.
> 6 final  half edges.
>
> These are the final halfedges ids.
> 28
> 29
> 32
> 33
> 36
> 37
>
>
> Thank You
> Shrabani Ghosh
>
> On Wed, Oct 16, 2019 at 3:10 AM Sebastien Loriot (GeometryFactory)
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     You have the information about what will be collapsed in the visitor.
>     You are free to assign an id to the edge if needed using a hash map
>     if needed.
>
>     Sebastien.
>
>     On 10/11/19 5:57 AM, Shrabani Ghosh wrote:
>      > Hi,
>      > I am working on surface_mesh_simplification.
>      > I am referencing here this example.
>      >
>      >
>     https://doc.cgal.org/latest/Surface_mesh_simplification/Surface_mesh_simplification_2edge_collapse_visitor_surface_mesh_8cpp-example.html
>      >
>      > I want to keep track of the edges are collapsing for further use.
>      > Let's say, in my mesh, there are 10 edges.
>      >
>      > I want to use keep trace if edges 5,6,7,8 are collapsing.
>      > if 6 and 7 number edges are collapsed, I want to save the edge
>     numbers.
>      >
>      > And after collapsing edges on the first iteration, the ids of the
>     edges
>      > changes from the original mesh?
>      >
>      > Thank you.
>      > Shrabani Ghosh
>      >
>      >
>      >
>      > --
>      > Sent from: http://cgal-discuss.949826.n4.nabble.com/
>      >
>
>     --
>     You are currently subscribed to cgal-discuss.
>     To unsubscribe or access the archives, go to
>     https://sympa.inria.fr/sympa/info/cgal-discuss
>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to keep track of edges are collapsing in surface mesh?

Shrabani Ghosh
Hi, 
Could you please look into the code and tell me what am I doing wrong?


I#include <iostream>
#include <fstream>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
// Simplification function
#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
// Visitor base
#include <CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h>
// Extended polyhedron items which include an id() field
#include <CGAL/Polyhedron_items_with_id_3.h>
// Stop-condition policy
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h>
// Non-default cost and placement policies
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_and_length.h> 

typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point ;
                       
//
// Setup an enriched polyhedron type which stores an id() field in the items
//
typedef CGAL::Polyhedron_3<Kernel,CGAL::Polyhedron_items_with_id_3> Surface_mesh;
typedef Surface_mesh::Halfedge_handle Halfedge_handle ;
typedef Surface_mesh::Vertex_handle   Vertex_handle ;
namespace SMS = CGAL::Surface_mesh_simplification ;
typedef SMS::Edge_profile<Surface_mesh> Profile ;


// The following is a Visitor that keeps track of the simplification process.
// In this example the progress is printed real-time and a few statistics are
// recorded (and printed in the end).
//
struct Stats
{
  Stats()
    : collected(0)
    , processed(0)
    , collapsed(0)
    , non_collapsable(0)
    , cost_uncomputable(0)
    , placement_uncomputable(0)
  {}
 
  std::size_t collected ;
  std::size_t processed ;
  std::size_t collapsed ;
  std::size_t non_collapsable ;
  std::size_t cost_uncomputable  ;
  std::size_t placement_uncomputable ;
} ;

struct My_visitor : SMS::Edge_collapse_visitor_base<Surface_mesh>
{
  My_visitor( Stats* s) : stats(s){}

  // Called during the collecting phase for each edge collected.
  void OnCollected( Profile const&, boost::optional<double> const& )
  {
   // std::cerr <<  stats->id() << std::endl;
    ++ stats->collected ;
    std::cerr << "\rEdges collected: " << stats->collected << std::flush ;
  }                
 
  // Called during the processing phase for each edge selected.
  // If cost is absent the edge won't be collapsed.
  void OnSelected(Profile const&          
                 ,boost::optional<double> cost
                 ,std::size_t             initial
                 ,std::size_t             current
                 )
  {
    ++ stats->processed ;
    if ( !cost )
      ++ stats->cost_uncomputable ;
     
    if ( current == initial ){
      std::cerr << "\n" << std::flush ;
//     std::cout <<  current->id()<< std::endl;
}
    std::cerr << "\r" <<"current " << current <<  std::endl;
  }                
 
  // Called during the processing phase for each edge being collapsed.
  // If placement is absent the edge is left uncollapsed.
  void OnCollapsing(Profile const&          
                   ,boost::optional<Point>  placement
                   )
  {
    if ( !placement )
      ++ stats->placement_uncomputable ;
  }                
 
  // Called for each edge which failed the so called link-condition,
  // that is, which cannot be collapsed because doing so would
  // turn the surface mesh into a non-manifold.
  void OnNonCollapsable( Profile const& )
  {
    ++ stats->non_collapsable;  std::cerr << "\rEdges non_collapsable: " << stats->non_collapsable << std::endl ;

  }                
 
  // Called AFTER each edge has been collapsed
  void OnCollapsed( Profile const&, Vertex_handle )
  {
   
    ++ stats->collapsed;  std::cerr << "\rEdges collapsed: " << stats->collapsed << std::endl ;
  }                
 
  Stats* stats ;
} ;


int main( int argc, char** argv )
{
  Surface_mesh surface_mesh;
 
  std::ifstream is("../data/eight.off") ; is >> surface_mesh ;


  // The items in this polyhedron have an "id()" field
  // which the default index maps used in the algorithm
  // need to get the index of a vertex/edge.
  // However, the Polyhedron_3 class doesn't assign any value to
  // this id(), so we must do it here:
  int index = 0 ;
 
  for( Surface_mesh::Halfedge_iterator eb = surface_mesh.halfedges_begin()
     , ee = surface_mesh.halfedges_end()
     ; eb != ee
     ; ++ eb
     )
    eb->id() = index++;
   index = 0 ;
/*
 for( Surface_mesh::Edge_iterator eb = surface_mesh.edges_begin()
     , ee = surface_mesh.edges_end()
     ; eb != ee
     ; ++ eb
     )
    eb->id() = index++;
*/

  index = 0 ;
  for( Surface_mesh::Vertex_iterator vb = surface_mesh.vertices_begin()
     , ve = surface_mesh.vertices_end()
     ; vb != ve
     ; ++ vb
     )
    vb->id() = index++;
   
  // In this example, the simplification stops when the number of undirected edges
  // drops below 10% of the initial count
  SMS::Count_ratio_stop_predicate<Surface_mesh> stop(0.1);
 
  Stats stats ;
  std::cout <<  "half_edges .\n"
            << (surface_mesh.size_of_halfedges()) << "\n" ;

  My_visitor vis(&stats) ;
   
  // The index maps are not explicitelty passed as in the previous
  // example because the surface mesh items have a proper id() field.
  // On the other hand, we pass here explicit cost and placement
  // function which differ from the default policies, ommited in
  // the previous example.
  int r = SMS::edge_collapse
           (surface_mesh
           ,stop
            ,CGAL::parameters::get_cost     (SMS::Edge_length_cost  <Surface_mesh>())
                              .get_placement(SMS::Midpoint_placement<Surface_mesh>())
                              .visitor      (vis)
           );
 
  std::cout << "\nEdges collected: "  << stats.collected
            << "\nEdges proccessed: " << stats.processed
            << "\nEdges collapsed: "  << stats.collapsed
            << std::endl
            << "\nEdges not collapsed due to topological constraints: "  << stats.non_collapsable
            << "\nEdge not collapsed due to cost computation constraints: "  << stats.cost_uncomputable
            << "\nEdge not collapsed due to placement computation constraints: " << stats.placement_uncomputable
            << std::endl ;
           
  std::cout << "\nFinished...\n" << r << " edges removed.\n"
            << (surface_mesh.size_of_halfedges()/2) << " final edges.\n" ;
 //  for( Surface_mesh::Halfedge_iterator eb = surface_mesh.halfedges_begin()  , ee = surface_mesh.halfedges_end()  ; eb != ee ; ++ eb )
 //  std::cout <<eb->id() << std::endl;      
 
   for( Surface_mesh::Edge_iterator eb = surface_mesh.edges_begin()
     , ee = surface_mesh.edges_end()
     ; eb != ee
     ; ++ eb
     )
   std::cout <<eb->id()/2 << std::endl;      
 // std::ofstream os( argc > 2 ? argv[2] : "out.off" ) ; os << surface_mesh ;
 
  return EXIT_SUCCESS ;      
}


On Thu, Oct 17, 2019 at 2:30 AM Sebastien Loriot (GeometryFactory) <[hidden email]> wrote:
If you assigned your ids like you shown, then the number printed in the
visitor should be the same.
If not there must be some issue in your code as no new halfedge is
created by the simplification package.

Sebastien.

On 10/17/19 4:18 AM, Shrabani Ghosh wrote:
> Hi,
>
> I assigned id to the halfedges. Like this :
>    for( Surface_mesh::Halfedge_iterator eb = surface_mesh.halfedges_begin()
>       , ee = surface_mesh.halfedges_end()
>       ; eb != ee
>       ; ++ eb
>       )
>      eb->id() = index++;
>
> But in the visitor, it does not print the original edges ids but just
> prints the increment numbers. How can I print in the visitor so that it
> shows the edge->id and I want to see the sequence of edge collapse?
>
> Edges collected: 23
> Edges collapsed: 1
> Edges collapsed: 2
> Edges collapsed: 3
> Edges collapsed: 4
> Edges collapsed: 5
> Edges collapsed: 6
> Edges collapsed: 7
> Edges collapsed: 8
> Edges collapsed: 9
> Edges non_collapsable: 1
> Edges non_collapsable: 2
> Edges non_collapsable: 3
>
> Edges collected: 23
> Edges processed: 12
> Edges collapsed: 9
>
> Edges not collapsed due to topological constraints: 3
> Edge not collapsed due to cost computation constraints: 0
> Edge not collapsed due to placement computation constraints: 0
>
> Finished...
> 20 edges removed.
> 6 final  half edges.
>
> These are the final halfedges ids.
> 28
> 29
> 32
> 33
> 36
> 37
>
>
> Thank You
> Shrabani Ghosh
>
> On Wed, Oct 16, 2019 at 3:10 AM Sebastien Loriot (GeometryFactory)
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     You have the information about what will be collapsed in the visitor.
>     You are free to assign an id to the edge if needed using a hash map
>     if needed.
>
>     Sebastien.
>
>     On 10/11/19 5:57 AM, Shrabani Ghosh wrote:
>      > Hi,
>      > I am working on surface_mesh_simplification.
>      > I am referencing here this example.
>      >
>      >
>     https://doc.cgal.org/latest/Surface_mesh_simplification/Surface_mesh_simplification_2edge_collapse_visitor_surface_mesh_8cpp-example.html
>      >
>      > I want to keep track of the edges are collapsing for further use.
>      > Let's say, in my mesh, there are 10 edges.
>      >
>      > I want to use keep trace if edges 5,6,7,8 are collapsing.
>      > if 6 and 7 number edges are collapsed, I want to save the edge
>     numbers.
>      >
>      > And after collapsing edges on the first iteration, the ids of the
>     edges
>      > changes from the original mesh?
>      >
>      > Thank you.
>      > Shrabani Ghosh
>      >
>      >
>      >
>      > --
>      > Sent from: http://cgal-discuss.949826.n4.nabble.com/
>      >
>
>     --
>     You are currently subscribed to cgal-discuss.
>     To unsubscribe or access the archives, go to
>     https://sympa.inria.fr/sympa/info/cgal-discuss
>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to keep track of edges are collapsing in surface mesh?

Sebastien Loriot (GeometryFactory)
I don't see any place in your code where you print the halfedge indices.

Sebastien.

On 10/17/19 8:06 PM, Shrabani Ghosh wrote:

> Hi,
> Could you please look into the code and tell me what am I doing wrong?
>
>
> I#include <iostream>
> #include <fstream>
> #include <CGAL/Simple_cartesian.h>
> #include <CGAL/Polyhedron_3.h>
> // Simplification function
> #include <CGAL/Surface_mesh_simplification/edge_collapse.h>
> // Visitor base
> #include <CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h>
> // Extended polyhedron items which include an id() field
> #include <CGAL/Polyhedron_items_with_id_3.h>
> // Stop-condition policy
> #include
> <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h>
> // Non-default cost and placement policies
> #include
> <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_and_length.h>
>
>
> typedef CGAL::Simple_cartesian<double> Kernel;
> typedef Kernel::Point_3 Point ;
>
> //
> // Setup an enriched polyhedron type which stores an id() field in the items
> //
> typedef CGAL::Polyhedron_3<Kernel,CGAL::Polyhedron_items_with_id_3>
> Surface_mesh;
> typedef Surface_mesh::Halfedge_handle Halfedge_handle ;
> typedef Surface_mesh::Vertex_handle   Vertex_handle ;
> namespace SMS = CGAL::Surface_mesh_simplification ;
> typedef SMS::Edge_profile<Surface_mesh> Profile ;
>
>
> // The following is a Visitor that keeps track of the simplification
> process.
> // In this example the progress is printed real-time and a few
> statistics are
> // recorded (and printed in the end).
> //
> struct Stats
> {
>    Stats()
>      : collected(0)
>      , processed(0)
>      , collapsed(0)
>      , non_collapsable(0)
>      , cost_uncomputable(0)
>      , placement_uncomputable(0)
>    {}
>
>    std::size_t collected ;
>    std::size_t processed ;
>    std::size_t collapsed ;
>    std::size_t non_collapsable ;
>    std::size_t cost_uncomputable  ;
>    std::size_t placement_uncomputable ;
> } ;
>
> struct My_visitor : SMS::Edge_collapse_visitor_base<Surface_mesh>
> {
>    My_visitor( Stats* s) : stats(s){}
>
>    // Called during the collecting phase for each edge collected.
>    void OnCollected( Profile const&, boost::optional<double> const& )
>    {
>     // std::cerr <<  stats->id() << std::endl;
>      ++ stats->collected ;
>      std::cerr << "\rEdges collected: " << stats->collected << std::flush ;
>    }
>
>    // Called during the processing phase for each edge selected.
>    // If cost is absent the edge won't be collapsed.
>    void OnSelected(Profile const&
>                   ,boost::optional<double> cost
>                   ,std::size_t             initial
>                   ,std::size_t             current
>                   )
>    {
>      ++ stats->processed ;
>      if ( !cost )
>        ++ stats->cost_uncomputable ;
>
>      if ( current == initial ){
>        std::cerr << "\n" << std::flush ;
> //     std::cout <<  current->id()<< std::endl;
> }
>      std::cerr << "\r" <<"current " << current <<  std::endl;
>    }
>
>    // Called during the processing phase for each edge being collapsed.
>    // If placement is absent the edge is left uncollapsed.
>    void OnCollapsing(Profile const&
>                     ,boost::optional<Point>  placement
>                     )
>    {
>      if ( !placement )
>        ++ stats->placement_uncomputable ;
>    }
>
>    // Called for each edge which failed the so called link-condition,
>    // that is, which cannot be collapsed because doing so would
>    // turn the surface mesh into a non-manifold.
>    void OnNonCollapsable( Profile const& )
>    {
>      ++ stats->non_collapsable;  std::cerr << "\rEdges non_collapsable:
> " << stats->non_collapsable << std::endl ;
>
>    }
>
>    // Called AFTER each edge has been collapsed
>    void OnCollapsed( Profile const&, Vertex_handle )
>    {
>
>      ++ stats->collapsed;  std::cerr << "\rEdges collapsed: " <<
> stats->collapsed << std::endl ;
>    }
>
>    Stats* stats ;
> } ;
>
>
> int main( int argc, char** argv )
> {
>    Surface_mesh surface_mesh;
>
>    std::ifstream is("../data/eight.off") ; is >> surface_mesh ;
>
>
>    // The items in this polyhedron have an "id()" field
>    // which the default index maps used in the algorithm
>    // need to get the index of a vertex/edge.
>    // However, the Polyhedron_3 class doesn't assign any value to
>    // this id(), so we must do it here:
>    int index = 0 ;
>
>    for( Surface_mesh::Halfedge_iterator eb = surface_mesh.halfedges_begin()
>       , ee = surface_mesh.halfedges_end()
>       ; eb != ee
>       ; ++ eb
>       )
>      eb->id() = index++;
>     index = 0 ;
> /*
>   for( Surface_mesh::Edge_iterator eb = surface_mesh.edges_begin()
>       , ee = surface_mesh.edges_end()
>       ; eb != ee
>       ; ++ eb
>       )
>      eb->id() = index++;
> */
>
>    index = 0 ;
>    for( Surface_mesh::Vertex_iterator vb = surface_mesh.vertices_begin()
>       , ve = surface_mesh.vertices_end()
>       ; vb != ve
>       ; ++ vb
>       )
>      vb->id() = index++;
>
>    // In this example, the simplification stops when the number of
> undirected edges
>    // drops below 10% of the initial count
>    SMS::Count_ratio_stop_predicate<Surface_mesh> stop(0.1);
>
>    Stats stats ;
>    std::cout <<  "half_edges .\n"
>              << (surface_mesh.size_of_halfedges()) << "\n" ;
>
>    My_visitor vis(&stats) ;
>
>    // The index maps are not explicitelty passed as in the previous
>    // example because the surface mesh items have a proper id() field.
>    // On the other hand, we pass here explicit cost and placement
>    // function which differ from the default policies, ommited in
>    // the previous example.
>    int r = SMS::edge_collapse
>             (surface_mesh
>             ,stop
>              ,CGAL::parameters::get_cost     (SMS::Edge_length_cost
>   <Surface_mesh>())
>                                
> .get_placement(SMS::Midpoint_placement<Surface_mesh>())
>                                .visitor      (vis)
>             );
>
>    std::cout << "\nEdges collected: "  << stats.collected
>              << "\nEdges proccessed: " << stats.processed
>              << "\nEdges collapsed: "  << stats.collapsed
>              << std::endl
>              << "\nEdges not collapsed due to topological constraints: "
>   << stats.non_collapsable
>              << "\nEdge not collapsed due to cost computation
> constraints: "  << stats.cost_uncomputable
>              << "\nEdge not collapsed due to placement computation
> constraints: " << stats.placement_uncomputable
>              << std::endl ;
>
>    std::cout << "\nFinished...\n" << r << " edges removed.\n"
>              << (surface_mesh.size_of_halfedges()/2) << " final edges.\n" ;
>   //  for( Surface_mesh::Halfedge_iterator eb =
> surface_mesh.halfedges_begin()  , ee = surface_mesh.halfedges_end()  ;
> eb != ee ; ++ eb )
>   //  std::cout <<eb->id() << std::endl;
>
>     for( Surface_mesh::Edge_iterator eb = surface_mesh.edges_begin()
>       , ee = surface_mesh.edges_end()
>       ; eb != ee
>       ; ++ eb
>       )
>     std::cout <<eb->id()/2 << std::endl;
>   // std::ofstream os( argc > 2 ? argv[2] : "out.off" ) ; os <<
> surface_mesh ;
>
>    return EXIT_SUCCESS ;
> }
>
>
> On Thu, Oct 17, 2019 at 2:30 AM Sebastien Loriot (GeometryFactory)
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     If you assigned your ids like you shown, then the number printed in the
>     visitor should be the same.
>     If not there must be some issue in your code as no new halfedge is
>     created by the simplification package.
>
>     Sebastien.
>
>     On 10/17/19 4:18 AM, Shrabani Ghosh wrote:
>      > Hi,
>      >
>      > I assigned id to the halfedges. Like this :
>      >    for( Surface_mesh::Halfedge_iterator eb =
>     surface_mesh.halfedges_begin()
>      >       , ee = surface_mesh.halfedges_end()
>      >       ; eb != ee
>      >       ; ++ eb
>      >       )
>      >      eb->id() = index++;
>      >
>      > But in the visitor, it does not print the original edges ids but
>     just
>      > prints the increment numbers. How can I print in the visitor so
>     that it
>      > shows the edge->id and I want to see the sequence of edge collapse?
>      >
>      > Edges collected: 23
>      > Edges collapsed: 1
>      > Edges collapsed: 2
>      > Edges collapsed: 3
>      > Edges collapsed: 4
>      > Edges collapsed: 5
>      > Edges collapsed: 6
>      > Edges collapsed: 7
>      > Edges collapsed: 8
>      > Edges collapsed: 9
>      > Edges non_collapsable: 1
>      > Edges non_collapsable: 2
>      > Edges non_collapsable: 3
>      >
>      > Edges collected: 23
>      > Edges processed: 12
>      > Edges collapsed: 9
>      >
>      > Edges not collapsed due to topological constraints: 3
>      > Edge not collapsed due to cost computation constraints: 0
>      > Edge not collapsed due to placement computation constraints: 0
>      >
>      > Finished...
>      > 20 edges removed.
>      > 6 final  half edges.
>      >
>      > These are the final halfedges ids.
>      > 28
>      > 29
>      > 32
>      > 33
>      > 36
>      > 37
>      >
>      >
>      > Thank You
>      > Shrabani Ghosh
>      >
>      > On Wed, Oct 16, 2019 at 3:10 AM Sebastien Loriot (GeometryFactory)
>      > <[hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>      >
>      >     You have the information about what will be collapsed in the
>     visitor.
>      >     You are free to assign an id to the edge if needed using a
>     hash map
>      >     if needed.
>      >
>      >     Sebastien.
>      >
>      >     On 10/11/19 5:57 AM, Shrabani Ghosh wrote:
>      >      > Hi,
>      >      > I am working on surface_mesh_simplification.
>      >      > I am referencing here this example.
>      >      >
>      >      >
>      >
>     https://doc.cgal.org/latest/Surface_mesh_simplification/Surface_mesh_simplification_2edge_collapse_visitor_surface_mesh_8cpp-example.html
>      >      >
>      >      > I want to keep track of the edges are collapsing for
>     further use.
>      >      > Let's say, in my mesh, there are 10 edges.
>      >      >
>      >      > I want to use keep trace if edges 5,6,7,8 are collapsing.
>      >      > if 6 and 7 number edges are collapsed, I want to save the edge
>      >     numbers.
>      >      >
>      >      > And after collapsing edges on the first iteration, the ids
>     of the
>      >     edges
>      >      > changes from the original mesh?
>      >      >
>      >      > Thank you.
>      >      > Shrabani Ghosh
>      >      >
>      >      >
>      >      >
>      >      > --
>      >      > Sent from: http://cgal-discuss.949826.n4.nabble.com/
>      >      >
>      >
>      >     --
>      >     You are currently subscribed to cgal-discuss.
>      >     To unsubscribe or access the archives, go to
>      > https://sympa.inria.fr/sympa/info/cgal-discuss
>      >
>      >
>
>     --
>     You are currently subscribed to cgal-discuss.
>     To unsubscribe or access the archives, go to
>     https://sympa.inria.fr/sympa/info/cgal-discuss
>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to keep track of edges are collapsing in surface mesh?

Shrabani Ghosh
Thank you for your response.



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss