| 
 | 
 本帖最后由 794779857lock 于 2013-12-6 21:50 编辑  
 
If Rhino.Distance(pt, Rhino.BrepClosestPoint(idSurface, pt)(0)) < 0.1 Then 
这是用两点之间的距离小于0.1来判断是否点在被剪辑的曲面上 
因为你要在一个曲面上找一个点,那么这个曲面可能是被裁剪过的,当你想用曲面的UV定义曲面上的一个点的时候,使用的是被裁剪过之前的曲面的UV,而根据UV值得到的曲面上的点就可能是在曲面外的,Rhino.BrepClosestPoint(idSurface, pt)是用你现在的点找到被裁剪之前的曲面上的最近点(如果没被裁剪过,可能就是重合的)。Rhino.Distance(pt, Rhino.BrepClosestPoint(idSurface, pt)(0))是用这个投影的点与原来的点的点测量距离,如果小于0.1可以被认为是重合,那么这个点就在被裁剪的曲面上(误差0.1)。 
python里的说明: 
BrepClosestPoint 
Returns the point on a surface or polysurface that is closest to a test point. This function works on both untrimmed and trimmed surfaces. 
 
Syntax 
rhinoscriptsyntax.BrepClosestPoint (object_id, point) 
 
rhinoscript.surface.BrepClosestPoint (object_id, point) 
 
Parameters 
object_id 
 Required. String or Guid. The object's identifier. 
  
point 
 Required.  List of three numbers or Point3d.  The test, or sampling, point. 
  
 
Returns 
List 
 An array of closest point information if successful.  The list will contain the following information: 
 
Element 
 Type 
 Description 
  
0 
 Point3d 
 The 3-D point at the parameter value of the closest point. 
  
1 
 List (U, V) 
 Parameter values of closest point.  Note, V is 0 if the component index type is brep_edge or brep_vertex. 
  
2 
 List (type, index) 
 The type and index of the brep component that contains the closest point. Possible types are brep_face, brep_edge or brep_vertex. 
  
3 
 Vector3d 
 The normal to the  brep_face, or the tangent to the brep_edge.   
  
  
None 
 If not successful, or on error. 
  
 
 
 
Distance 
Measures the distance between two 3-D points, or between a 3-D point and an array of 3-D points. 
 
Syntax 
rhinoscriptsyntax.Distance (point1, point2) 
 
rhinoscript.utility.Distance (point1, point2) 
 
Parameters 
point1 
 Required.  List of 3 numbers or Point3d.  The first 3-D point. 
  
point2 
 Required.  point or list of points. 
  
 
Returns 
Number 
 If point1 and point2 are specified as single points, then the distance is successful. 
  
List 
 If point2 is a list of points, then a List of distances if successful. 
  
None 
 If not successful, or on error. 
  
 |   
 
 
 
 |