2626from compas_libigl ._types_std import VectorVectorInt # noqa: F401
2727
2828
29- def map_mesh (target_mesh , pattern_mesh , clip_boundaries = True , simplify_borders = True , fixed_points = None , tolerance = 1e-6 ):
29+ def map_mesh (target_mesh , pattern_mesh , clip_boundaries = True , simplify_borders = True , fixed_vertices = None , tolerance = 1e-6 ):
3030 """
3131 Map a 2D pattern mesh onto a 3D target.
3232
@@ -36,14 +36,18 @@ def map_mesh(target_mesh, pattern_mesh, clip_boundaries=True, simplify_borders=T
3636 A tuple of (vertices, faces) representing the target mesh.
3737 pattern_mesh : tuple[list[list[float]], list[list[int]]]
3838 A tuple of (vertices, faces) representing the pattern mesh.
39- clip_boundaries : bool
39+ clip_boundaries : bool, optional
4040 Whether to clip the pattern mesh to the boundaries of the target mesh.
41- simplify_borders : bool
41+ Default is True.
42+ simplify_borders : bool, optional
4243 Whether to simplify the border of the pattern mesh.
43- fixed_points : list[list[float]]
44+ Default is True.
45+ fixed_vertices : list[list[float]], optional
4446 A list of fixed points on the target mesh.
45- tolerance : float
47+ Default is None.
48+ tolerance : float, optional
4649 The tolerance for point comparison, to remove duplicates.
50+ Default is 1e-6.
4751
4852 Returns
4953 -------
@@ -65,13 +69,13 @@ def map_mesh(target_mesh, pattern_mesh, clip_boundaries=True, simplify_borders=T
6569 f_numpy = np .array (f , dtype = np .int32 )
6670 pattern_v_numpy = np .array (pv , dtype = np .float64 )
6771
68- # Handle fixed_points - provide empty array if None
72+ # Handle fixed_vertices - provide empty array if None
6973
70- fixed_points_vectorint = VectorInt ()
71- if fixed_points is None :
72- fixed_points_vectorint = VectorInt ()
74+ fixed_vertices_vectorint = VectorInt ()
75+ if fixed_vertices is None :
76+ fixed_vertices_vectorint = VectorInt ()
7377 else :
74- fixed_points_vectorint = VectorInt (fixed_points )
78+ fixed_vertices_vectorint = VectorInt (fixed_vertices )
7579
7680 # Convert pattern_f from Python list to VectorVectorInt which is expected by C++ code
7781
@@ -81,14 +85,14 @@ def map_mesh(target_mesh, pattern_mesh, clip_boundaries=True, simplify_borders=T
8185
8286 # Perform the mapping
8387 pv_numpy_copy , pf_numpy_cleaned , p_normals , pattern_is_boundary , pattern_groups = _mapping .map_mesh_with_automatic_parameterization (
84- v_numpy , f_numpy , pattern_v_numpy , pattern_f_vec , clip_boundaries , simplify_borders , fixed_points_vectorint , tolerance
88+ v_numpy , f_numpy , pattern_v_numpy , pattern_f_vec , clip_boundaries , simplify_borders , fixed_vertices_vectorint , tolerance
8589 )
8690
8791 # Return the result as a tuple
8892 return pv_numpy_copy , pf_numpy_cleaned , p_normals , pattern_is_boundary , pattern_groups
8993
9094
91- def map_pattern_to_mesh (name , mesh , clip_boundaries = True , tolerance = 1e-6 , pattern_u = 16 , pattern_v = 16 , simplify_borders = True , fixed_points = None ):
95+ def map_pattern_to_mesh (name , mesh , clip_boundaries = True , tolerance = 1e-6 , pattern_u = 16 , pattern_v = 16 , simplify_borders = True , fixed_vertices = None ):
9296 """
9397 Map a 2D pattern mesh onto a 3D target.
9498
@@ -118,18 +122,24 @@ def map_pattern_to_mesh(name, mesh, clip_boundaries=True, tolerance=1e-6, patter
118122
119123 mesh : compas.datastructures.Mesh
120124 The target mesh.
121- clip_boundaries : bool
125+ clip_boundaries : bool, optional
122126 Whether to clip the pattern mesh to the boundaries of the target mesh.
123- tolerance : float
127+ Default is True.
128+ tolerance : float, optional
124129 The tolerance for point comparison, to remove duplicates.
125- pattern_u : int
130+ Default is 1e-6.
131+ pattern_u : int, optional
126132 The number of pattern vertices in the u direction.
127- pattern_v : int
133+ Default is 16.
134+ pattern_v : int, optional
128135 The number of pattern vertices in the v direction.
129- simplify_borders : bool
136+ Default is 16.
137+ simplify_borders : bool, optional
130138 Whether to simplify the border of the pattern mesh.
131- fixed_points : list[list[float]]
139+ Default is True.
140+ fixed_vertices : list[list[float]], optional
132141 A list of fixed points on the target mesh.
142+ Default is None.
133143
134144 Returns
135145 -------
@@ -188,7 +198,7 @@ def map_pattern_to_mesh(name, mesh, clip_boundaries=True, tolerance=1e-6, patter
188198
189199 v , f = mesh .to_vertices_and_faces ()
190200 mapped_vertices , mapped_faces , mapped_normals , mapped_is_boundary , mapped_groups = map_mesh (
191- (v , f ), (pv , pf ), clip_boundaries = clip_boundaries , simplify_borders = simplify_borders , fixed_points = fixed_points , tolerance = tolerance
201+ (v , f ), (pv , pf ), clip_boundaries = clip_boundaries , simplify_borders = simplify_borders , fixed_vertices = fixed_vertices , tolerance = tolerance
192202 )
193203
194204 return Mesh .from_vertices_and_faces (mapped_vertices , mapped_faces )
0 commit comments