Skip to content

Commit d4e87e4

Browse files
committed
clean surface closest_point method
- extend docstring - remove unused distance input - rename paramter to return_parameters for consistence with compas core
1 parent 21dbd61 commit d4e87e4

File tree

1 file changed

+16
-2
lines changed
  • src/compas_occ/geometry/surfaces

1 file changed

+16
-2
lines changed

src/compas_occ/geometry/surfaces/nurbs.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,12 +654,26 @@ def frame_at(self, u, v):
654654
self.occ_surface.D1(u, v, point, uvec, vvec)
655655
return Frame(Point.from_occ(point), Vector.from_occ(uvec), Vector.from_occ(vvec))
656656

657-
def closest_point(self, point, distance=None, parameter=False):
657+
def closest_point(self, point, return_parameters=False):
658658
"""Compute the closest point on the curve to a given point.
659+
660+
Parameters
661+
----------
662+
point : Point
663+
The point to project to the surface.
664+
return_parameters : bool, optional
665+
Return the projected point as well as the surface UV parameters as tuple.
666+
667+
Returns
668+
-------
669+
:class:`compas.geometry.Point`
670+
The nearest point on the surface, if ``return_parameters`` is false.
671+
(:class:`compas.geometry.Point`, (float, float))
672+
The nearest as (point, parameters) tuple, if ``return_parameters`` is true.
659673
"""
660674
projector = GeomAPI_ProjectPointOnSurf(point.to_occ(), self.occ_surface)
661675
point = Point.from_occ(projector.NearestPoint())
662-
if not parameter:
676+
if not return_parameters:
663677
return point
664678
return point, projector.LowerDistanceParameters()
665679

0 commit comments

Comments
 (0)