Skip to content

Commit

Permalink
edge flaps and flip avoiding line search better assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
teseoch committed Jun 4, 2020
1 parent d84905f commit 446d32e
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 120 deletions.
114 changes: 0 additions & 114 deletions attic/skip/edge_flaps.cpp

This file was deleted.

65 changes: 65 additions & 0 deletions src/edge_flaps.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include <common.h>
#include <npe.h>
#include <typedefs.h>

#include <igl/edge_flaps.h>

const char *ds_edge_flaps = R"igl_Qu8mg5v7(
Determine "edge flaps": two faces on either side of a unique edge (assumes edge-manifold mesh)
Parameters
----------
F #F by 3 list of face indices
Returns
-------
E #E by 2 list of edge indices into V.
EMAP #F*3 list of indices into E, mapping each directed edge to unique
unique edge in E
EF #E by 2 list of edge flaps, EF(e,0)=f means e=(i-->j) is the edge of
F(f,:) opposite the vth corner, where EI(e,0)=v. Similarly EF(e,1) "
e=(j->i)
EI #E by 2 list of edge flap corners (see above).
See also
--------
Notes
-----
None
Examples
--------
)igl_Qu8mg5v7";

npe_function(edge_flaps)
npe_doc(ds_edge_flaps)

npe_arg(f, dense_int, dense_long, dense_longlong)


npe_begin_code()
assert_valid_tri_mesh_faces(f);

Eigen::MatrixXi f_copy = f.template cast<int>();
Eigen::MatrixXi e_copy;
Eigen::VectorXi emap_copy;
Eigen::MatrixXi ef_copy;
Eigen::MatrixXi ei_copy;
igl::edge_flaps(f_copy, e_copy, emap_copy, ef_copy, ei_copy);

EigenDense<npe_Scalar_f> e = e_copy.template cast<npe_Scalar_f>();
EigenDense<npe_Scalar_f> emap = emap_copy.template cast<npe_Scalar_f>();
EigenDense<npe_Scalar_f> ef = ef_copy.template cast<npe_Scalar_f>();
EigenDense<npe_Scalar_f> ei = ei_copy.template cast<npe_Scalar_f>();
return std::make_tuple(npe::move(e), npe::move(emap), npe::move(ef), npe::move(ei));

npe_end_code()


10 changes: 10 additions & 0 deletions src/flip_avoiding_line_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ npe_arg(cur_energy, double)
npe_begin_code()
assert_shapes_match(cur_v, dst_v, "cur_v", "dst_v");
assert_valid_tet_or_tri_mesh_faces(f);
if(f.cols() == 3)
{
assert_cols_equals(cur_v, 2, "cur_v");
assert_cols_equals(dst_v, 2, "dst_v");
}
else
{
assert_cols_equals(cur_v, 3, "cur_v");
assert_cols_equals(dst_v, 3, "dst_v");
}

//TODO: remove __copy
Eigen::MatrixXi f_copy = f.template cast<int>();
Expand Down
16 changes: 10 additions & 6 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2275,17 +2275,21 @@ def test_fast_winding_number_for_meshes(self):
pass

def test_flip_avoiding_line_search(self):
#def fun(v):
# return 0.5
#energy, vr = igl.flip_avoiding_line_search(self.f1, self.v1, -self.v1, fun, 10.0)
def fun(v):
return 0.5
energy, vr = igl.flip_avoiding_line_search(self.f1, self.v1, -self.v1, fun, 10.0)
# TODO: fix function assertion fail
pass

def test_edge_flaps(self):
# TODO
e, emap, ef, ei = igl.edge_flaps(self.f2)
pass

def test_circulation(self):
pass
# difficult data
# _, e, emap = igl.crouzeix_raviart_cotmatrix(self.v1, self.f1)
# ret = igl.circulation(0, False, emap, e, e)
# e, emap, ef, ei = igl.edge_flaps(self.f2)
# ret = igl.circulation(0, False, emap, ef, ei)
# self.assertTrue(type(ret) == list)
# self.assertTrue(type(ret[0]) == int)

Expand Down

0 comments on commit 446d32e

Please sign in to comment.