Action:
|
Creates a random pattern within the indicated region.
|
|
Prototype:
|
outcome api_random_pattern (
|
|
|
pattern*& pat,
|
// pattern created
|
|
|
const SPAvector& extents,// vector components
|
|
|
|
|
// give pattern extents
|
|
|
|
|
// in each direction
|
|
|
int num_elements,
|
// # of pattern elements
|
|
|
int dimension
|
// pattern dimensionality
|
|
|
|
= 3,
|
|
|
logical ellipsoidal
|
// ellipsoidal flag
|
|
|
|
= FALSE,
|
|
|
const SPAvector& x_vec
|
// direction for first
|
|
|
|
= SPAvector(1, 0, 0),// extent component
|
|
|
const SPAvector& y_vec
|
// direction for second
|
|
|
|
= SPAvector(0, 1, 0),// extent component
|
|
|
AcisOptions* ao = NULL
|
// acis options
|
|
|
);
|
|
Includes:
|
#include "kernel/acis.hxx"
|
|
#include "baseutil/logical.h"
|
|
#include "baseutil/vector/vector.hxx"
|
|
#include "kernel/kernapi/api/api.hxx"
|
|
#include "kernel/kernutil/law/pattern.hxx"
|
|
#include "kernel/kernutil/law/pattern_api.hxx"
|
|
#include "kernel/kernapi/api/acis_options.hxx"
|
|
Description:
|
Creates a random pattern of number elements, centered at the location of the pattern seed entity and extending distances given by the components of
extents in
dimension dimensions. The arguments
x_vec and
y_vec specify the orientation of the pattern, and are the directions associated with the first two components of extents. (The third component is associated with the cross product of these arguments.) When an ellipsoidal pattern is selected (ellipsoidal=TRUE), the number of pattern elements actually generated may differ somewhat from
number.
|
|
|
The following code snippet shows an example of how this API can be used.
|
|
|
// Create a pattern
|
|
pattern* pat = NULL;
|
|
SPAvector extents = (50, 25, 10);
|
|
int number = 100;
|
|
int dimensions = 3;check_outcome(result = api_random_pattern(pat, extents, number, dimensions));
|
|
|
// Create a prism
|
|
BODY* prism = NULL;
|
|
double height = 1.0;
|
|
double maj_rad = 1.0;
|
|
double min_rad = 0.5;
|
|
int num_sides = 3;
|
|
check_outcome(result = api_make_prism(height, maj_rad, min_rad, num_sides, prism));
|
|
|
// Apply the pattern to the prism
|
|
check_outcome(result = api_set_entity_pattern(prism, pat));
|
|
|
// Clean up
|
|
pat->remove();
|
|
Errors:
|
The number of elements specified is less than one, or the dimensionality is greater than three or less than one.
|
|
Library:
|
kernel
|
|
Filename:
|
kern/kernel/kernutil/law/pattern_api.hxx
|
|
Effect:
|
Changes model
|