das
das sets the spacing of the nodes along an edge by the sizes of its first and last intervals.
Syntax
das imin jmin kmin imax jmax kmax direction gap1 gap2
The first six numbers are a region, as for lin. direction is i, j or k. gap1 is the length of the first interval, at the end with the lowest index. gap2 is the length of the last interval, at the end with the highest index. Both are positive real numbers.
What it does
James fixes the two end intervals and finds two ratios, one for each side, so that the intervals grow smoothly from each end toward the middle and fill the edge. As for drs, the two middle intervals of an edge with an even number of intervals are equal, and an edge with an odd number shares one middle interval. For an edge of length 11 cut into four intervals, gaps of 1 and 2 give the intervals 1, 4, 4 and 2.
The region and the direction select edges. For each combination of the two indices other than the direction, within the region, there is one edge running in the direction. If the region spans more than one reduced index along the direction, James ignores the partitions inside the span and treats it as one composite edge.
When James applies it
With the edge interpolation, in steps 4 and 5. James lays out the edges that a spacing command reaches at step 4, in the order of the commands, so the later command holds on nodes that two commands share. Step 5 spaces every other edge equally. After step 6 projects the nodes of an edge onto a surface, James spaces them again along the projected edge by the same rule, and repeats until they settle. An edge attached to a curve is spaced along the curve. The command is legal only in the Part phase. James refuses it in the Control and Merge phases (E0412).
Rules James adds
- A gap that is zero or negative is an error (E0902).
gap1plusgap2may not exceed the length of the edge (E0903). A sum equal to the length is accepted and leaves every interval between the two gaps at zero length. James checks this against the edge’s current length each time it spaces the edge, so a projected edge is held to it too.- A region with no length in the direction is an error (E0900).
- A
dasover an edge of two intervals whose gaps do not add to the edge is an error that names the command, because the two gaps then fix every interval. - On a
cylinderpart James measures the length of an edge in the part’s own coordinates. Along an edge in the angle direction, a size or a gap counts degrees, not a distance.
Diagnostics
- E0102: a reduced index lies outside the part.
- E0106: a range of the region is written high to low.
- E0900: the region has no length in the direction.
- E0902: a gap is zero or negative.
- E0903: the two gaps together exceed the edge.
Example
The script tests/corpus/078-das-derive-two-ratios/input.tg, which make test runs:
block 1; 1 5; 1;
0;
0 11;
0;
das 1 1 1 1 2 1 j 1 2
endpart
The edge runs along j from 0 to 11 in four intervals. The gaps 1 and 2 leave 8 for the two middle intervals, which are equal at 4. The intervals are 1, 4, 4 and 2, and the nodes sit at 0, 1, 5, 9 and 11. With merge, neutral and write added to the script and --write-unref-nodes on the command line, James writes the nodes. The flag is needed because the part has no element.
The script tests/corpus/079-das-gap-sum-exceeds-rejected/input.tg gives gaps of 6 and 8 on the same edge:
block 1; 1 5; 1;
0;
0 11;
0;
das 1 1 1 1 2 1 j 6 8
endpart
The gaps add to 14, which is more than 11. James prints this and exits with 1, as tests/corpus/079-das-gap-sum-exceeds-rejected/expected.diag.txt holds:
input.tg:5:1: error [E0903]: das gap1 + gap2 exceeds the edge's total arc length
james: 1 error, 0 warnings
See also
- drs: two ratios in place of two gaps.
- as: fixes one end interval.
- Shaping a part: the order of steps.