Notifications
Clear all

[Closed] Point3 and isolated verts

Hi

im writing some tools to clean meshes and/or warn the artists about various aspects of a model so i have written a little loop that gets all the positions of the verts of a mesh and compares them to see if any are on top of one another, ie unwelded/open edged

So, this works fine EXCEPT when a vert is isolated, even if its exactly in the same position it will not consider it as a problem vert

Any thoughts why? because when i get the two vert positions in the listener and compare the literal values there it returns them to be equal and true

Thanks for any input,

Cheers
Dave

6 Replies

Hi
Thanks for your reply but I already knew about the remove isolated verts function, the issue was with why max would return them differently or have a different precision for them. It seems that it was a precision issue and with a small tolerance included in the calculation my function finds all coincident verts,isolated or not. So I guess that’s the answer, max is not very accurate

Hm, I don’t believe that it’s a max precision problem.

I’ve uploaded a scene which probably covers all the possible combinations between isolated and non-isolated verts.

Using the following code, seems to work fine.


polyObj = $Plane001
thresh = .1
vertsCount = polyOp.getNumVerts polyObj
vertPosAr = for i=1 to vertsCount collect polyOp.getVert polyObj i
vertsForWelding = #()
for i=1 to vertsCount - 1 do (
 for j=i+1 to vertsCount do (
  if distance vertPosAr[i] vertPosAr[j] <= thresh then (
   append vertsForWelding i; append vertsForWelding j;
  )
 )
)
polyObj.weldThreshold = thresh
polyop.weldVertsByThreshold polyObj vertsForWelding

You should look at close_enough in the maxscript help:

close_enough <float> <float> <int>

Returns true if the two <float> values are approximately equal, where increasing values of <int> increase the range defined as appoximately equal. Available in 3ds Max 2008 and higher.

I use this function to verify whether various faces, edges and verts are co-planar.

@sinokgr, yep that is very close to what i ended up with
@AlexanderH, the close_enough is a bit odd as uit takes an Int for the tolerance/threshold, i ended writing a tiny little function to do a nicer tolerance based on a float

I shall try it when i get a chance, but what happens on your uploaded scene with thresh 0.0?

1 Reply
(@alexanderh)
Joined: 11 months ago

Posts: 0

Well, it turns out that after going back to the source point I was thinking of, I have indeed commented out use of close_enough in favour of a small function to compare the floats myself with a tolerance level as defined by the scripts themselves.

it equates to this:

if abs(point1.x - point2.x) <= PLANAR_THRESHOLD then --10mm is the threshold for which to verify!
		(return true	)
		else
		(return false)