Commit eb770f86 authored by Heng Liu's avatar Heng Liu

adapt to OVM deprecate changes

parent 88b942aa
......@@ -232,7 +232,7 @@ generate_frame_field()
}
std::cerr << "\n#####Field Generation time: " <<time.stop()/1000<<" s";
save_frames("test.frames");
// save_frames("test.frames");
}
......@@ -253,7 +253,7 @@ solve(const std::vector<bool>& face_conquered, std::vector<double>& quaternions)
// 3. setup smoothness energy
for(FIt f_it = mesh_.f_iter(); f_it.valid(); ++f_it)
if(!mesh_.is_boundary(*f_it) && face_conquered[*f_it])
if(!mesh_.is_boundary(*f_it) && face_conquered[(*f_it).idx()])
{
// get halffaces and cells
HFH hfh0 = mesh_.halfface_handle(*f_it, 0);
......@@ -411,7 +411,6 @@ init_consistent_transition_quaternions(std::vector<bool>& _face_conquered)
HFH hfh_opp = mesh_.opposite_halfface_handle(hfh);
if(!mesh_.is_boundary(hfh_opp))
{
CH ch = mesh_.incident_cell(hfh);
CH ch_opp = mesh_.incident_cell(hfh_opp);
if(!cell_visited[ch_opp.idx()])
......@@ -419,7 +418,7 @@ init_consistent_transition_quaternions(std::vector<bool>& _face_conquered)
// mark as visited
cell_visited[ch_opp.idx()] = true;
// mark face conquered
_face_conquered[mesh_.face_handle(hfh)] = true;
_face_conquered[mesh_.face_handle(hfh).idx()] = true;
// push halffaces to neighbors
for(unsigned int i=0; i<mesh_.cell(ch_opp).halffaces().size(); ++i)
cq.push(mesh_.cell(ch_opp).halffaces()[i]);
......@@ -1733,15 +1732,12 @@ void
FrameFieldGeneratorT<TetMeshT>::
save_frames(const std::string _filename) const
{
// quaternion property
OpenVolumeMesh::CellPropertyT< Eigen::Quaterniond > quaternion_prop = mesh_.template request_cell_property< Eigen::Quaterniond >("CellQuaternion");
std::ofstream f_write(_filename);
for(CIt c_it = mesh_.c_iter(); c_it.valid(); ++c_it)
{
// get quaternion
Eigen::Quaterniond q = quaternion_prop[*c_it];
Quaternion q = quaternion_cprop_[*c_it];
q.normalize();
if(!std::isfinite(q.squaredNorm()))
q = Eigen::Quaterniond(1,0,0,0);
......
This diff is collapsed.
......@@ -142,7 +142,7 @@ private:
bool get_second_constraints_on_patch(const HFP<int>& _patch_id, const EP<bool>& _edge_block, const std::vector<HFH>& _hfs,
const std::vector<std::vector<int> >& _v_trans, HFH& _hf_breach, int& _unique_trans)const;
void halffaces_between_two_halffaces(const HEH _he, const HFH _hf0, const HFH _hf1, std::vector<HFH>& _hfs)const;
void shortest_dual_path_from_boundary_to_halfface_on_patch(const HFH _hf, HFH& _hf_tb, const HFP<int>& _patch_id,
void shortest_dual_path_from_boundary_to_halfface_on_patch(const HFH _hf, HFH& _hf_tb, const HFP<int>& _patch_id,
const EP<bool>& _edge_block, std::vector<HFH>& _hfs)const;
//apply exhaustive search if necessary
......@@ -152,7 +152,6 @@ private:
void get_indexes(const int _decimal, std::vector<int>& _indexes)const;
void update_open_edge_property_on_boundary(EP<bool>& _ioe_prop)const;
int axis_after_transition(const int _axis_start, const int _transition)const;
int the_third_axis(const int _axis0, const int _axis1) const;
bool are_halfedges_the_same_direction(const HEH _he0, const HEH _he1)const;
double distance(const VH _vh0, const VH _vh1)const;
......
This diff is collapsed.
......@@ -5,8 +5,8 @@
* Author: hliu
*/
#ifndef PLUGIN_SMOOTHFRAMEFIELDOVM_SINGULARITYGRAPHT_HH
#define PLUGIN_SMOOTHFRAMEFIELDOVM_SINGULARITYGRAPHT_HH
#ifndef SINGULARITYGRAPHT_HH
#define SINGULARITYGRAPHT_HH
#include "Typedefs.hh"
......@@ -23,7 +23,7 @@ public:
SingularityGraphT(Mesh& _mesh)
: mesh_(_mesh),
valance_(mesh_.template request_edge_property<int>("edge_valance")),
valence_(mesh_.template request_edge_property<int>("edge_valance")),
label_(mesh_.template request_edge_property<int>("singularity_line_label")),
node_type_(mesh_.template request_vertex_property<int>("singular_node")),
is_singular_vt_(mesh_.template request_vertex_property<bool>("is_singular_vertex")),
......@@ -33,33 +33,50 @@ public:
arc_type_(mesh_.template request_edge_property<int>("singular_arc_type"))
{
update_label_property();
mesh_.set_persistent(arc_type_, true);
}
~SingularityGraphT(){}
public:
void set_singularity_graph_component_property();
void classify_singular_arc_type();
void set_singularity_graph_component_property();
void classify_singular_arc_type();
void update_label_property();
void update_node_type_property();
void update_singular_vertex_property();
void update_label_property();
void update_node_type_property();
void update_singular_vertex_property();
void update_valence_property();
std::vector<EH> get_singular_edges_of_label(const int _label) const;
std::vector<VH> get_singular_vertices_of_label(const int _label) const;
int max_label() const {return max_label_;};
std::vector<EH> get_singular_edges_of_label(const int _label) const;
std::vector<VH> get_singular_vertices_of_label(const int _label) const;
void sort_vertices_on_curve(const int _label, std::vector<VH>& _vhs) const;
void sort_edges_on_curve(const int _label, std::vector<EH>& _ehs) const;
// const std::vector<EH>& get_singular_edges_of_label(const int _label) const;
// const std::vector<VH>& get_singular_vertices_of_label(const int _label) const;
int max_label() {max_label_ = *std::max_element(label_.begin(), label_.end()); return max_label_;};
void sort_vertices_on_curve(const int _label, std::vector<VH>& _vhs) const;
void sort_edges_on_curve(const int _label, std::vector<EH>& _ehs) const;
void sort_halfedges_on_curve(const int _label, std::vector<HEH>& _hes) const;
void measure_the_shortest_curve_length() const;
int arc_type(const int _label) const{ return arc_type_[get_singular_edges_of_label(_label)[0]]; }
int arc_type(const EH _eh) const {return arc_type_[_eh];}
int valence(const int _label) const { return valence_[get_singular_edges_of_label(_label)[0]]; }
int valence(const EH _eh) const { return valence_[_eh]; }
std::vector<VH> adjacent_singular_nodes(const VH _vh) const;
VH end_singular_node_on_curve(const int _label, const VH _start_node) const;
private:
bool is_end_vertex(const VH _vh) const;
double distance(const VH _vh0, const VH _vh1) const;
private:
Mesh &mesh_;
EP<int> valance_;
EP<int> valence_;
EP<int> label_;
VP<int> node_type_;
VP<bool> is_singular_vt_;
......@@ -90,4 +107,4 @@ private:
#endif
//=============================================================================
#endif /* PLUGIN_SMOOTHFRAMEFIELDOVM_SINGULARITYGRAPHT_HH */
#endif /* SINGULARITYGRAPHT_HH */
......@@ -422,6 +422,46 @@ test_round_to_2d_possibilities()
}
//-----------------------------------------------------------------------------
int TransitionQuaternion::axis_after_transition(const int _axis_start, const int _transition) const
{
if(_transition == -1 || _axis_start > 6 || _axis_start < 0)
std::cerr<<"\nERROR: input transition or axis is invalid! Axis start: "<<_axis_start<<" transition: "<<_transition;
Matrix m1 = transition_matrix_int(_transition);
int axes_mapped[3] = {0,0,0};
for(int j=0; j<3;++j)
for(int i=0;i<3;++i)
{
if(m1(i,j) == 1)
{
axes_mapped[j] = 2*i;
break;
}
if(m1(i,j) == -1)
{
axes_mapped[j] = 2*i+1;
break;
}
}
int pos = _axis_start/2;
int res = _axis_start%2;
int axis = 0;
if(res == 0)
axis = axes_mapped[pos];
else if(res == 1)
axis = (axes_mapped[pos] %2 == 0) ? axes_mapped[pos] + 1 : axes_mapped[pos] - 1;
return axis;
}
//=============================================================================
} // namespace Eigen
//=============================================================================
......
......@@ -71,6 +71,8 @@ public:
// check quaternions
void check_quaternions() const;
int axis_after_transition(const int _axis_start, const int _transition) const;
private:
// initialize vector of transitions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment