HC_Compute_Selection_By_Swept_S
-
int
HC_Compute_Selection_By_Swept_S(char const *action, char const *start_seg, Key shellkey, int number_of_sweeps, float const matrices[], char const *options) - int HC_Compute_Selection_By_Swept_S(char const action, char const start_seg, Key shellkey, int number_of_sweeps, float const matrices, char const options)
Forces a selection event between the volume created by a shell moving along a path and a specified portion of a segment tree.
This routine forces a selection event that is of a special form wherein the selection object is provided in object space. The routine operates with a volume that is defined by a shell swept along a particular path and is often used to implement collision detection capabilities. The process of first performing the selection event, and then querying the results is similar to the more standard selection process provided by Compute_Selection(). To see what actual volume is used to perform the selection, users can call Compute_Swept_Shell_Along_Path().
Each matrix in the matrices array consists of 16 floating point values, and each matrix can contain both rotational and translational elements. The first modelling matrix in the array is not included in the sweep, but rather defines the initial starting position of the shell. Also, the modelling matrices are absolute and are not appended to the previous matrix.
Please note that the volume created by the sweep is not guaranteed to be watertight. Also, the interpolation between each step is linear and may not accurately reflect the desired movement. To reduce the errors, users should increase the number of steps in the sweep.
The options string can be used to control certain properties of the selection volume. The following choices for options are recognized:
generate front [= on | off]
When set, the swept shell(s) will include a copy of the original shell at the start location. This effectively closes the ‘front’ of the volume.
generate back [= on | off]
The swept shell will include a copy of the shell at the final location. This effectively closes the ‘back’ of the volume.
deviation = x
A radian value controlling the generation of silhouette edges. If the angle between a face plane and an edge vector is less than this angle (in radians) then the edge in question will be regarded as a silhouette edge. Increasing this value will improve quality but may impact performance.
last silhouette = ddd
Integer value that instructs the computation algorithm to include the silhouettes from ddd number of previous steps in the sweep. Increasing this value will improve quality but may impact performance.
The default setting for options is “generate front, generate back, deviation = 0, last silhouette = 1”
If only two matrices are provided and the second matrix only contains a translation component (all other entries are 0) the function Compute_Swept_Shell() is used for the sweeping operation, which can result in performance improvements. Otherwise the volume is calculated using Compute_Swept_Shell_Along_Path().
Use of Begin_Shell_Selection() constitutes a promise not to perform certain operations on anything contained in the segment tree until after the matching call to End_Shell_Selection(). See Begin_Shell_Selection() for details on the restrictions imposed.
Only facetted geometries such as shells, meshes, NURBS surfaces, polygons, and polycylinders are selectable.
HC_Compute_Swept_Shell, HC_Compute_Swept_Shell_Along_Path
Parameters
action: One of “v”, “^”, “*”, or “O”. Action is compared against the selectability attribute settings as testing proceeds. See Set_Selectability() for a detailed explanation of actions.
start_seg: A segment in the tree at which to start selection testing.
shellkey: Key to the shell that should be used for testing.
number_of_sweeps: The number of distinct steps in the sweep.
matrices: An array of matrices with each matrix having its own distinct 4x4 matrix.
options: A string through which a user can set options that affect the sweep.
Returns
count The number of objects that are touched by any part of the specified geometry.