By Tony Hornbuckle, Senior Software Engineer
The api_entity_point_distance algorithm has had significant improvements in ACIS in recent releases. In R18, an optimised multi-point interface was introduced for large point sets – a common workflow for CMM customers. In R20, this multi-point interface has been made ‘thread-hot’, and will automatically make use of multiple processor cores when ACIS threading is enabled (available to Thread Safe Modeler licensees).
This API returns a distance and a closest point. Optionally we provide the closest entity and any relevant parameter information about the closest point on that entity.
When using the algorithm, for best performance we recommend that:
- The multi-point interface be used for all but the smallest sets of points – the optimisations can show benefits even for sets of 2 or 3 points
- The application passes complete entities, rather than making multiple calls for each face on a body for a set of points – otherwise internal optimisation may be bypassed
Better performance is also gained if sequential points are close together – such as ‘scanline’ data.
Within the multi-point interface, we also provide a ‘signed_distance’ mode. In the default mode, we return the closest point on the solid – so a point inside a body will return a distance of 0. In the ‘signed distance’ mode, we return the closest point on the solid boundary, so a point inside a body will return a negative distance. The next planned enhancement is to provide an ‘unsigned distance’ mode. This will simply return the distance to and closest point on the solid boundary, without the cost of determining whether the point is inside or outside the body.