mirror of https://github.com/CGAL/cgal
Moved orbifold type-related functions to the corresponding helper file
This commit is contained in:
parent
b052d3bc5f
commit
adb03e8ee9
|
|
@ -68,36 +68,12 @@ namespace CGAL {
|
||||||
|
|
||||||
namespace Surface_mesh_parameterization {
|
namespace Surface_mesh_parameterization {
|
||||||
|
|
||||||
enum Orbifold_type
|
|
||||||
{
|
|
||||||
Square = 0,
|
|
||||||
Diamond,
|
|
||||||
Triangle,
|
|
||||||
Parallelogram
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Weight_type
|
enum Weight_type
|
||||||
{
|
{
|
||||||
Cotangent = 0,
|
Cotangent = 0,
|
||||||
Mean_value
|
Mean_value
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* get_orbifold_type(int orb_type)
|
|
||||||
{
|
|
||||||
// Messages corresponding to Error_code list above. Must be kept in sync!
|
|
||||||
static const char* type[Parallelogram+1] = {
|
|
||||||
"Square",
|
|
||||||
"Diamond",
|
|
||||||
"Triangle",
|
|
||||||
"Parallelogram"
|
|
||||||
};
|
|
||||||
|
|
||||||
if(orb_type > Parallelogram || orb_type < 0)
|
|
||||||
return "Unknown orbifold type";
|
|
||||||
else
|
|
||||||
return type[orb_type];
|
|
||||||
}
|
|
||||||
|
|
||||||
template
|
template
|
||||||
<
|
<
|
||||||
typename TriangleMesh,
|
typename TriangleMesh,
|
||||||
|
|
@ -175,65 +151,7 @@ private:
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Orbifold type functions
|
|
||||||
std::vector<Point_2> get_cones_parameterized_coordinates() const
|
|
||||||
{
|
|
||||||
std::vector<Point_2> tcoords;
|
|
||||||
if(orb_type == Square) {
|
|
||||||
tcoords.push_back(Point_2(-1, -1));
|
|
||||||
tcoords.push_back(Point_2(1, 1));
|
|
||||||
} else if(orb_type == Parallelogram) {
|
|
||||||
tcoords.push_back(Point_2(0, -0.5));
|
|
||||||
tcoords.push_back(Point_2(-1, -0.5));
|
|
||||||
tcoords.push_back(Point_2(0, 0.5));
|
|
||||||
} else { // if(orb_type == Diamond || orb_type == Triangle)
|
|
||||||
tcoords.push_back(Point_2(-1, 1));
|
|
||||||
tcoords.push_back(Point_2(-1, -1));
|
|
||||||
}
|
|
||||||
return tcoords;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Angles are minus as we go around the seam border in a counterclockwise manner
|
|
||||||
std::vector<NT> get_angles_at_cones() const
|
|
||||||
{
|
|
||||||
std::vector<NT> angs;
|
|
||||||
if(orb_type == Square) {
|
|
||||||
angs.push_back(4.);
|
|
||||||
angs.push_back(4.);
|
|
||||||
} else if(orb_type == Diamond) {
|
|
||||||
angs.push_back(3.);
|
|
||||||
angs.push_back(3.);
|
|
||||||
} else if(orb_type == Triangle) {
|
|
||||||
angs.push_back(6.);
|
|
||||||
angs.push_back(2.);
|
|
||||||
} else { // if(orb_type == Parallelogram)
|
|
||||||
angs.push_back(2);
|
|
||||||
angs.push_back(1);
|
|
||||||
angs.push_back(2);
|
|
||||||
}
|
|
||||||
return angs;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Linear system
|
// Linear system
|
||||||
template<typename ConeMap,
|
|
||||||
typename VertexIndexMap>
|
|
||||||
void find_start_cone(const ConeMap& cmap,
|
|
||||||
VertexIndexMap vimap,
|
|
||||||
vertex_descriptor& cone,
|
|
||||||
int& cone_index) const
|
|
||||||
{
|
|
||||||
typename ConeMap::const_iterator cmit = cmap.begin(), cend = cmap.end();
|
|
||||||
for(; cmit!=cend; ++cmit) {
|
|
||||||
if(cmit->second != First_unique_cone)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
cone = cmit->first;
|
|
||||||
cone_index = get(vimap, cone);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Compute the number of linear constraints in the system.
|
/// Compute the number of linear constraints in the system.
|
||||||
int number_of_linear_constraints(const TriangleMesh& mesh) const
|
int number_of_linear_constraints(const TriangleMesh& mesh) const
|
||||||
{
|
{
|
||||||
|
|
@ -360,10 +278,13 @@ private:
|
||||||
Matrix& A, Vector& B) const
|
Matrix& A, Vector& B) const
|
||||||
{
|
{
|
||||||
// positions of the cones in the plane
|
// positions of the cones in the plane
|
||||||
const std::vector<Point_2>& tcoords = get_cones_parameterized_coordinates();
|
typedef std::vector<Point_2> Point_container;
|
||||||
|
const Point_container& tcoords =
|
||||||
|
get_cones_parameterized_coordinates<Point_container>(orb_type);
|
||||||
|
|
||||||
// angles at the cones
|
// angles at the cones
|
||||||
const std::vector<NT>& angs = get_angles_at_cones();
|
typedef std::vector<NT> Angle_container;
|
||||||
|
const Angle_container& angs = get_angles_at_cones<Angle_container>(orb_type);
|
||||||
|
|
||||||
// the index of the line in A that we are filling next
|
// the index of the line in A that we are filling next
|
||||||
int current_line_id_in_A = 0.;
|
int current_line_id_in_A = 0.;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/graph/graph_traits.hpp>
|
#include <boost/graph/graph_traits.hpp>
|
||||||
|
#include <boost/unordered_set.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
@ -47,6 +48,75 @@ enum Cone_type
|
||||||
Duplicated_cone
|
Duplicated_cone
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Orbifold_type
|
||||||
|
{
|
||||||
|
Square = 0,
|
||||||
|
Diamond,
|
||||||
|
Triangle,
|
||||||
|
Parallelogram
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* get_orbifold_type(int orb_type)
|
||||||
|
{
|
||||||
|
// Messages corresponding to Error_code list above. Must be kept in sync!
|
||||||
|
static const char* type[Parallelogram+1] = {
|
||||||
|
"Square",
|
||||||
|
"Diamond",
|
||||||
|
"Triangle",
|
||||||
|
"Parallelogram"
|
||||||
|
};
|
||||||
|
|
||||||
|
if(orb_type > Parallelogram || orb_type < 0)
|
||||||
|
return "Unknown orbifold type";
|
||||||
|
else
|
||||||
|
return type[orb_type];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Orbifold type functions
|
||||||
|
template<typename Point_container>
|
||||||
|
Point_container get_cones_parameterized_coordinates(const Orbifold_type orb_type)
|
||||||
|
{
|
||||||
|
typedef typename Point_container::value_type Point;
|
||||||
|
|
||||||
|
Point_container tcoords;
|
||||||
|
if(orb_type == Square) {
|
||||||
|
tcoords.push_back(Point(-1, -1));
|
||||||
|
tcoords.push_back(Point(1, 1));
|
||||||
|
} else if(orb_type == Parallelogram) {
|
||||||
|
tcoords.push_back(Point(0, -0.5));
|
||||||
|
tcoords.push_back(Point(-1, -0.5));
|
||||||
|
tcoords.push_back(Point(0, 0.5));
|
||||||
|
} else { // if(orb_type == Diamond || orb_type == Triangle)
|
||||||
|
tcoords.push_back(Point(-1, 1));
|
||||||
|
tcoords.push_back(Point(-1, -1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return tcoords;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Angles are minus as we go around the seam border in a counterclockwise manner
|
||||||
|
template<typename NT_container>
|
||||||
|
NT_container get_angles_at_cones(const Orbifold_type orb_type)
|
||||||
|
{
|
||||||
|
NT_container angs;
|
||||||
|
if(orb_type == Square) {
|
||||||
|
angs.push_back(4.);
|
||||||
|
angs.push_back(4.);
|
||||||
|
} else if(orb_type == Diamond) {
|
||||||
|
angs.push_back(3.);
|
||||||
|
angs.push_back(3.);
|
||||||
|
} else if(orb_type == Triangle) {
|
||||||
|
angs.push_back(6.);
|
||||||
|
angs.push_back(2.);
|
||||||
|
} else { // if(orb_type == Parallelogram)
|
||||||
|
angs.push_back(2);
|
||||||
|
angs.push_back(1);
|
||||||
|
angs.push_back(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return angs;
|
||||||
|
}
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
/// Read the cones from the input file.
|
/// Read the cones from the input file.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue