![]() |
Calculating Minimum And Maximum Distance |
<<< Mass Properties | Chapters | Clash Detection Of Bodies >>> |
Parasolid provides a range of functionality that lets you calculate both the minimum distance (also known as closest approach) and the maximum distance between two different entities or groups of entities. Using this functionality, you can calculate the smallest or greatest distance between:
You can also find the minimum (but not maximum) distance between any entity or group of entities and a position or array of positions.
Note: This functionality offers partial support for facet geometry. |
Figure 28-1 Finding the maximum and minimum distance between entities
This section gives a summary of the functions Parasolid provides for calculating the maximum and minimum distances between entities.
Use the following functions to find minimum and maximum distances between two entities. For convenience, these are referred to as the standard functions in subsequent sections.
Use the following functions to find the minimum and maximum distances between two arrays of entities. For convenience, these are referred to as the array functions in subsequent sections.
The global minimum or maximum distances between two arrays of geometrical entities. |
||
The global minimum or maximum distances between two arrays of topological entities. |
||
The global minimum or maximum distances between an array of topological entities and an array of geometric entities. |
||
The global minimum or maximum distances between two transformed arrays of entities. See Section 28.2.1, “Calculating the distance between transformed entity arrays” for more information. |
Use the following functions to find the minimum distance between a position or array of positions and an entity or array of entities. For convenience, these are referred to as the vector functions in subsequent sections (the last two also fall into the category of array functions already mentioned).
The global minimum distance between a geometrical entity and a position. |
||
The global minimum distances between a geometrical entity and an array of positions, one distance for each geometry/position pairing. |
||
The global minimum distance between a topological entity and a position. |
||
The global minimum distance between an array of geometrical entities and a position. |
||
The global minimum distance between an array of topological entities and a position. |
||
The global minimum distance between a transformed array of entities and an array of positions. See Section 28.2.1, “Calculating the distance between transformed entity arrays” for more information. |
You can calculate the distance between transformed arrays of entities without having to apply a transformation to each entity before the function call using PK_ENTITY_range and PK_ENTITY_range_vector functions,
The transforms for the input entities arrays are supplied via the
tf
(PK_ENTITY_range_vector only),
tf_1
and
tf_2
arguments. Only rigid transformations are supported (i.e reflections, translations, rotations or a combination of these).
If these arguments are set to PK_ENTITY_null, the entities in the array are not transformed.
The following table describes the options available to all of the functions that calculate either a global minimum or maximum distance.
Note: Not all options are available to all functions. Details are provided where relevant. |
have_tolerance tolerance |
By default, Parasolid performs maximum and minimum distance calculations to within Parasolid linear precision. By using these options, you can specify a tolerance on the accuracy of the calculation, allowing for a slacker computation of minimum or maximum distance. Using these options does not affect the accuracy of either:
Available in: all functions, except PK_ENTITY_range and PK_ENTITY_range_vector. Note: The
have_tolerance
option (PK_LOGICAL_false by default) should be used whenever you supply a
tolerance
. |
bound |
Lets you specify a maximum or minimum limit on the distance returned. This is a structure consisting of the following fields:
|
opt_level |
Lets you specify the level of analysis that is used by the function to resolve closely separated local maxima or minima. You can choose between two values:
Available in: all functions, except PK_ENTITY_range and PK_ENTITY_range_vector. Note: This option is also available in functions for calculating local minimum distance, as described in Section 28.6, “Local minimum distance”. |
guess guessesguesses_1guesses_2 |
You can sometimes improve Parasolid’s performance when calculating minimum or maximum distances if you can estimate where on the supplied entities the end points of that distance are likely to be found. You can use these options to supply parameters that you think are near to the end points of the maximum or minimum distance. See Section 28.4, “Using estimates to improve performance” for more information. Available in: all functions except PK_GEOM_range_array, PK_TOPOL_range_array and PK_TOPOL_range_geom_array. |
range_type |
Specifies whether to find the global minimum or the global maximum distance between the given entities. This can be one of the following:
|
param_bound param_boundsparam_bounds_1param_bounds_2 |
Specifies bounds for any geometrical entities. You supply bounds using a PK_range_param_bound_t structure, which should include either: You can supply bounds for both bounded and unbounded geometrical entities.
Available in: all standard and array functions that involve at least one geometrical entity. Note: You must use this option if you are calculating maximum distances using at least one unbounded geometry; failure to do this results in a function error. |
|
Specifies whether to return a vector and parameter on the Available in: all vector functions that involve at least one topological entity and PK_ENTITY_range. Note: This option is also available in functions for calculating local minimum and maximum distance between a topological entity and a position, as described in Section 28.6, “Local minimum distance”. |
The
guess
,
guesses
,
guesses_1
and
guesses_2
options (the name is different depending on which function you call it from) let you provide either a parameter or a vector that represents a place on the entity that you believe is close to an end position of the minimum or maximum distance on that entity. If you can provide such estimates, it can improve Parasolid’s performance when using any of these functions.
Figure 28-2 shows a simple example in which PK_GEOM_range is used to calculate the minimum distance between two curves. For each curve, the parameter highlighted is passed to the function as an estimate, using the
guesses
option. PK_GEOM_range then starts looking for a solution from the supplied parameter, thereby improving performance.
Figure 28-2 Providing estimates when calculating minimum distance between two curves
To use this option, you provide a separate estimate for any entity that you are measuring the distance between as follows:
guesses
guesses_1
and
guesses_2
guess
.
guesses
.
Note: You cannot provide estimates for any of the following array functions: PK_GEOM_range_array, PK_TOPOL_range_array, and PK_TOPOL_range_geom_array. If you are using array functions to measure distances, and you have enough information to provide an estimate, then you should use the corresponding standard function instead (for example, use PK_GEOM_range rather than PK_GEOM_range_array). |
You provide each estimate using a PK_range_guess_t structure. This contains the following fields:
type |
The type of data you are supplying for your estimate. This is one of the following:
|
parameters |
If |
vector |
If |
Note: Estimates are not allowed for calculations involving bodies. For example, if you are looking for the minimum distance between a face and a body, you cannot provide an estimate for the body. |
The following tables provides a summary of the data returned by the maximum/minimum distance functions:
All functions except PK_ENTITY_range and PK_ENTITY_range_vector have the following results structure:
range_result |
A token that indicates the result of the operation. This is one of the following values:
|
range |
A structure that contains the computed The exact structure used depends on the calling function:
The details for each end position are contained in a PK_range_end_t structure. A description of the information that is returned for each function is available in the header documentation for the relevant function: see the PK Interface Programming Reference Manual for more information. |
Note: For PK_GEOM_range_vector_many, an array of range results and ranges is returned, one for each minimum distance calculated (and hence each position received by the function). Consequently, the returned fields for this function are called
range_results
and
ranges
respectively. |
PK_ENTITY_range and PK_ENTITY_range_vector functions have a results structure with the following fields:
A token that indicates the result of the operation. This is one of the following values:
|
|
Double array that indicates the separation distance between entities. |
|
The details for each end position that describes where the |
In addition to finding the global minimum distance between two entities, Parasolid provides support for finding local minimum distance. The following functions are available for this purpose:
The local minimum distance between a geometrical entity and a position |
||
The local minimum or maximum distance between a topological entity and a position |
See the PK Interface Programming Reference Manual for more information.
<<< Mass Properties | Chapters | Clash Detection Of Bodies >>> |