Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Simplification: selection process and constrained edges

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Simplification: selection process and constrained edges


Chronological Thread 
  • From: Zohar <>
  • To:
  • Subject: Re: [cgal-discuss] Simplification: selection process and constrained edges
  • Date: Sat, 12 Apr 2014 14:55:46 -0700 (PDT)


1.
The code below implements my solution of temporary constraints. Edges that
didn't fulfill (lPlacement && Is_collapse_geometrically_valid(lProfile,
lPlacement)) are suspended from the queue until an edge is collapsed, and
then they are returned to the queue.

Unfortunately, my bijectivity constraints didn't seem to be the problem (of
can't simplify below 25k facets). The problem is the LindstromTurk_cost
which can't compute the cost for a lot of edges; why?

2.
A question about Edge_length_cost. When MyPlacement returns an empty point,
it still calls the collapse. To remedy that I patched the loop with:

if ( lPlacement && Is_collapse_geometrically_valid(lProfile, lPlacement) )

as seen in the instantiation code below. But I expected
Is_collapse_geometrically_valid() to do the test. Thus example 4.7 in the
doc doesn't make sense to me:

void OnCollapsing(Profile const&
,boost::optional<Point> placement
)
{
if ( !placement )
++ stats->placement_uncomputable ;
}

Why do we expect the collapse to be called if there's no placement?




-----------------------------------

// patch collapse to handle temporary constraints (e.g. bijectivity in
placement)
template<>
void SMS::EdgeCollapse<
EP_base,

SMS::Count_ratio_stop_predicate<EP_base>,


CGAL::Polyhedron_vertex_index_map_stored<CGAL::Simple_cartesian&lt;double>,
Enriched_items, CGAL::HalfedgeDS_default, std::allocator<int> >,

CGAL::Polyhedron_edge_index_map_stored<CGAL::Simple_cartesian&lt;double>,
Enriched_items, CGAL::HalfedgeDS_default, std::allocator<int> >,
Multires::EdgeConstraints,

SMS::Edge_length_cost<EP_base>,
//SMS::LindstromTurk_cost<EP_base>,

Multires::MyPlacement<EP_base>,
Multires::My_visitor>::Loop()
{
Log.emphasize2("Running specialized
SMS::EdgeCollapse::Loop()");

CGAL_ECMS_TRACE(0, "Collapsing edges...");

CGAL_SURF_SIMPL_TEST_assertion_code(size_type lLoop_watchdog
= 0);
CGAL_SURF_SIMPL_TEST_assertion_code(size_type
lNonCollapsableCount = 0);

vector<edge_descriptor> suspended;

// Pops and processes each edge from the PQ
optional<edge_descriptor> lEdge;
while ( lEdge = pop_from_PQ() ) {
CGAL_SURF_SIMPL_TEST_assertion(lLoop_watchdog++ <
mInitialEdgeCount);

CGAL_ECMS_TRACE(1, "Poped " <<
edge_to_string(*lEdge));

Profile const& lProfile = create_profile(*lEdge);

Cost_type lCost = get_data(*lEdge).cost();

Visitor.OnSelected(lProfile, lCost, mInitialEdgeCount,
mCurrentEdgeCount);

if ( lCost ) {
if ( Should_stop(*lCost, lProfile,
mInitialEdgeCount, mCurrentEdgeCount)
) {

Visitor.OnStopConditionReached(lProfile);

CGAL_ECMS_TRACE(0, "Stop condition
reached with InitialEdgeCount=" <<
mInitialEdgeCount
<< " CurrentEdgeCount=" <<
mCurrentEdgeCount
<< " Current Edge: " <<
edge_to_string(*lEdge)
);
break;
}

if (
Is_collapse_topologically_valid(lProfile) ) {
// The external function
Get_new_vertex_point() is allowed to return an
absent point if there is no way to place the vertex satisfying its
constraints. In that case the remaining vertex is simply left unmoved.
Placement_type lPlacement =
get_placement(lProfile);

// Zohar: patch
if ( lPlacement &&
Is_collapse_geometrically_valid(lProfile,
lPlacement) ) {
// return suspended edges to
queue (before some of them are deleted in
the collapse)
for ( int i = 0 ; i <
(int)suspended.size() ; i++ ) {
edge_descriptor
&lEdge = suspended[i];
//Log.println("Unsuspending HE%d", lEdge->id());
Edge_data& lData =
get_data(lEdge);
Profile const&
lProfile = create_profile(lEdge);
lData.cost() =
get_cost(lProfile);
insert_in_PQ(lEdge,
lData);
//Log.println("HE%d unsuspended", lEdge->id());
}
suspended.clear();

// collpase
Collapse(lProfile,
lPlacement);
} else {
// suspend edge
//Log.println("Suspending HE%d", lEdge.get()->id());
suspended.push_back(*lEdge);
}
} else {

CGAL_SURF_SIMPL_TEST_assertion_code(lNonCollapsableCount++);

Visitor.OnNonCollapsable(lProfile);

CGAL_ECMS_TRACE(1,
edge_to_string(*lEdge) << " NOT Collapsable");
}
} else {
CGAL_ECMS_TRACE(1, edge_to_string(*lEdge) <<
" uncomputable cost.");
}
}
}




--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Simplification-selection-process-and-constrained-edges-tp4659059p4659113.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page