drs
drs sets the spacing of the nodes along an edge by two ratios, one from each end.
Syntax
drs imin jmin kmin imax jmax kmax direction ratio1 ratio2
The first six numbers are a region, as for lin. direction is i, j or k. ratio1 and ratio2 are positive real numbers. ratio1 is the ratio of each interval to the one before it, counted from the end with the lowest index. ratio2 is the same ratio counted from the end with the highest index, moving inward.
What it does
Two geometric series start at the two ends and meet in the middle. James scales them so that together they fill the edge. When the edge has an even number of intervals, the two intervals at the middle are equal. When the number is odd, the two series share one middle interval. A single interval takes the whole length whatever the ratios are.
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 ratio that is zero or negative is an error (E0901).
- A region with no length in the direction is an error (E0900).
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.
- E0901: a ratio is zero or negative.
Example
The script tests/corpus/076-drs-both-ends/input.tg, which make test runs:
block 1; 1; 1 5;
0;
0;
0 17;
drs 1 1 1 1 1 2 k 2 3
endpart
The edge runs along k from 0 to 17 in four intervals. With ratio1 2 and ratio2 3, the intervals from the low end are 3, 6, 6 and 2, which add to 17. The two middle intervals are equal, as the rule says. The nodes sit at 0, 3, 9, 15 and 17. 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.
See also
- res: one ratio from the low end.
- das: two end gaps in place of two ratios.
- Shaping a part: the order of steps.