| Algorithm 1 on the target part to serve as the end of an ingate. | |
|
Input: : List of triangular faces : The endpoint of the streamline in an ingate of the source part’s process : The threshold of distance : The normal vector at point P. : The mean curvature at point P. : The Gaussian curvature at point P. | |
| 1: | Initialize List |
| 2: | Initialize Dictionary |
| 3: | For in do |
| 4: | Calculate the center point of |
| 5: | |
| 6: | |
| 7: | End For |
| 8: | Build K-D Tree using |
| 9: | The cluster of center points closest to |
| 10: | Initialize List |
| 11: | For in do |
| 12: | |
| 13: | Calculate the projection point of on the plane |
| 14: | If is outside of then |
| 15: | Choose the vertex of that is closet to as the new |
| 16: | End If |
| 17: | |
| 18: | End For |
| 19: | Initialize |
| 20: | Initialize |
| 21: | For in do |
| 22: | Approximate the normal vector of by the normal vector of |
| 23: | Compute the mean curvature and Gaussian curvature at using barycentric coordinate interpolation |
| 24: | Substitute , , , , , to calculate the total error using Equation (1) |
| 25: | If then |
| 26: | |
| 27: | |
| 28: | End If |
| 29: | End For |
| Output: The position of the optimal point on the STL surface of the target part. | |