Catalog/geometry-segment-intersect

Geometry

Segment-segment intersection API

Intersection of two finite 2D segments with parametric positions, handling collinear overlap and endpoint touches. Answers 'do these two segments cross, and where?'.

Price$0.02per request
MethodPOST
Route/v1/geometry/segment-intersect
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
intersectionsegment2dcollinearoverlapgeometry
API URLhttps://x402.hexl.dev/v1/geometry/segment-intersect
Integration docs
Example request
{
  "p1": [
    0,
    0
  ],
  "p2": [
    2,
    2
  ],
  "p3": [
    0,
    2
  ],
  "p4": [
    2,
    0
  ]
}
Example response
{
  "intersects": true,
  "point": [
    1,
    1
  ],
  "tOnSeg1": 0.5,
  "uOnSeg2": 0.5
}
Input schema
{
  "type": "object",
  "required": [
    "p1",
    "p2",
    "p3",
    "p4"
  ],
  "properties": {
    "p1": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          0,
          0
        ]
      ]
    },
    "p2": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          2,
          2
        ]
      ]
    },
    "p3": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          0,
          2
        ]
      ]
    },
    "p4": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          2,
          0
        ]
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}