Skip to content

Main content

Point To Ray Projection Clamp Gap Tool

Calculate point to ray projection clamp gap from explicit caller-supplied inputs.

Loading tool…

Description

Project a point onto a ray with origin clamping.

A signed distance depends on a chosen normal or axis orientation. Projection parameters, perpendicular distances and reflected signs are different quantities; a nonunit direction introduces a scale into its parameter.

Project a point onto a ray with origin clamping.

When to use this tool

Use Point To Ray Projection Clamp Gap when checking a supplied projection, orientation or reflection convention.

How to use the tool and how it works

  1. Enter point, origin, direction. Keep parallel arrays aligned. 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 parameter, distance, behindOrigin. Inspect behindOrigin before interpreting the associated values.

Project a point onto a ray with origin clamping. Require aligned nonempty vectors and positive squared direction norm; clamp dot(point-origin,direction)/norm² at zero and compute the resulting point distance; behindOrigin tests the unclamped sign.1

Input fieldMeaning and unitsAccepted input
pointPointRequired. Array of finite number; maximum items 256.
originOriginRequired. Array of finite number; maximum items 256.
directionDirectionRequired. Array of finite number; maximum items 256.
Output fieldInterpretationReturned shape
parameterNonnegative coefficient multiplying direction; length only when direction has unit norm.Required. Finite number.
distanceDistanceRequired. Finite number.
behindOriginWhether the unclamped projection coefficient is strictly negative.Required. Boolean.
json
{
  "input": {
    "point": [
      3,
      4
    ],
    "origin": [
      0,
      0
    ],
    "direction": [
      1,
      0
    ]
  },
  "output": {
    "parameter": 3,
    "distance": 4,
    "behindOrigin": false
  }
}

Limitations and assumptions

  • The parameter is a distance only for unit direction; floating-point extremes can invalidate results.
  • 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

Use complete geometric objects and consistent units to compute actual distances, projections or multi-axis reflections.

References

  1. Calculation and input contract: distance/point-to-ray-projection-clamp-gap — tool.io

Similar or alternative tools