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.
// 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.Example
Example
Example