Skip to content

Commit 66a9540

Browse files
committed
Update README.md, and increase library version.
1 parent c7b05e4 commit 66a9540

25 files changed

+93
-38
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
v.0.1.1
1+
v.0.2.0
22
---
33

4+
* Add unit test for each functions (just to check run or not).
45
* Add feature preservation in remeshing.
56
* Include Eigen to repo as a submodule.
67
* Update Python setup to use Poetry.

README.md

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,13 @@ Here is the list of modules and reference papers for that.
3333
Install
3434
---
3535

36-
### Dependency
37-
3836
The module is tested its compilation using the following compilers.
3937

4038
* **Windows** - Visual Studio 2019
4139
* **MacOS** - Apple Clang 11.0 (MacOS 10.15)
42-
* **Linux** - LLVM Clang 10.0, GNU C Compiler 9.3.0
43-
44-
Also, the module depends on Eigen for the linear algebra.
40+
* **Linux** - LLVM Clang 10.0, GNU C Compiler 9.4.0
4541

46-
* [Eigen 3.x](http://eigen.tuxfamily.org/index.php)
47-
48-
### C++ Library and Examples
42+
### Library and examples (C++)
4943

5044
You can build a shared library and all the examples by `CMake` with the following commands.
5145

@@ -58,12 +52,6 @@ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON ..
5852
cmake --build . --config Release --parallel 2
5953
```
6054

61-
#### Run examples (C++)
62-
63-
```shell
64-
./build/bin/example_simplify data/models/bunny.ply
65-
```
66-
6755
### Python module
6856

6957
You can install the Python module using `Pip`.
@@ -80,18 +68,69 @@ cd tinymesh
8068
poetry install
8169
```
8270

83-
#### Run examples (Python)
71+
Run examples
72+
---
73+
74+
#### C++
75+
76+
```shell
77+
./build/bin/example_simplify data/models/bunny.ply
78+
```
79+
80+
#### Python
8481

8582
```shell
8683
python examples/python/fill_and_fair.py data/models/bunny.ply
8784
```
8885

89-
Screen shots
86+
Gallery
9087
---
9188

92-
| Input | Before | Simplified |
93-
|:--------:|:--------:|:--------:|
94-
|![](figures/dragon.jpg)|![](figures/dragon_before_simplify.jpg)|![](figures/dragon_after_simplify.jpg)|
89+
#### Remeshing
90+
91+
<table>
92+
<tr>
93+
<td width="30%">Input</td>
94+
<td width="30%">Remesh</td>
95+
<td width="30%">Remesh (bottom part)</td>
96+
</tr>
97+
<tr>
98+
<td width="30%"><img src="figures/bunny_before.png" width="100%"/></td>
99+
<td width="30%"><img src="figures/bunny_remesh_1.png" width="100%"/></td>
100+
<td width="30%"><img src="figures/bunny_remesh_2.png" width="100%"/></td>
101+
</tr>
102+
</table>
103+
104+
105+
#### Simplification
106+
107+
<table>
108+
<tr>
109+
<td width="30%">Input</td>
110+
<td width="30%">Simplify (50000 faces)</td>
111+
<td width="30%">Simplify (10000 faces)</td>
112+
</tr>
113+
<tr>
114+
<td width="30%"><img src="figures/dragon_before.png" width="100%"/></td>
115+
<td width="30%"><img src="figures/dragon_simplify_50000.png" width="100%"/></td>
116+
<td width="30%"><img src="figures/dragon_simplify_10000.png" width="100%"/></td>
117+
</tr>
118+
</table>
119+
120+
#### Denoising (L0)
121+
122+
<table>
123+
<tr>
124+
<td width="30%">Original</td>
125+
<td width="30%">Noisy</td>
126+
<td width="30%">Denoise</td>
127+
</tr>
128+
<tr>
129+
<td width="30%"><img src="figures/fandisk_before.png" width="100%"/></td>
130+
<td width="30%"><img src="figures/fandisk_noise.png" width="100%"/></td>
131+
<td width="30%"><img src="figures/fandisk_denoise_l0.png" width="100%"/></td>
132+
</tr>
133+
</table>
95134

96135
Notice
97136
---

data/models/fandisk.ply

134 KB
Binary file not shown.

examples/example_denoise.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,27 @@ int main(int argc, char **argv) {
2424
// Random number generator
2525
std::random_device randev;
2626
std::mt19937 mt(randev());
27-
std::uniform_real_distribution<double> dist(-0.01, 0.01);
27+
std::uniform_real_distribution<double> dist(-0.5, 0.5);
2828

2929
// Save noise mesh
3030
std::string noiseMeshFile;
3131
{
3232
mesh::Mesh mesh(argv[1]);
3333
mesh::holeFill(mesh, Pi / 6.0);
3434

35+
double Lavg = 0.0;
36+
for (int i = 0; i < (int)mesh.numEdges(); i++) {
37+
mesh::Edge *e = mesh.edge(i);
38+
const double l = e->length();
39+
Lavg += l;
40+
}
41+
Lavg = Lavg / mesh.numEdges();
42+
3543
// Add noise
3644
for (int i = 0; i < (int)mesh.numVertices(); i++) {
3745
const Vec3 pos = mesh.vertex(i)->pos();
3846
const Vec3 noise = Vec3(dist(mt), dist(mt), dist(mt));
39-
mesh.vertex(i)->setPos(pos + noise);
47+
mesh.vertex(i)->setPos(pos + Lavg * noise);
4048
}
4149
noiseMeshFile = (dirpath / fs::path((basename + "_noise" + extension).c_str())).string();
4250
mesh.save(noiseMeshFile);

examples/python/fill_and_fair.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
def main(filename):
1010
mesh = Mesh(filename)
1111

12-
# Freeze faces
12+
# Freeze vertices
1313
for i in range(mesh.num_vertices()):
1414
v = mesh.vertex(i)
1515
v.set_is_static(True)
@@ -18,17 +18,17 @@ def main(filename):
1818
hole_fill(mesh, np.pi / 6.0)
1919
print('[ OK ] hole filling')
2020

21-
# Then, remesh
21+
# Remesh
2222
remesh_triangular(mesh, short_length=0.5, long_length=2.0)
2323
print('[ OK ] remeshing')
2424

25-
# Finally, fair
25+
# Fairing
2626
implicit_fairing(mesh)
2727
print('[ OK ] fairing')
2828

2929
# Save
3030
base, ext = os.path.splitext(filename)
31-
outfile = base + "_remesh" + ext
31+
outfile = base + '_fairing' + ext
3232
mesh.save(outfile)
3333
print('[ OK ] saved to %s' % (outfile))
3434

figures/bunny_before.png

177 KB
Loading

figures/bunny_remesh_1.png

170 KB
Loading

figures/bunny_remesh_2.png

133 KB
Loading

figures/dragon.jpg

-74 KB
Binary file not shown.

figures/dragon_after_simplify.jpg

-197 KB
Binary file not shown.

0 commit comments

Comments
 (0)