nc_line_exp()

Command: nc_line_exp(x1, y1, x2, y2, nodes, delta, mode)

Create a node-chain with variable node-spacing.

Parameter
x1,y1 Start-node coordinates
x2,y2 End-node coordinates
nodes No. of nodes
delta Position of the node-spacing-change (0 < delta < 1)
mode Mode of the node-spacing-change (possible values: ‘begin’, ‘end’, ‘both’)

Examples:

Line between points p1=(x1,y1) and p2=(x2,y2) with 9 nodes.

nodes = 9
delta = a/(a+b)   -- in the image below, delta would be 0.25
nc_line_exp(x1,y1, x2,y2, nodes, delta, 'begin')
../../../_images/nc_line_exp1.png

which is the same, as using the following code:

xm = x1 + (x2-x1)*delta
ym = y1 + (y2-y1)*delta
nc_line(x1,y1, xm,ym, math.floor(nodes/2))    -- draws line 'a'
nc_line(xm,ym, x2,y2, math.ceil(nodes/2))     -- draws line 'b'

Using mode = 'end' will automatically set delta = 1-delta interally.

mode = 'both' will split the line into three parts, instead of two.