Skip to content

Main content

Monotone Linear Segment Direction Tool

Calculate monotone linear segment direction from explicit caller-supplied inputs.

Loading tool…

Description

Require leftX < rightX and return sign(rightY - leftY) as direction plus an exact flat flag.

Interpolation knots divide a coordinate range into intervals. Repeated nodes, unequal spacing, and exact boundary selection can change how a piecewise interpolant is interpreted.

Require leftX < rightX and return sign(rightY - leftY) as direction plus an exact flat flag.

When to use this tool

Use Monotone Linear Segment Direction when you need one knot-interval or multiplicity diagnostic.

How to use the tool and how it works

  1. Enter leftX, rightX, leftY, rightY. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read direction, flat. Inspect flat before interpreting the associated values.

Require leftX < rightX and return sign(rightY - leftY) as direction plus an exact flat flag.1

Input fieldMeaning and unitsAccepted input
leftXLeft XRequired. Finite number.
rightXRight XRequired. Finite number.
leftYLeft YRequired. Finite number.
rightYRight YRequired. Finite number.
Output fieldInterpretationReturned shape
directionDirectionRequired. Safe integer.
flatFlatRequired. Boolean.
json
{
  "input": {
    "leftX": 0,
    "rightX": 2,
    "leftY": 5,
    "rightY": 1
  },
  "output": {
    "direction": -1,
    "flat": false
  }
}

Limitations and assumptions

  • This reports one segment's direction, not the magnitude of its slope or monotonicity of a multi-segment curve.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Validate the complete knot sequence and interpolation method, including tolerance and extrapolation policies.

References

  1. Calculation and input contract: interpolation/monotone-linear-segment-direction — tool.io

Similar or alternative tools