# AB4D Forum

Full Version: fill holes on a mesh
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everybody, i need a hand!
i have a project with some meshes that rapresent tooth and gum (see the attached image).

I wrote a program for tooth handling (the white meshes) and i use it to move/rotate every tooth.
When i move a tooth the gum moves itself to reconnect the tooth but moving itseft it creates some holes near the adjacent tooth.
Somebody can tell me how I can  do to refill the hole?

thanks!
Hm, I am sorry to see that you still did not find the solution for this problem.

As I have written to you some time ago, I would try with the following procedure (but I am not sure if this would actually work):

1)

First I would copy all the positions and triangle indices from MeshGeomery3D to simple arrays: Point3D[], Int32[] - I would then always work on those arrays - this would provide great performance improvement because I would need to go through positions and triangles many times. Except in the final step, I would change the Positions in the MeshGeomery3D - those that are actually shown.

2)
After reading the model and showing it, I would analyze the 3D model: in the first pass I would calculate the center of each teeth and then for each tooth create a List of position indexes with positions from gum that are close to that teeth (this would reduce the number of positions that I would need to check in the next pass)

3)
For each tooth, I would go through all positions that are near it (from a list in the previous pass) and calculate the position's distance to the closest position on the teeth (so go through all positions on the teeth and get the closest distance - you can use LengthSquared to skip sqrt operation and only at the end when you have the smallest LengthSqueard value calculate the actual distance with using sqrt(LengthSquared). After you have the distance from the position on the gum to the closest position on the teeth, I would convert the absolute distance value into a relative value - 1 would mean that the position is very close to the tooth, 0.5 is farther away, 0 is so far away that when the tooth is moved the position does not move. You would need trial and error to determine the amount.

This would finish the position analysis.

4)
When a tooth is moved, I would use the same transformation as for the teeth on the gum positions around the teeth (get in (2)) but would multiply the transformation with the relative distance values (from (3)) - so positions closer to the teeth would be moved more than those farther away.

I am not sure if this would work perfectly in all situations but would surely be much better then not moving any gum position.

Have you tried to implement that?
Yes,

and it works perfectly!

but when there is little material (gum) between one tooth and the other, by transforming the gum points, the gum moves away from the neighboring teeth by widening the hole where the neighboring tooth is positioned and making the defect that I have attached to you in the image.
any ideas? How i can fill the hole created?