# Closest point on surface

 09 September 2004 BennyE New Member Benny Edlund Mocap editor - Centroid Animation Weta Digital Wellington, New Zealand Closest point on surface Does anyone know if there is a meshOps command or similar for finding the closest point on a surface based on a point in space? I could write it myself in maxscript but it would be very slow so it would be great if there was a script command that could handle it. Benny E. share quote
 09 September 2004 externe polyop is good for you I Don't think that exists. But it's simple to do Take a look at meshop.getElementsUsingFace Then for in loop inside the vertex list and to calculate the distance. Keep the min distance. Easy __________________ a few things on max 1. You prefer to have a foam leg or an arm of 315 inches ? 2. You prefer to have an ear of 9 pounds or to have 30 fingers at each hand ? share quote
 09 September 2004 DentonVanZan Veteran this should work, no evaluation in notepad! fn findTheClosestPoint pointX obj = ( local posArr = #() for i = 1 to (polyOp.getNumFaces obj) do ( local vPos = polyOp.getVert obj append posArr vPos ) local sPosArr = #() for i in posArr do ( local distX = distance pointX i append sPosArr distX ) local minDistance = amin sPosArr local minVert = findItem sPosArr (minDistance) return minVert ) See ya share quote
 09 September 2004 LFShade smarter than I look   for sale or rent! If I understand you correctly, you want the distance to the closest point on the surface, not just the closest vertex. Unfortunately, Maxscript offers no built-in function to accomplish this. If you're going to go about the task of calculating it "the hard way," I would suggest looking into rayMeshGridIntersect or John Burnett's fooLib for functions that might help optimize the search for the closest point (i.e. limiting the search to include only the closest faces). RH __________________ Got Maxscript? RHTools share quote
 01 January 2006 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.