Action:
|
Creates a new pattern by applying a linear scale to an existing pattern.
|
|
Prototype:
|
outcome api_linear_scale_pattern (
|
|
|
pattern*& pat,
|
|
// created pattern
|
|
|
const pattern& in_pattern,
|
// input pattern
|
|
|
double first_scale,
|
|
// first scale
|
|
|
double last_scale,
|
|
// second scale
|
|
|
int which_dim,
|
|
// dimension for
|
|
|
|
|
|
// scaling
|
|
|
const SPAposition& root,
|
|
// position for
|
|
|
|
|
|
// scaling
|
|
|
logical merge
|
|
// merge flag
|
|
|
|
= TRUE,
|
|
|
AcisOptions* ao = NULL
|
|
// acis options
|
|
|
);
|
|
|
outcome api_linear_scale_pattern(
|
|
|
pattern*& pat,
|
|
// created pattern
|
|
|
const pattern& in_pattern,
|
// input pattern
|
|
|
const SPAvector& first_scale,// first scale
|
|
|
const SPAvector& last_scale,
|
// second scale
|
|
|
int which_dim,
|
|
// dimension for
|
|
|
|
|
|
// scaling
|
|
|
const SPAposition& root,
|
|
// position for
|
|
|
|
|
|
// scaling
|
|
|
logical merge = TRUE,
|
|
// merge flag
|
|
|
AcisOptions* ao = NULL
|
|
// acis options
|
|
|
);
|
|
|
|
Includes:
|
#include "kernel/acis.hxx"
|
|
#include "baseutil/logical.h"
|
|
#include "baseutil/vector/position.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"
|
|
#include "baseutil/vector/vector.hxx"
|
|
Description:
|
Applies a linear scale, from
first_scale to
last_scale (which may be given as vectors when nonuniform scaling is desired), to an existing pattern, merging with any existing scaling or, optionally (with
merge=FALSE), replacing it. The argument
which_dim specifies the dimension in which the scale is applied. The position
root specifies the neutral point about which the scaling takes place (i.e., the point on the seed entity that remains fixed while the entity's dimensions are altered). Both
first_scale and
last_scale must be greater than zero.
|
|
|
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;
|
|
double begin_scale = 0.5;
|
|
double end_scale = 2.0;
|
|
int which_dim = 0;
|
|
SPAposition root(0, 0, 0);
|
|
check_outcome(result = api_linear_scale_pattern(mod_pat, *pat,first_scale, last_scale, which_dim, root));
|
|
|
// 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
|