Closest point on surface

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 09 September 2004   #1
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.
Old 09 September 2004   #2
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.
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 ?
Old 09 September 2004   #3
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
Old 09 September 2004   #4
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).

Got Maxscript?
Old 01 January 2006   #5
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.
Thread Closed share thread

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
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:25 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.