res

res sets the spacing of the nodes along an edge by a ratio between neighbouring intervals.

Syntax

res imin jmin kmin imax jmax kmax direction ratio

The first six numbers are a region, as for lin. direction is i, j or k. ratio is a positive real number: the length of each interval divided by the length of the interval before it, counted from the end with the lowest index.

What it does

The intervals along the edge form a geometric series with the ratio you give, and James scales the series so that it fills the edge. A ratio of 2 doubles each interval. A ratio of 0.5 halves it. A ratio of 1 is equal spacing, which is the default. For an edge of length 7 cut into three intervals, a ratio of 2 puts the nodes at 0, 1, 3 and 7.

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).
  • A region that spans several partitions along the direction is one composite edge, and the vertices inside it slide to their places in the series. For an edge of length 7 with five partitions, a ratio of 2 puts the nodes at 0, 0.467, 1.4, 3.267 and 7, to three decimals.

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: the ratio is zero or negative.

Example

The script tests/corpus/080-res-no-length-rejected/input.tg, which make test runs:

block 1 5; 1 4; 1 3;
0 1;
0 .5;
0 .3;
res 1 1 1 1 2 2 i 2
endpart

The region 1 1 1 1 2 2 has the same lowest and highest i, so it has no length along i. James prints this and exits with 1, as tests/corpus/080-res-no-length-rejected/expected.diag.txt holds:

input.tg:5:5: error [E0900]: region has no length in the i direction
james: 1 error, 0 warnings

See also

  • drs: two ratios, one from each end.
  • as: sets the size of the first or last interval.
  • lin: interpolates a region that spans several partitions.
  • Shaping a part: the order of steps.

James 0.3.1.

This site uses Just the Docs, a documentation theme for Jekyll.