From cacc394f91b288ed5e3cf01b8a2f53ad9186f11a Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH] Kernel rig: inspect cases, the centre of mass and volume of a box, of a box and cylinder, and an unknown body refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 36 +++++++++++++++++++ .../recipe.json | 32 +++++++++++++++++ .../cov-center-of-mass-box/expected.json | 22 ++++++++++++ .../cov-center-of-mass-box/recipe.json | 18 ++++++++++ .../expected.json | 8 +++++ .../recipe.json | 22 ++++++++++++ 6 files changed, 138 insertions(+) create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-box/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/expected.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/recipe.json diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json new file mode 100644 index 000000000..ba0e92e09 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json @@ -0,0 +1,36 @@ +{ + "sources": [], + "what": "the centre of mass of a box and a cylinder together", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin (V 24000 at (20,15,10)) and a cylinder r 5, h 10 on (60,0,0) (V 250 pi = 785.40 at (60,0,5)): the volume-weighted mean (21.2675, 14.5247, 9.8416), V = 24000 + 250 pi", + "results": [ + { + "command": 2, + "pointer": "/center", + "value": [ + 21.267517524987444, + 14.524680928129708, + 9.84156030937657 + ] + }, + { + "command": 2, + "pointer": "/volume", + "value": 24785.398163397447 + }, + { + "command": 2, + "pointer": "/bodies/1/center", + "value": [ + 60, + 0, + 5 + ] + }, + { + "command": 2, + "pointer": "/bodies/1/volume", + "value": 785.3981633974482 + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/recipe.json b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/recipe.json new file mode 100644 index 000000000..d5c90a511 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/recipe.json @@ -0,0 +1,32 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "solid.cylinder", + "params": { + "base": [ + 60, + 0, + 0 + ], + "radius": 5, + "height": 10, + "body_name": "Cyl", + "operation": "new" + } + }, + { + "command": "inspect.center_of_mass", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json new file mode 100644 index 000000000..a40b16dd7 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the centre of mass of a box", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin: the middle (20,15,10), V = 40 x 30 x 20 = 24000", + "results": [ + { + "command": 1, + "pointer": "/center", + "value": [ + 20, + 15, + 10 + ] + }, + { + "command": 1, + "pointer": "/volume", + "value": 24000.0 + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box/recipe.json b/tests/kernel-cases/inspect/cov-center-of-mass-box/recipe.json new file mode 100644 index 000000000..5116cf00a --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box/recipe.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "inspect.center_of_mass", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/expected.json new file mode 100644 index 000000000..58a27d57a --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "the centre of mass of a body that is not there", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin; no body `Nope`: refused", + "outcome": "refused", + "refusal": "no such bodies" +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/recipe.json b/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/recipe.json new file mode 100644 index 000000000..c05c6c794 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/recipe.json @@ -0,0 +1,22 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "inspect.center_of_mass", + "params": { + "bodies": [ + "Nope" + ] + } + } + ] +}