Catalog/geometry-barycentric

Geometry

Barycentric coordinates API

Barycentric coordinates of a point in a 2D/3D triangle (and the inverse weights -> point), reporting whether the point is inside. Answers 'what are the barycentric weights of this point?', 'is it inside the triangle?'.

Price$0.02per request
MethodPOST
Route/v1/geometry/barycentric
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
barycentrictriangleinterpolationweightscontainment2d3d
API URLhttps://x402.hexl.dev/v1/geometry/barycentric
Integration docs
Example request
{
  "v0": [
    0,
    0
  ],
  "v1": [
    3,
    0
  ],
  "v2": [
    0,
    3
  ],
  "point": [
    1,
    1
  ]
}
Example response
{
  "weights": {
    "u": 0.333333333,
    "v": 0.333333333,
    "w": 0.333333333
  },
  "inside": true
}
Input schema
{
  "type": "object",
  "required": [
    "v0",
    "v1",
    "v2"
  ],
  "properties": {
    "v0": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          0,
          0
        ]
      ]
    },
    "v1": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          3,
          0
        ]
      ]
    },
    "v2": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          0,
          3
        ]
      ]
    },
    "point": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          1,
          1
        ]
      ]
    },
    "weights": {
      "type": "array",
      "items": {
        "type": "number"
      }
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}