@djordje wrote:
There is a strange behavior that I am getting with Brep.ClosestPoint method in both Rhino 6 and Rhino 5.
I have a polysurface consisted of two, exactly the same (mirrored) surfaces.
There is a point in between them, lying in the middle of the brep edge that they share:
Judging by this reply from @menno, Brep.ClosestPoint is suppose to identify the closest point to be lying on the brep edge in the middle, which would then result in the normal of this point to be [0,0,1] (the average normal between two brep faces).
But for some reason Brep.ClosestPoint identifies that the closest point actually lies on one of the brep faces (brep face 1), which then incorrectly shows the normal to be the normal of that face.
Why is that so?
This is the example code:import rhinoscriptsyntax as rs import System import Rhino import clr # inputs - brep, pt brep_id = rs.GetObject("select brep") pt_id = rs.GetObject("select pt") brep = rs.coercegeometry(brep_id) pt = rs.coerce3dpoint(pt_id) # out parameters closestPt_out = clr.StrongBox[Rhino.Geometry.Point3d]() ci_out = clr.StrongBox[Rhino.Geometry.ComponentIndex]() u_out = clr.StrongBox[System.Double]() v_out = clr.StrongBox[System.Double]() maxDist = 0 normal = clr.StrongBox[Rhino.Geometry.Vector3d]() succ = Rhino.Geometry.Brep.ClosestPoint(brep, pt, closestPt_out, ci_out, u_out, v_out, maxDist, normal) print "closest type: ", ci_out.ComponentIndexType # prints "Rhino.Geometry.ComponentIndexType.BrepFace" instead of "Rhino.Geometry.ComponentIndexType.BrepEdge"
Any help would be welcomed.
Attached is the 3dm file brep closest pt.3dm (41.0 KB)
Posts: 4
Participants: 2