Catalog/geometry-lerp

Geometry

Linear interpolation API

Linear interpolation between two points/vectors of any equal dimension, with distance covered and remaining. Answers 'what is the point a fraction t of the way from A to B?'.

Price$0.01per request
MethodPOST
Route/v1/geometry/lerp
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
lerpinterpolationpointvectorblendanimation
API URLhttps://x402.hexl.dev/v1/geometry/lerp
Integration docs
Example request
{
  "a": [
    0,
    0
  ],
  "b": [
    10,
    0
  ],
  "t": 0.5
}
Example response
{
  "point": [
    5,
    0
  ],
  "t": 0.5,
  "totalDistance": 10,
  "distanceFromA": 5,
  "distanceToB": 5,
  "clampedT": 0.5
}
Input schema
{
  "type": "object",
  "required": [
    "a",
    "b",
    "t"
  ],
  "properties": {
    "a": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          0,
          0
        ]
      ]
    },
    "b": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          10,
          0
        ]
      ]
    },
    "t": {
      "type": "number",
      "examples": [
        0.5
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}