Unable to simplify correctly with Lindstrom-Turk placement

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

Unable to simplify correctly with Lindstrom-Turk placement

DemoKioussis
Hello, I am trying to use mesh simplification to eventually simplify large
meshes, however I am experimenting on a relatively small mesh (about 80mb)
for now. Eventually I will probably move to make my own version of the cost
/ placement functions already defined, but I am having trouble with the
Lindstrom-Turk placement function. I have no problem using the midpoint
placement function. The error doesn't seem to be in the cost function.

The error I am having is that when I simplify with Lindstrom-Turk placement
( with default parameters) I get many spikes all over the mesh, but
simplifying with midpoint placement results in a good simplification ( with
either edge-length cost or Lindstrom-Turk cost).

Here are images describing the situation in better detail

Original mesh:
  <http://cgal-discuss.949826.n4.nabble.com/file/t375925/Original.png>

Lindstrom-Turk placement with Lindstrom-Turk cost and both with default
parameters:
<http://cgal-discuss.949826.n4.nabble.com/file/t375925/LindstromTurk.png>


Midpoint placement with Edge Length cost:
<http://cgal-discuss.949826.n4.nabble.com/file/t375925/Midpoint.png>


Midpoint placement with Lindstrom-Turk cost:
<http://cgal-discuss.949826.n4.nabble.com/file/t375925/Midpoint_LindstromCost.png>

The borders of the midpoint placements are preserved which is why they were
not simplified.

Here is how i am calling the simplification


///////////////////////////////////////////////////////
Lindstrom-Turk placement with Lindstrom-Turk cost and both with default
parameters:

int iRes = SMS::edge_collapse( surfaceMesh, stop,
                                        CGAL::parameters::vertex_index_map( get( CGAL::vertex_external_index,
surfaceMesh) )
                                        .halfedge_index_map( get( CGAL::halfedge_external_index, surfaceMesh) )
                                        .get_placement( SMS::LindstromTurk_placement<SurfaceMesh>() )
                                        .get_cost( SMS::LindstromTurk_cost <SurfaceMesh>() ) );

I believe this is equivalent to:
int iRes = SMS::edge_collapse( surfaceMesh, stop,
                                        CGAL::parameters::vertex_index_map( get( CGAL::vertex_external_index,
surfaceMesh) )
                                        .halfedge_index_map( get( CGAL::halfedge_external_index, surfaceMesh) )

which results in identical errors

///////////////////////////////////////////////////////
Midpoint placement with Edge Length cost:

                                iRes = SMS::edge_collapse( surfaceMesh, stop,
                                           CGAL::parameters::vertex_index_map( get(
CGAL::vertex_external_index, surfaceMesh) )
                                           .halfedge_index_map( get( CGAL::halfedge_external_index,
surfaceMesh) )
                                           .edge_is_constrained_map( constraintMap )
                                           .get_placement(
SMS::Constrained_placement<SMS::Midpoint_placement&lt;SurfaceMesh>,
ContstrainedEdgeMap>( constraintMap ))
                                           .get_cost( SMS::Edge_length_cost<SurfaceMesh>() ) );

///////////////////////////////////////////////////////
ContstrainedEdgeMap is defined very similarly to how it was defined here:
https://doc.cgal.org/latest/Surface_mesh_simplification/Surface_mesh_simplification_2edge_collapse_OpenMesh_8cpp-example.html

I would assume that the surface mesh is valid because further up I call
CGAL::is_valid( surfaceMesh) && CGAL::is_triangle_mesh( surfaceMesh) before
simplification, and also the same mesh simplifies correctly with midpoint
placement.

I don't know what other details you may need, but I am willing give more



--
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: Unable to simplify correctly with Lindstrom-Turk placement

DemoKioussis
It seems to have been a very simple precision error. When defining the kernel
and surface_mesh, I had used float instead of double. I had missed the
warnings in the compiler because Visual Studios was throwing out many
warnings about truncating template names and the warning was hidden.

Previously I had:

typedef CGAL::Simple_cartesian<float> kernel;
typedef CGAL::Polyhedron_3<kernel, CGAL::Polyhedron_items_with_id_3>
surface_mesh;

which caused the spikes during simplification, and using double precision
fixed the problem

It now looks like this:

typedef CGAL::Simple_cartesian<double> kernel;
typedef CGAL::Polyhedron_3<kernel, CGAL::Polyhedron_items_with_id_3>
surface_mesh;





--
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