An array of copy steps will cumulatively copy points from an original set of
points.
So, if there are two copy steps then:
the first step will copy the original points
the second step will copy the original points and the first copy of the
points
For example, a grid of a shape can be made with two copy steps. The first
replicates the shape along the x axis, creating a line of shapes. The second
copy step then replicates the line of shapes in the y axis, creating a grid
of shapes.
Each copy step appends its copied points onto an array of points that
started with the original points. By default, copy steps operate on all
points created in previous steps. However, the properties start and end
can be used to make the current step only operate on a subset of the points.
start and end refer to the indexes of the copy steps where the original
points is at index 0, and the first copy step is at index 1. Copy step
arrays can also include marker strings which make defining start and
end more convient (see the third example below). These marker strings
can be used as start and end values. Marker strings are included
in the copy step indexing.
There are two main ways to make a copy, either copy the points to a
location, or copy the points along a path.
When using the to property, if a Point is defined
then the points will be copied to that point. If a Transform is
defined, then a copy of the points will be transformed by that transform. An
array of points and transforms can be defined to make multiple copies of the
points.
When using the along property, the points are copied a number (num) of
times along a path with some step. The paths can be horiztonal ('x'),
vertical ('y'), along the z axis ('z'), at an angle in the xy plane,
(number), along a direction vector (TypeParsablePoint) or through a
'rotation' around a center point and axis.
When copying along a line (along is 'x', y', 'z',
TypeParsablePoint or a number), then step will be the distance offset
along the line.
When copying along a rotation (along is 'rotation'), then step will be
the angular step in radians.
Any step can use the original property - but it will only operate on the
last step that uses it. When original is false, then all points before
that copy step will not be included in the returned Point array.
toTypeParsablePoint | TypeParsableTransform | TypeParsablePoint | TypeParsableTransform[] — copy points to
a location or locations or transform a copy of the points
alongnumber | TypeParsablePoint — copy points along a linear path where number is a path at an angle in
radians in the xy plane, and TypeParsablePoint is a direction vector
axisTypeParsablePoint — axis to rotate a 'rotation' copy around
(default is the z axis so rotation is in xy plane [0, 0, 1])
numnumber — the number of copies to make when copying along a
path
stepnumber — distance between copies if along is 'x' or
'y' or a number, delta angle between copies if along is 'rotation'
centerTypeParsablePoint — the center point about which to rotate
the copies when using along = 'rotation'
startstring | number — copy step index or marker defining the
start of the points to copy
endstring | number — copy step index or marker defining the end
of the points to copy
originalboolean — false excludes all points before this step
in the final result (true)
// Ring copy (without original shape) figure.add({ name:'halfRings', make:'polygon', radius:0.1, sides:20, fill:'tris', copy: [ 'ring1', // marker 1 { to: [0.5, 0], original:false, // don't include the original shape }, { along:'rotation', num:7, step:Math.PI / 7, start:'ring1', // copy only from marker 1 }, 'ring2', // marker 2 { to: [1, 0], start:0, // make a copy of the original shape only end:1, }, { along:'rotation', num:15, step:Math.PI / 15, start:'ring2', // copy points from Marker 2 only }, ], }); @interface
Copy Step options object
A copy step defines how to copy existing points.
An array of copy steps will cumulatively copy points from an original set of points.
So, if there are two copy steps then:
For example, a grid of a shape can be made with two copy steps. The first replicates the shape along the x axis, creating a line of shapes. The second copy step then replicates the line of shapes in the y axis, creating a grid of shapes.
Each copy step appends its copied points onto an array of points that started with the original points. By default, copy steps operate on all points created in previous steps. However, the properties
startandendcan be used to make the current step only operate on a subset of the points.startandendrefer to the indexes of the copy steps where the original points is at index 0, and the first copy step is at index 1. Copy step arrays can also include marker strings which make definingstartandendmore convient (see the third example below). These marker strings can be used asstartandendvalues. Marker strings are included in the copy step indexing.There are two main ways to make a copy, either copy the points
toa location, or copy the pointsalonga path.When using the
toproperty, if a Point is defined then the points will be copied to that point. If a Transform is defined, then a copy of the points will be transformed by that transform. An array of points and transforms can be defined to make multiple copies of the points.When using the
alongproperty, the points are copied a number (num) of times along a path with somestep. The paths can be horiztonal ('x'), vertical ('y'), along the z axis ('z'), at an angle in the xy plane, (number), along a direction vector (TypeParsablePoint) or through a'rotation'around acenterpoint andaxis.When copying along a line (
alongis'x',y','z',TypeParsablePointor anumber), thenstepwill be the distance offset along the line.When copying along a rotation (
alongis'rotation'), thenstepwill be the angular step in radians.Any step can use the
originalproperty - but it will only operate on the last step that uses it. Whenoriginalisfalse, then all points before that copy step will not be included in the returned Point array.toTypeParsablePoint | TypeParsableTransform |TypeParsablePoint | TypeParsableTransform[] — copy points to a location or locations or transform a copy of the pointsalongnumber| TypeParsablePoint — copy points along a linear path wherenumberis a path at an angle in radians in the xy plane, andTypeParsablePointis a direction vectoraxisTypeParsablePoint — axis to rotate a 'rotation' copy around (default is the z axis so rotation is in xy plane[0, 0, 1])numnumber— the number of copies to make when copyingalonga pathstepnumber— distance between copies ifalongis'x'or'y'or anumber, delta angle between copies ifalongis'rotation'centerTypeParsablePoint — the center point about which to rotate the copies when usingalong='rotation'startstring|number— copy step index or marker defining the start of the points to copyendstring|number— copy step index or marker defining the end of the points to copyoriginalboolean—falseexcludes all points before this step in the final result (true)Example
Example
Example