Geometry
Ray-triangle intersection 3D API
Möller–Trumbore ray/triangle intersection in 3D, returning the hit point, distance t and barycentric coordinates. Answers 'does this ray hit the triangle, and where?'.
Price$0.03per request
MethodPOST
Route/v1/geometry/ray-triangle
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
intersectionraytrianglemoller-trumborebarycentric3draytracing
API URL
Integration docshttps://x402.hexl.dev/v1/geometry/ray-triangleExample request
{
"origin": [
0.25,
0.25,
-1
],
"direction": [
0,
0,
1
],
"v0": [
0,
0,
0
],
"v1": [
1,
0,
0
],
"v2": [
0,
1,
0
]
}Example response
{
"hit": true,
"t": 1,
"point": [
0.25,
0.25,
0
],
"barycentric": {
"u": 0.25,
"v": 0.25,
"w": 0.5
}
}Input schema
{
"type": "object",
"required": [
"origin",
"direction",
"v0",
"v1",
"v2"
],
"properties": {
"origin": {
"type": "array",
"items": {
"type": "number"
},
"examples": [
[
0.25,
0.25,
-1
]
]
},
"direction": {
"type": "array",
"items": {
"type": "number"
},
"examples": [
[
0,
0,
1
]
]
},
"v0": {
"type": "array",
"items": {
"type": "number"
},
"examples": [
[
0,
0,
0
]
]
},
"v1": {
"type": "array",
"items": {
"type": "number"
},
"examples": [
[
1,
0,
0
]
]
},
"v2": {
"type": "array",
"items": {
"type": "number"
},
"examples": [
[
0,
1,
0
]
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}