curl --request POST \
--url https://api.eddy.engineer/v1/sketch.solve \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"constraints": [
{
"kind": "horizontal",
"line": 0
},
{
"kind": "vertical",
"line": 1
},
{
"d": 3,
"kind": "distance",
"p": 0,
"q": 1
},
{
"d": 4,
"kind": "distance",
"p": 0,
"q": 2
}
],
"lines": [
{
"a": 0,
"b": 1
},
{
"a": 0,
"b": 2
},
{
"a": 1,
"b": 2
}
],
"points": [
{
"fixed": true,
"x": 0,
"y": 0
},
{
"x": 2.5,
"y": 0.3
},
{
"x": 0.4,
"y": 3
}
]
}
'import requests
url = "https://api.eddy.engineer/v1/sketch.solve"
payload = {
"constraints": [
{
"kind": "horizontal",
"line": 0
},
{
"kind": "vertical",
"line": 1
},
{
"d": 3,
"kind": "distance",
"p": 0,
"q": 1
},
{
"d": 4,
"kind": "distance",
"p": 0,
"q": 2
}
],
"lines": [
{
"a": 0,
"b": 1
},
{
"a": 0,
"b": 2
},
{
"a": 1,
"b": 2
}
],
"points": [
{
"fixed": True,
"x": 0,
"y": 0
},
{
"x": 2.5,
"y": 0.3
},
{
"x": 0.4,
"y": 3
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
constraints: [
{kind: 'horizontal', line: 0},
{kind: 'vertical', line: 1},
{d: 3, kind: 'distance', p: 0, q: 1},
{d: 4, kind: 'distance', p: 0, q: 2}
],
lines: [{a: 0, b: 1}, {a: 0, b: 2}, {a: 1, b: 2}],
points: [{fixed: true, x: 0, y: 0}, {x: 2.5, y: 0.3}, {x: 0.4, y: 3}]
})
};
fetch('https://api.eddy.engineer/v1/sketch.solve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eddy.engineer/v1/sketch.solve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'constraints' => [
[
'kind' => 'horizontal',
'line' => 0
],
[
'kind' => 'vertical',
'line' => 1
],
[
'd' => 3,
'kind' => 'distance',
'p' => 0,
'q' => 1
],
[
'd' => 4,
'kind' => 'distance',
'p' => 0,
'q' => 2
]
],
'lines' => [
[
'a' => 0,
'b' => 1
],
[
'a' => 0,
'b' => 2
],
[
'a' => 1,
'b' => 2
]
],
'points' => [
[
'fixed' => true,
'x' => 0,
'y' => 0
],
[
'x' => 2.5,
'y' => 0.3
],
[
'x' => 0.4,
'y' => 3
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eddy.engineer/v1/sketch.solve"
payload := strings.NewReader("{\n \"constraints\": [\n {\n \"kind\": \"horizontal\",\n \"line\": 0\n },\n {\n \"kind\": \"vertical\",\n \"line\": 1\n },\n {\n \"d\": 3,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 1\n },\n {\n \"d\": 4,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 2\n }\n ],\n \"lines\": [\n {\n \"a\": 0,\n \"b\": 1\n },\n {\n \"a\": 0,\n \"b\": 2\n },\n {\n \"a\": 1,\n \"b\": 2\n }\n ],\n \"points\": [\n {\n \"fixed\": true,\n \"x\": 0,\n \"y\": 0\n },\n {\n \"x\": 2.5,\n \"y\": 0.3\n },\n {\n \"x\": 0.4,\n \"y\": 3\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eddy.engineer/v1/sketch.solve")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"constraints\": [\n {\n \"kind\": \"horizontal\",\n \"line\": 0\n },\n {\n \"kind\": \"vertical\",\n \"line\": 1\n },\n {\n \"d\": 3,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 1\n },\n {\n \"d\": 4,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 2\n }\n ],\n \"lines\": [\n {\n \"a\": 0,\n \"b\": 1\n },\n {\n \"a\": 0,\n \"b\": 2\n },\n {\n \"a\": 1,\n \"b\": 2\n }\n ],\n \"points\": [\n {\n \"fixed\": true,\n \"x\": 0,\n \"y\": 0\n },\n {\n \"x\": 2.5,\n \"y\": 0.3\n },\n {\n \"x\": 0.4,\n \"y\": 3\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/sketch.solve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"constraints\": [\n {\n \"kind\": \"horizontal\",\n \"line\": 0\n },\n {\n \"kind\": \"vertical\",\n \"line\": 1\n },\n {\n \"d\": 3,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 1\n },\n {\n \"d\": 4,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 2\n }\n ],\n \"lines\": [\n {\n \"a\": 0,\n \"b\": 1\n },\n {\n \"a\": 0,\n \"b\": 2\n },\n {\n \"a\": 1,\n \"b\": 2\n }\n ],\n \"points\": [\n {\n \"fixed\": true,\n \"x\": 0,\n \"y\": 0\n },\n {\n \"x\": 2.5,\n \"y\": 0.3\n },\n {\n \"x\": 0.4,\n \"y\": 3\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}Solve a 2D sketch's constraints (C track C4)
A deterministic Levenberg-Marquardt constraint solver over point/line/circle/arc entities (C4.1 arcs own a radius variable with two intrinsic on-radius residuals; C20.1 adds a construction: true flag on lines/circles/arcs — reference geometry that solves but never reaches profile extraction). Constraints: coincident, horizontal, vertical, parallel, perpendicular, equal_length, equal_radius, point_on_line, distance, radius, angle, tangent, symmetric, arc_radius, tangent_arc, tangent_arc_arc, and (C20.1) concentric, midpoint, collinear, fix. Returns solved point coordinates + circle radii + arc radii, DOF accounting (variables - equations), and a status: fully_constrained / underconstrained / overconstrained (redundant-consistent, still solved) / inconsistent (conflicting, did not converge). Structurally invalid sketches (out-of-range indices) refuse 422 INVALID_SKETCH. Pure and bit-deterministic.
curl --request POST \
--url https://api.eddy.engineer/v1/sketch.solve \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"constraints": [
{
"kind": "horizontal",
"line": 0
},
{
"kind": "vertical",
"line": 1
},
{
"d": 3,
"kind": "distance",
"p": 0,
"q": 1
},
{
"d": 4,
"kind": "distance",
"p": 0,
"q": 2
}
],
"lines": [
{
"a": 0,
"b": 1
},
{
"a": 0,
"b": 2
},
{
"a": 1,
"b": 2
}
],
"points": [
{
"fixed": true,
"x": 0,
"y": 0
},
{
"x": 2.5,
"y": 0.3
},
{
"x": 0.4,
"y": 3
}
]
}
'import requests
url = "https://api.eddy.engineer/v1/sketch.solve"
payload = {
"constraints": [
{
"kind": "horizontal",
"line": 0
},
{
"kind": "vertical",
"line": 1
},
{
"d": 3,
"kind": "distance",
"p": 0,
"q": 1
},
{
"d": 4,
"kind": "distance",
"p": 0,
"q": 2
}
],
"lines": [
{
"a": 0,
"b": 1
},
{
"a": 0,
"b": 2
},
{
"a": 1,
"b": 2
}
],
"points": [
{
"fixed": True,
"x": 0,
"y": 0
},
{
"x": 2.5,
"y": 0.3
},
{
"x": 0.4,
"y": 3
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
constraints: [
{kind: 'horizontal', line: 0},
{kind: 'vertical', line: 1},
{d: 3, kind: 'distance', p: 0, q: 1},
{d: 4, kind: 'distance', p: 0, q: 2}
],
lines: [{a: 0, b: 1}, {a: 0, b: 2}, {a: 1, b: 2}],
points: [{fixed: true, x: 0, y: 0}, {x: 2.5, y: 0.3}, {x: 0.4, y: 3}]
})
};
fetch('https://api.eddy.engineer/v1/sketch.solve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eddy.engineer/v1/sketch.solve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'constraints' => [
[
'kind' => 'horizontal',
'line' => 0
],
[
'kind' => 'vertical',
'line' => 1
],
[
'd' => 3,
'kind' => 'distance',
'p' => 0,
'q' => 1
],
[
'd' => 4,
'kind' => 'distance',
'p' => 0,
'q' => 2
]
],
'lines' => [
[
'a' => 0,
'b' => 1
],
[
'a' => 0,
'b' => 2
],
[
'a' => 1,
'b' => 2
]
],
'points' => [
[
'fixed' => true,
'x' => 0,
'y' => 0
],
[
'x' => 2.5,
'y' => 0.3
],
[
'x' => 0.4,
'y' => 3
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eddy.engineer/v1/sketch.solve"
payload := strings.NewReader("{\n \"constraints\": [\n {\n \"kind\": \"horizontal\",\n \"line\": 0\n },\n {\n \"kind\": \"vertical\",\n \"line\": 1\n },\n {\n \"d\": 3,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 1\n },\n {\n \"d\": 4,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 2\n }\n ],\n \"lines\": [\n {\n \"a\": 0,\n \"b\": 1\n },\n {\n \"a\": 0,\n \"b\": 2\n },\n {\n \"a\": 1,\n \"b\": 2\n }\n ],\n \"points\": [\n {\n \"fixed\": true,\n \"x\": 0,\n \"y\": 0\n },\n {\n \"x\": 2.5,\n \"y\": 0.3\n },\n {\n \"x\": 0.4,\n \"y\": 3\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eddy.engineer/v1/sketch.solve")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"constraints\": [\n {\n \"kind\": \"horizontal\",\n \"line\": 0\n },\n {\n \"kind\": \"vertical\",\n \"line\": 1\n },\n {\n \"d\": 3,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 1\n },\n {\n \"d\": 4,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 2\n }\n ],\n \"lines\": [\n {\n \"a\": 0,\n \"b\": 1\n },\n {\n \"a\": 0,\n \"b\": 2\n },\n {\n \"a\": 1,\n \"b\": 2\n }\n ],\n \"points\": [\n {\n \"fixed\": true,\n \"x\": 0,\n \"y\": 0\n },\n {\n \"x\": 2.5,\n \"y\": 0.3\n },\n {\n \"x\": 0.4,\n \"y\": 3\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/sketch.solve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"constraints\": [\n {\n \"kind\": \"horizontal\",\n \"line\": 0\n },\n {\n \"kind\": \"vertical\",\n \"line\": 1\n },\n {\n \"d\": 3,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 1\n },\n {\n \"d\": 4,\n \"kind\": \"distance\",\n \"p\": 0,\n \"q\": 2\n }\n ],\n \"lines\": [\n {\n \"a\": 0,\n \"b\": 1\n },\n {\n \"a\": 0,\n \"b\": 2\n },\n {\n \"a\": 1,\n \"b\": 2\n }\n ],\n \"points\": [\n {\n \"fixed\": true,\n \"x\": 0,\n \"y\": 0\n },\n {\n \"x\": 2.5,\n \"y\": 0.3\n },\n {\n \"x\": 0.4,\n \"y\": 3\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}Body
Response
Solved coords + radii, dof, status, iterations, residual