Skip to content

Commit 3712177

Browse files
author
pv
committed
CLEANUP
1 parent c040e81 commit 3712177

File tree

5 files changed

+12
-56
lines changed

5 files changed

+12
-56
lines changed

docs/examples/example_mapping.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from compas.colors import Color
22
from compas.datastructures import Mesh
33
from compas_viewer import Viewer
4+
from compas_viewer.config import Config
45
from tessagon.adaptors.list_adaptor import ListAdaptor
56
from tessagon.types.hex_tessagon import HexTessagon
67

@@ -50,7 +51,11 @@
5051
# Viewer
5152
# ==============================================================================
5253

53-
viewer = Viewer()
54+
config = Config()
55+
config.camera.target = [2, 2, 0.25]
56+
config.camera.position = [5, 2, 1.5]
57+
58+
viewer = Viewer(config=config)
5459
viewer.scene.add(mesh, name="mesh", show_faces=False, linecolor=Color.grey(), opacity=0.2)
5560
viewer.scene.add(Mesh.from_vertices_and_faces(pv, pf), name="pattern2d")
5661
viewer.scene.add(mesh_mapped, name="mesh_mapped", facecolor=Color.red())

docs/examples/example_mapping.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Mapping
1616
.. literalinclude:: example_mapping.py
1717
:language: python
1818

19-
2019
.. figure:: /_images/example_mapping_boundaries.png
2120
:figclass: figure
2221
:class: figure-img img-fluid

docs/examples/example_mapping_boundaries.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from compas.datastructures import Mesh
55
from compas.geometry import Polygon
66
from compas_viewer import Viewer
7+
from compas_viewer.config import Config
78
from tessagon.adaptors.list_adaptor import ListAdaptor
89
from tessagon.types.hex_tessagon import HexTessagon
910

@@ -112,12 +113,14 @@
112113
# Viewer
113114
# ==============================================================================
114115

115-
viewer = Viewer()
116+
config = Config()
117+
config.camera.target = [2, 2, 0.25]
118+
config.camera.position = [5, 2, 1.5]
119+
120+
viewer = Viewer(config=config)
116121
viewer.scene.add(mesh, name="mesh", show_faces=False, linecolor=Color.grey(), opacity=0.2)
117122
viewer.scene.add(mesh_mapped, name="mesh_mapped", facecolor=Color.red())
118123
viewer.scene.add(rotated_mesh, linecolor=Color.red(), linewidth=3)
119-
# viewer.scene.add(polygons, linecolor=Color.red(), linewidth=3)
120124
viewer.scene.add(intersections, linecolor=Color.red(), linewidth=3)
121-
122125
viewer.scene.add(mesh_flattened, name="mesh_flattened0")
123126
viewer.show()

docs/examples/example_mapping_patterns.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from tessagon.types.floret_tessagon import FloretTessagon
1313
from tessagon.types.hex_big_tri_tessagon import HexBigTriTessagon
1414

15-
# Import all tessagon types
1615
from tessagon.types.hex_tessagon import HexTessagon
1716
from tessagon.types.hex_tri_tessagon import HexTriTessagon
1817
from tessagon.types.octo_tessagon import OctoTessagon
@@ -26,7 +25,6 @@
2625

2726
import compas_libigl as igl
2827

29-
# Dictionary of tessagon classes
3028
TESSAGON_TYPES = {
3129
1: ("Hex", HexTessagon),
3230
2: ("Tri", TriTessagon),
@@ -100,11 +98,9 @@
10098
# Viewer
10199
# ==============================================================================
102100

103-
104101
config = Config()
105102
config.camera.target = [2, 2, 0.25]
106103
config.camera.position = [5, 2, 1.5]
107-
# config.camera.scale = 100
108104

109105
viewer = Viewer(config=config)
110106
viewer.scene.add(mesh, name="mesh", show_faces=False, linecolor=Color.grey(), opacity=0.2)

src/mapping.cpp

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ std::vector<std::vector<int>> map_mesh_with_automatic_parameterization(
201201

202202
rescale(target_uv);
203203

204-
// Compute pattern mesh UV parameterization using simple method
205-
// Eigen::MatrixXd pattern_uv = pattern_v.leftCols(2); // Use the first two columns (X and Y coordinates)
206204

207205
Eigen::MatrixXd pattern_uv;
208206
pattern_uv.setZero();
@@ -214,46 +212,8 @@ std::vector<std::vector<int>> map_mesh_with_automatic_parameterization(
214212
return map_mesh(target_v, target_f, target_uv, pattern_v, pattern_f, pattern_uv);
215213
}
216214

217-
Eigen::MatrixXd parametrization_check(
218-
Eigen::Ref<const compas::RowMatrixXd> target_v,
219-
Eigen::Ref<const compas::RowMatrixXi> target_f)
220-
{
221-
// Compute target mesh UV parameterization using LSCM
222-
Eigen::MatrixXd target_uv;
223-
224-
// Find the open boundary
225-
Eigen::VectorXi B;
226-
igl::boundary_loop(target_f, B);
227-
228-
// Fix two points on the boundary
229-
Eigen::VectorXi fixed(2, 1);
230-
fixed(0) = B(0);
231-
fixed(1) = B(B.size() / 2);
232-
233-
Eigen::MatrixXd fixed_uv(2, 2);
234-
fixed_uv << 0, 0, 1, 0;
235-
236-
// LSCM parametrization
237-
igl::lscm(target_v, target_f, fixed, fixed_uv, target_uv);
238-
239-
rescale(target_uv);
240-
241-
return target_uv;
242-
243-
}
244-
245215
NB_MODULE(_mapping, m)
246216
{
247-
m.def(
248-
"map_mesh",
249-
&map_mesh,
250-
"Map a 2D pattern mesh onto a 3D target mesh.",
251-
"target_v"_a,
252-
"target_f"_a,
253-
"target_uv"_a,
254-
"pattern_v"_a,
255-
"pattern_f"_a,
256-
"pattern_uv"_a);
257217

258218
m.def(
259219
"map_mesh_with_automatic_parameterization",
@@ -263,11 +223,4 @@ NB_MODULE(_mapping, m)
263223
"target_f"_a,
264224
"pattern_v"_a,
265225
"pattern_f"_a);
266-
267-
m.def(
268-
"parametrization_check",
269-
&parametrization_check,
270-
"Compute target mesh UV parameterization using LSCM.",
271-
"target_v"_a,
272-
"target_f"_a);
273226
}

0 commit comments

Comments
 (0)