Catalog/geometry-line-circle-intersect

Geometry

Line-circle intersection API

Intersection of a 2D ray/line (point + direction) with a circle, returning 0/1/2 points and the discriminant. Answers 'where does this line cut the circle?', 'is it tangent?'.

Price$0.02per request
MethodPOST
Route/v1/geometry/line-circle-intersect
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
intersectionlinecircletangentdiscriminant2dgeometry
API URLhttps://x402.hexl.dev/v1/geometry/line-circle-intersect
Integration docs
Example request
{
  "point": [
    -2,
    0
  ],
  "direction": [
    1,
    0
  ],
  "center": [
    0,
    0
  ],
  "radius": 1
}
Example response
{
  "count": 2,
  "discriminant": 4,
  "points": [
    [
      -1,
      0
    ],
    [
      1,
      0
    ]
  ]
}
Input schema
{
  "type": "object",
  "required": [
    "point",
    "direction",
    "center",
    "radius"
  ],
  "properties": {
    "point": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          -2,
          0
        ]
      ]
    },
    "direction": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          1,
          0
        ]
      ]
    },
    "center": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          0,
          0
        ]
      ]
    },
    "radius": {
      "type": "number",
      "examples": [
        1
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}