TRIM

The TRIM function smoothly interpolates between the slope m1 defined through the line segment given by x0, y0, x1, y1 and m2 defined through the line segment given by x1, y1, x2, y2.

Format

TRIM(x, x0, y0, x1, y1, x2, y2, radius [, limit])

Description

For values x < xI1, the function is guaranteed to return the point corresponding to x on the line through x0, y0 and x1, y1. For values x > xI2 the function is guaranteed to return the point corresponding to x on the line defined through x1, y1 and x2, y2.

For values of x in between xI1 and xI2, the function value does a smooth transition between both slopes where the derivative of TRIM with respect to x is always in between m1 and m2.

Defining limit does limit the radius with respect to the relative length of the line segments. For example, let l1 be the length of line segment 1 and l2 be the length of line segment 2, further let l be equal to the length of the smaller of those line segment. If radius is larger than limit * l, the radius will be set to limit * l.


Figure 1.

Arguments

x
The independent variable.
x0
The x value of a point on line segment 1.
x0 < x1 < x2.
y0
The y value of a point on line segment 1.
x1
The x value for the intersection point between line segment 1 and line segment 2.
x0 < x1 < x2
y1
The y value for the intersection point between line segment 1 and line segment 2.
x2
The x value of a point on line segment 2.
x0 < x1 < x2
y2
The y value of a point on line segment 2.
radius
Specifies the radius around x1, y1 for which the TRIM function interpolates the slope. The radius has to be positive.
limit
Limits the radius relative to the shorter line-segment's length. This argument is optional and if it is not specified, a value of 0.5 is used.
0 < limit ≤ 1
The default value of limit when not specified is 0.5.

Example

TRIM(time, 0,0, 1,1, 2, 0, .1)