Skip to content

Commit 8c1dd8c

Browse files
author
Robin Oval
committed
renaming mapping functions for clarity
1 parent c3b0e28 commit 8c1dd8c

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/compas_rhino/geometry/surface.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -348,72 +348,72 @@ def closest_points_on_boundaries(self, points):
348348
# mapping
349349
# --------------------------------------------------------------------------
350350

351-
def map_uv0(self, xyz):
352-
"""Return the UV(0) point from the mapping of a XYZ point based on the UV parameterisation of the surface.
351+
def point_xyz_to_uv(self, xyz):
352+
"""Return the UV point from the mapping of a XYZ point based on the UV parameterisation of the surface.
353353
354354
Parameters
355355
----------
356356
xyz : list
357-
XYZ coordinates.
357+
(x, y, z) coordinates.
358358
359359
Returns
360360
-------
361361
list
362-
The UV(0) coordinates of the mapped point.
362+
The (u, v, 0) coordinates of the mapped point.
363363
364364
"""
365365
return rs.SurfaceClosestPoint(self.guid, xyz) + (0.,)
366366

367-
def remap_xyz_point(self, uv):
368-
"""Return the XYZ point from the re-mapping of a UV point based on the UV parameterisation of the surface.
367+
def point_uv_to_xyz(self, uv):
368+
"""Return the XYZ point from the inverse mapping of a UV point based on the UV parameterisation of the surface.
369369
370370
Parameters
371371
----------
372372
uv : list
373-
UV(0) coordinates.
373+
(u, v, 0) coordinates.
374374
375375
Returns
376376
-------
377377
list
378-
The XYZ coordinates of the re-mapped point.
378+
The (x, y, z) coordinates of the inverse-mapped point.
379379
380380
"""
381381
return tuple(rs.EvaluateSurface(self.guid, *uv))
382382

383-
def remap_xyz_line(self, line):
384-
"""Return the XYZ points from the re-mapping of a UV line based on the UV parameterisation of the surface.
383+
def line_uv_to_xyz(self, line):
384+
"""Return the XYZ points from the inverse mapping of a UV line based on the UV parameterisation of the surface.
385385
386386
Parameters
387387
----------
388388
uv : list
389-
List of UV(0) coordinates.
389+
List of (u, v, 0) coordinates.
390390
391391
Returns
392392
-------
393393
list
394-
The list of XYZ coordinates of the re-mapped line.
394+
The list of XYZ coordinates of the inverse-mapped line.
395395
396396
"""
397-
return (self.remap_xyz_point(line[0][:2]), self.remap_xyz_point(line[1][:2]))
397+
return (self.point_uv_to_xyz(line[0][:2]), self.point_uv_to_xyz(line[1][:2]))
398398

399-
def remap_xyz_polyline(self, polyline):
400-
"""Return the XYZ points from the re-mapping of a UV polyline based on the UV parameterisation of the surface.
399+
def polyline_uv_to_xyz(self, polyline):
400+
"""Return the XYZ points from the inverse mapping of a UV polyline based on the UV parameterisation of the surface.
401401
402402
Parameters
403403
----------
404404
uv : list
405-
List of UV(0) coordinates.
405+
List of (u, v, 0) coordinates.
406406
407407
Returns
408408
-------
409409
list
410-
The list of XYZ coordinates of the re-mapped polyline.
410+
The list of (x, y, z) coordinates of the inverse-mapped polyline.
411411
412412
"""
413-
return [self.remap_xyz_point(vertex[:2]) for vertex in polyline]
413+
return [self.point_uv_to_xyz(vertex[:2]) for vertex in polyline]
414414

415-
def remap_xyz_mesh(self, mesh, cls=None):
416-
"""Return the mesh from the re-mapping of a UV mesh based on the UV parameterisation of the surface.
415+
def mesh_uv_to_xyz(self, mesh, cls=None):
416+
"""Return the mesh from the inverse mapping of a UV mesh based on the UV parameterisation of the surface.
417417
418418
Parameters
419419
----------
@@ -423,22 +423,22 @@ def remap_xyz_mesh(self, mesh, cls=None):
423423
Returns
424424
-------
425425
Mesh, cls
426-
The re-mapped mesh.
426+
The inverse-mapped mesh.
427427
428428
"""
429429
if cls is None:
430430
cls = type(mesh)
431431

432432
vertices, faces = mesh.to_vertices_and_faces()
433-
vertices = [self.remap_xyz_point(uv0[:2]) for uv0 in vertices]
433+
vertices = [self.point_uv_to_xyz(uv0[:2]) for uv0 in vertices]
434434
return cls.from_vertices_and_faces(vertices, faces)
435435

436436
# ==============================================================================
437437
# Main
438438
# ==============================================================================
439439

440440
if __name__ == '__main__':
441-
441+
442442
surface = RhinoSurface.from_selection()
443443

444444
points = []

0 commit comments

Comments
 (0)