Skip to content

Commit 70b6e62

Browse files
ryichandoclaude
andcommitted
Add BVH parallelization with Numba and mesh query infrastructure
- Refactor BVH module to use Numba JIT for parallel triangle/edge/point queries - Add new intersection, proximity, and distance detection modules - Add unit testing infrastructure with test runner (frontend/tests/) - Extend asset uploader to support UV coordinates (#x5 vertex format) - Simplify examples by removing redundant .direction() calls - Update .gitignore to allow frontend/tests/ directory - Integrate unit tests into Windows CI workflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent db7b66d commit 70b6e62

33 files changed

+5068
-297
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
target
2-
tests
2+
/tests
33
bin/
44
requirements.txt
55
.clangd

build-win-native/fast-check-all.bat

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ if not exist "%PYTHON%" (
7575
goto :error
7676
)
7777

78+
REM ============================================================
79+
REM Run Unit Tests (equivalent to warmup.py run_tests)
80+
REM ============================================================
81+
echo === Running Unit Tests ===
82+
echo.
83+
"%PYTHON%" -c "from frontend.tests._runner_ import run_all_tests; import sys; sys.exit(0 if run_all_tests() else 1)"
84+
if errorlevel 1 (
85+
echo.
86+
echo === UNIT TESTS FAILED ===
87+
goto :error
88+
)
89+
echo.
90+
echo === Unit Tests Passed ===
91+
echo.
92+
7893
echo === Fast Check All Examples ===
7994
echo Using: %EXAMPLES_TXT%
8095
echo.

examples/curtain.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
" obj = scene.add(\"sheet\")\n",
4747
" obj.param.set(\"strain-limit\", 0.05)\n",
4848
" obj.at(i * space, 0, 0)\n",
49-
" # set fiber directions for Baraff-Witkin\n",
50-
" obj.direction([0, 1, 0], [0, 0, 1])\n",
5149
" # pin top edge of each sheet\n",
5250
" obj.pin(obj.grab([0, 1, 0]))\n",
5351
"\n",

examples/drape.ipynb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@
5555
" # pin the corners\n",
5656
" obj.pin(corner)\n",
5757
"\n",
58-
" # set fiber directions required for Baraff-Witkin\n",
59-
" obj.direction([1, 0, 0], [0, 0, 1])\n",
60-
"\n",
6158
" # set the strainlimiting of 5%\n",
6259
" obj.param.set(\"strain-limit\", 0.05)\n",
6360
"\n",

examples/hang.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"scene = app.scene.create()\n",
3434
"\n",
3535
"# hang a sheet and pin top two corners\n",
36-
"sheet = scene.add(\"sheet\").direction([1, 0, 0], [0, 1, 0])\n",
36+
"sheet = scene.add(\"sheet\")\n",
3737
"sheet.pin(sheet.grab([-1, 1, 0]) + sheet.grab([1, 1, 0]))\n",
3838
"\n",
3939
"# set strain-limiting upper bound\n",

examples/headless.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
for i in range(5):
2020
obj = scene.add("sheet")
2121
obj.at(i * space, 0, 0)
22-
obj.direction([0, 1, 0], [0, 0, 1])
2322
obj.pin(obj.grab([0, 1, 0]))
2423
obj.param.set("strain-limit", 0.05)
2524

examples/needle.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"for i in range(n):\n",
5656
" y = (i + 1) * space\n",
5757
" deg = i * 90 / n\n",
58-
" obj = scene.add(\"sheet\").direction([1, 0, 0], [0, 1, 0])\n",
58+
" obj = scene.add(\"sheet\")\n",
5959
" obj.at(0, y, 0).rotate(90, \"x\").rotate(deg + 5 * random.random(), \"y\")\n",
6060
" obj.param.set(\"strain-limit\", 0.05).set(\"friction\", 0.5)\n",
6161
"\n",

examples/stack.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"for i in range(n):\n",
4545
" y = (i + 1) * space\n",
4646
" deg = i * 90 / n\n",
47-
" obj = scene.add(\"sheet\").direction([1, 0, 0], [0, 0, 1])\n",
47+
" obj = scene.add(\"sheet\")\n",
4848
" obj.at(0, y, 0).jitter().rotate(deg, \"y\")\n",
4949
" obj.param.set(\"strain-limit\", 0.05).set(\"bend\", 2.5).set(\"friction\", 0.5)\n",
5050
"\n",

examples/trampoline.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"scene = app.scene.create()\n",
3838
"\n",
3939
"# add sheet as trampoline with dynamic area coloring\n",
40-
"sheet = scene.add(\"sheet\").dyn_color(\"area\", 1.0).direction([1, 0, 0], [0, 0, 1])\n",
40+
"sheet = scene.add(\"sheet\").dyn_color(\"area\", 1.0)\n",
4141
"\n",
4242
"# pin the four edges of the sheet\n",
4343
"sheet.pin(sheet.grab([-1, 0, 0]) + sheet.grab([1, 0, 0]))\n",

frontend/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
"sdf",
4848
]
4949

50-
from ._app_ import App, get_cache_dir
50+
from . import _sdf_ as sdf
51+
from ._app_ import App
5152
from ._asset_ import AssetFetcher, AssetManager, AssetUploader
5253
from ._decoder_ import BlenderApp, ParamDecoder, SceneDecoder
5354
from ._extra_ import Extra
@@ -75,5 +76,4 @@
7576
SessionManager,
7677
SessionOutput,
7778
)
78-
from ._utils_ import Utils
79-
from . import _sdf_ as sdf
79+
from ._utils_ import Utils, get_cache_dir

0 commit comments

Comments
 (0)