Putting a Pattern Along a Surface
List of: Discussion Topic
Subjects: Patterns, Examples
Contents: Kernel

Suppose that you have a face, called face, and you want to produce a pattern of elements, from the seed entity ent, that follow the face's surface both in terms of position and direction. The function api_surface_pattern can be used with either a surface or a face.

You must specify the point, named root in this example, to be mapped to the pattern sites on the face. This may be a point on the seed entity, if you want the seed entity to intersect the face, but it need not be. You may simply wish to create a pattern that is parallel to the face, at some distance, in which case you can specify a point removed from the seed entity. Similarly, you need to specify the directions to be mapped to the two orthogonal tangent directions of the surface. For example, call these u_dir and v_dir, since they correspond to the uv parameterization of the face's surface. You may then proceed as follows:

// define the pattern parameters
pattern* pat = NULL;
int num_u = . . .;
int num_v = . . .;
SPAposition root(. . ., . . ., . . .);
logical on_boundary = . . .;
SPAvector u_dir(. . ., . . ., . . .);
SPAvector v_dir(. . ., . . ., . . .);

// create the pattern
outcome result = api_surface_pattern(pat, face, num_u,

num_v, root, on_boundary, u_dir, v_dir);
check_outcome(result);
// apply the pattern
result = api_set_entity_pattern(ent, pat);
check_outcome(result);
// clean up
pat->remove();
PDF/KERN/04PATT.PDF
HTM/DATA/KERN/KERN/04PATT/0016.HTM