Action:
|
Creates a new pattern by applying random rotations at each site of an existing pattern.
|
|
Prototype:
|
outcome api_random_orient_pattern (
|
|
|
pattern*& pat,
|
|
// created pattern
|
|
|
const pattern& in_pat,
|
|
// input pattern
|
|
|
const SPAposition& root
|
|
// root position
|
|
|
|
= SPAposition(0, 0, 0),
|
|
|
const SPAinterval& axial_range// range of axial
|
|
|
|
= SPAinterval(0.0,
|
|
// rotation angles
|
|
|
|
2.0* 3.14159265358979323846),
|
|
|
const SPAvector& axial_dir
|
// axis for tilt
|
|
|
|
=*(SPAvector*)NULL_REF,
|
|
|
const SPAinterval& tilt_range
|
// tilt range
|
|
|
|
= SPAinterval(0, 3.14159265358979323846),
|
|
|
const SPAvector& tilt_dir
|
// tilt direction
|
|
|
|
=*(SPAvector*)NULL_REF,
|
|
|
AcisOptions* ao = NULL
|
|
// acis options
|
|
|
);
|
|
Includes:
|
#include "kernel/acis.hxx"
|
|
#include "baseutil/vector/interval.hxx"
|
|
#include "baseutil/vector/position.hxx"
|
|
#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 new pattern by applying random rotations at each site of an existing pattern, using
root as the position on the seed entity about which the rotation is to occur. The default arguments yield a totally random rotation. If the user specifies the
tilt_dir and/or
axial_dir arguments, the former gives the direction about which the interval
tilt_range is applied, while the latter gives the direction about which the interval
axial_range is applied. If the
tilt_dir argument is not orthogonal to
axial_dir, only its orthogonal component is used.
|
|
|
The following code snippet shows an example of how this API can be used.
|
|
|
// Create a pattern
|
|
pattern* pat = NULL;
|
|
SPAvector x_vec(4.0, 0, 0);
|
|
int num_x = 8;
|
|
SPAvector y_vec(0, 2.0, 0);
|
|
int num_y = 10;
|
|
check_outcome(result = api_linear_pattern(pat, x_vec, num_x, y_vec, num_y));
|
|
|
// Modify the pattern
|
|
pattern* mod_pat = NULL;
|
|
SPAposition root(0, 0, 0);
|
|
SPAinterval axial_range(0, 2 * M_PI);
|
|
SPAinterval tilt_range(0, 0);
|
|
SPAvector axial_dir(1, 0, 0);
|
|
SPAvector tilt_dir(0, 1, 0);
|
|
check_outcome(result = api_random_orient_pattern(mod_pat, *pat, axial_range, tilt_range, axis));
|
|
|
// 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, mod_pat));
|
|
|
// Clean up
|
|
pat->remove();
|
|
mod_pat->remove();
|
|
Library:
|
kernel
|
|
Filename:
|
kern/kernel/kernutil/law/pattern_api.hxx
|
|
Effect:
|
Changes model
|