Catalog/geometry-point-distance

Geometry

Point to line/segment/plane API

Distance from a point to an infinite line, a finite segment, or a 3D plane, with the closest point and (for planes) signed distance and side. Answers 'how far is this point from the segment?', 'which side of the plane is it on?'.

Price$0.02per request
MethodPOST
Route/v1/geometry/point-distance
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
distancepointlinesegmentplaneclosest-point2d3d
API URLhttps://x402.hexl.dev/v1/geometry/point-distance
Integration docs
Example request
{
  "target": "segment",
  "point": [
    0,
    2
  ],
  "a": [
    -1,
    0
  ],
  "b": [
    1,
    0
  ]
}
Example response
{
  "target": "segment",
  "distance": 2,
  "closestPoint": [
    0,
    0
  ],
  "t": 0.5
}
Input schema
{
  "type": "object",
  "required": [
    "point"
  ],
  "properties": {
    "target": {
      "type": "string",
      "enum": [
        "line",
        "segment",
        "plane"
      ],
      "examples": [
        "segment"
      ]
    },
    "point": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          0,
          2
        ]
      ]
    },
    "a": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          -1,
          0
        ]
      ]
    },
    "b": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          1,
          0
        ]
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}