Skip to content

Commit

Permalink
v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizuki7fan committed Jun 1, 2020
1 parent 804469b commit 2c61d73
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 38 deletions.
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#屏蔽目录和文件
/build_gcc/*
/build_vs/*
/build_mkl/*
/test/*
/Output/*
/Input/*
/paper/*
/Benchmark/*
/build*/*
/.*
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,38 @@ if(OPENMP_FOUND)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()

option(USE_PARDISO "Use Pardiso" OFF)
option(USE_MKL_PARDISO "Use MKL Pardiso" ON)
option(UST_EIGEN "Use Eigen" OFF)
option(USE_PARDISO "Use Pardiso" ON)
option(USE_MKL_PARDISO "Use MKL Pardiso" OFF)
option(USE_EIGEN "Use Eigen" OFF)

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
message(STATUS "the OS is windows")
include_directories("D:/LIBRARY/eigen-3.3.7/eigen-3.3.7")
include_directories("D:/LIBRARY/OpenMesh-8.0/src")
include_directories("D:/LIBRARY/Eigen")
include_directories("D:/LIBRARY/OpenMesh/src")

if (USE_MKL_PARDISO)
message(STATUS "Using MKL Pardiso")
add_definitions(-DUSE_MKL_PARDISO)
include_directories("C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.0.166/windows/mkl/include")
link_directories("C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.0.166/windows/mkl/lib/intel64")
include_directories("D:/LIBRARY/mkl/compilers_and_libraries_2019.4.245/windows/mkl/include")
link_directories("D:/LIBRARY/mkl/compilers_and_libraries_2019.4.245/windows/mkl/lib/intel64")
SET(SOLVER_LIBRARY mkl_rt)
SET(SOLVER MKLPardisoSolver.cpp)
elseif(USE_PARDISO)
message(STATUS "Using Pardiso")
add_definitions(-DUSE_PARDISO)
link_directories("D:/LIBRARY/Pardiso/")
link_directories("D:/LIBRARY/Pardiso")
SET(SOLVER_LIBRARY libpardiso600-WIN-X86-64.lib)
SET(SOLVER PardisoSolver.cpp)
elseif(USE_EIGEN)
message(STATUS "Using Eigen")
add_definitions(-DUSE_EIGEN)
SET(SOLVER EigenSolver.cpp)
SET(SOLVER EigenLinSolver.cpp)
endif()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
link_directories("D:/LIBRARY/OpenMesh/build_cmake/Build/lib")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
link_directories("D:/LIBRARY/OpenMesh-8.0/build/Build/lib")
link_directories("D:/LIBRARY/OpenMesh/build_vs/Build/lib")
endif()

elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
Expand Down
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,65 @@
# GreedyCut

This is a C++ implement of the following paper:

[Tianyu Zhu](https://Mizuki7fan.github.io), [Chunyang Ye](https://chunyangye.github.io), [Shuangming Chai](https://https://kfckfckf.github.io), and [Xiao-Ming Fu](http://staff.ustc.edu.cn/~fuxm).
Greedy cut construction for parameterizations.
Computer Graphics Forum (Eurographics), 2020.

The code is written by Tianyu Zhu using Microsoft Visual Studio 2019 with OpenMP, and has passed the test on Windows 10, Ubuntu 18.04 and macOS 10.14.3.

## External Libraries
---
All the required libraries are the latest versions.

* [Eigen](http://eigen.tuxfamily.org/)
* [OpenMesh](https://www.openmesh.org/)
* [PARDISO](https://www.pardiso-project.org/) (academic license) or [MKL Pardiso Solver](https://software.intel.com/content/www/us/en/develop/tools/math-kernel-library.html)
* OpenMP

## Clone Repository
---
```
git clone https://github.com/Mizuki7fan/GreedyCut
```

## Build and Run
---
### build
```
cd GreedyCut
```
**Edit CmakeLists.txt** to set the solver and configuration path.

```
mkdir build && cd build
cmake ..
```

### run
---
```
GreedyCut.exe <mesh> opt.txt
```
Arguments in opt.txt:
* PointSampling_method: the method to find second vertex.
* PointFinding_method: the metric of distance in PointFinding stage.
* BanArea_Method: weather to connect local maximizer before finding second cut.
* BanArea_Dn: the radius of forbidden region.
* BanArea_Alpha: the threshold in dual cut strategy.
* BanArea_Metric: the metric of distance of the radius of forbidden region.
* BanArea_ShrinkRate: the shrink rate of radius of forbidden region.
* Influence_Threshold: the scope of influence threshold.
* Distortion_Threshold: the distortion threshold of filtering stage.
* Trimming_Rate: the length threshold of add auxiliary point stage.
* Max_AddCount: the maximum of adding auxiliary point.

### example
```
GreedyCut.exe alien.obj opt.txt
```

## Output Files
* landmark.txt: the landmark find by algorithm.
* cut.txt: the cut find by algorithm
* cuted_mesh.obj: the open mesh cuted by the cut.
11 changes: 3 additions & 8 deletions opt.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#option

#value: 0/1
isDebug=0
#value: 0/1
isHighGenus=1

#PointSampling
#value: Dijkstra/GeodesicDistance/RealDistance
PointSampling_method=Dijkstra

#VertexPriorityMetric
#value: RealDis/Neighbourhood
PointFinding_vertex_priority_metric=Neighbourhood
#PointFinding
#value: Dijkstra/RealDistance
PointFinding_method=Dijkstra

#BanAreaMethod
#value: NonConnect/Connect
Expand Down
10 changes: 3 additions & 7 deletions src/Auxiliary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ Option::Option(std::string modelPath, std::string optPath)
continue;
key = line.substr(0, position);
value = line.substr(position + 1, line.length());
if (key == "isDebug")
isDebug = std::stoi(value);
else if (key == "isHighGenus")
isHighGenus = std::stoi(value);
else if (key == "PointSampling_method")
if (key == "PointSampling_method")
PS_method = value;
else if (key == "PointFinding_vertex_priority_metric")
PF_vertex_priority_metric = value;
else if (key == "PointFinding_method")
PF_method = value;
else if (key == "BanArea_Method")
BanArea_Method = value;
else if (key == "BanArea_Dn")
Expand Down
4 changes: 1 addition & 3 deletions src/Auxiliary.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ struct Option
{
std::string modelName;
std::string modelPath;
bool isDebug = false;
bool isHighGenus = false;
std::string PS_method = "Dijkstra";
std::string PF_vertex_priority_metric = "Neighbourhood";
std::string PF_method = "Dijkstra";
std::string BanArea_Method = "NonConnect";
int BanArea_Dn = 10;
double BanArea_alpha = 0.1;
Expand Down
1 change: 0 additions & 1 deletion src/PointFinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ void PointFinding::Find(std::vector<std::pair<int, double>>& result)
FindByRealDis(result);
else if (Metric == "Neighbourhood")
FindByNeighbourhood(result);

}

void PointFinding::FindLocalMaximizer()
Expand Down
10 changes: 9 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int main(int argc, char* argv[])

printf("PF2\n");
PointFinding PF2(mesh, CutedMesh2, MC);
PF2.Set(opt.PS_method);
PF2.Set(opt.PF_method);
std::vector<std::pair<int, double>> VertexPriority;
PF2.FindLocalMaximizer();
PF2.Find(VertexPriority);
Expand Down Expand Up @@ -118,5 +118,13 @@ int main(int argc, char* argv[])
Mesh CutedMesh3 = MCut3.GetCutedMesh();
OpenMesh::IO::write_mesh(CutedMesh3, "cuted_mesh.obj");

std::ofstream cutfile("cut.txt");
std::vector<int> cut;
cut = MCut3.GetCutedge();
for (auto a : cut)
{
cutfile << a << std::endl;
}

printf("finish!");
}

0 comments on commit 2c61d73

Please sign in to comment.