Compare commits

...
Sign in to create a new pull request.
Author SHA1 Message Date
Erin Catto
1767150df4
Pull model task API (#228)
Port the pull model task API from Box2D.

https://github.com/erincatto/box2d/pull/1133

Addresses discussion #150
2026-11-17 16:42:52 -08:00
Erin Catto
8f3b2e12eb
Manifold allocation cap (#227)
Degenerate scenarios can lead to a huge number of manifolds per contact.
This creates memory and performance problems. So I'm capping them to 8
using cheap heuristics for culling.
2026-11-17 13:51:59 -08:00
Erin Catto
be8c731890
fix unit test that was timing dependent (#217) 2026-11-13 14:38:24 -08:00
Erin Catto
a8ac09f364
More static queries (#216)
- and a data race fix for it
- compare mesh versus heightfield
2026-11-11 17:41:42 -08:00
Erin Catto
5d6364d731
Static query (#214)
Add b3World_OverlapAABB_Static workaround. Not recommended.
Fixed a left over ghost collision
2026-11-10 23:05:04 -08:00
Erin Catto
38f2ae1e19
Reduce ghosts (#212)
Full ghost collision handling for sphere, capsule, and hull versus a
single mesh or heightfield. This requires mesh to be built with edge
identification.

Optimized mesh builder.

Removed B3_MAX_MESH_CONTACT_TRIANGLES. You will still hit performance
problems for dense meshes. Fixes #184
2026-11-10 21:53:10 -08:00
Erin Catto
3362633204
Dynamic Mover (#202)
Port the dynamic character mover from Box2D including the mover joint
and pogo joint.

Match the mover and sample structure of Box2D.
2026-10-27 22:33:17 -07:00
Erin Catto
f36d061ba2
CMake improvements (#201)
- Update CMake to parity with Box2D. Removed BOX3D_AVX2 due to runtime
dispatch.
- CI fixes for ubuntu
- Doxygen refresh from Box2D
2026-10-20 15:15:20 -07:00
Erin Catto
efca0c184d
Gyro tolerance (#191) 2026-10-15 23:30:56 -07:00
Erin Catto
0cfc475b88
Solver stuff (#189) 2026-10-14 22:20:52 -07:00
Erin Catto
8128d7405e
Discussion template (#185) 2026-10-13 11:02:43 -07:00
Erin Catto
a2e4816b43
Fixes for #175 (#187)
See #175 

It is LLM so verbose and lacking context, but it did find a couple
things worth fixing.
2026-10-12 21:46:51 -07:00
Erin Catto
5d83df83ab
Improve compound serialization (#183)
- no more pointer fixups
- reduced storage 20% by removing leaf proxies
2026-10-07 14:48:58 -07:00
Erin Catto
3d9db79ee1
various recording fixes (#182) 2026-10-06 22:45:33 -07:00
Erin Catto
003a3f7728
Fix recording crash on compounds (#181) 2026-10-06 17:33:29 -07:00
Erin Catto
f8c4fe83df
Shape cast support for box movers (#180)
Co-authored-by: ζeh Matt <5415177+ZehMatt@users.noreply.github.com>
2026-10-06 16:43:20 -07:00
Erin Catto
16f7f4cf4c
Tree perf (#179)
- Optimizations for falling trees.
- Increased B3_MAX_MESH_CONTACT_TRIANGLES  from 256 to 512.
2026-10-06 09:51:48 -07:00
Ethan Rutherford
e77352cd60
Add support for AVX2 and runtime feature detection (#174)
- [x] run unit tests
- [x] run all samples
2026-10-03 15:14:34 -07:00
Erin Catto
51f056e0a9
SAT benchmark (#177) 2026-10-02 20:47:05 -07:00
Erin Catto
9f998c862d
SAT samples (#173) 2026-09-27 14:39:11 -07:00
Erin Catto
5643cd81ff
Remove compound mesh child material limit. (#172) 2026-09-25 14:56:44 -07:00
Erin Catto
adec25b301
SAT optimizations (#170)
Use hull inner spheres to speed up SAT, especially for complex hulls.
2026-09-24 21:16:19 -07:00
Erin Catto
8fda30e5a2
Update UI (#169)
Port Box2D UI update
2026-09-24 13:43:40 -07:00
Erin Catto
79fc55976a
Optimizations (#168)
- Optimize contact prepare
- Back to post restitution stage
- Optimize solver math
- Bug fixes
2026-09-24 12:21:17 -07:00
Erin Catto
9e5a4cde86
Optimizations (#161)
- cache body sim indices and split out fat aabb
- deferred restitution
- the manifold point normal velocity is only computed for restitution or
hit events, otherwise it is zero
2026-09-20 15:54:52 -07:00
Erin Catto
f555ee4208
Optimize Broad-Phase (#159)
Broad-phase optimization ported from Box2D.
2026-09-16 22:28:39 -07:00
Erin Catto
954cf879e7
Fixes (#157)
- Added b3BodyDef::safetyFactor for CCD tuning
- #155
- #153
- #148 
- #149
2026-09-16 15:46:31 -07:00
Erin Catto
47d7f7cc7e
clockwise option, joint is awake (#130)
- b3MeshDef gets stride and clockwise option
- Added b3Joint_IsAwake
- Added b3Body_TimeOfImpactMover
- #116
- Smoother mover collision: #141
- Shape casts now ignore backside collision on mesh and height-field
triangles, same as ray casts.
2026-08-29 21:47:53 -07:00
Erin Catto
30c67b5e6d
Fixed the 64-bit hash function and added unit test (#129)
The 64-bit hash function was not well tested and had a bad optimization.
Switched to using rapidhash: https://github.com/Nicoshev/rapidhash
2026-08-12 17:13:26 -07:00
Erin Catto
f42be210a2
64-bit hashes (#126)
- ContactEvent sample
- Improved shadows
- #120 
- Triangle collision fixes
2026-08-11 18:08:34 -07:00
Erin Catto
3fc20f5b45
Follow cam (#107)
- follow cam in replay viewer
- world text with halo
- fixed sensor crash
- sensor visitors must now be convex
2026-07-29 22:14:26 -07:00
Erin Catto
781673be80
Fixes 09 (#104)
- #86
- #88 
- #87 
- #89
2026-07-24 21:48:23 -07:00
Erin Catto
c52908c9a9
Fixes 08 (#98)
- fix hull builder face and edge leak
- fix #95
- samples app will no longer crash if data folder is not found
2026-07-22 15:55:02 -07:00
Erin Catto
23861418d8
Fixes 07 (#97)
#84 
#82 
Added B3_RESTITUTION_ITERATIONS to override restitution iterations.
Fix regression in hull stacking stability.
2026-07-20 22:05:11 -07:00
Erin Catto
dfa5e6add0
Fixing issues (#94)
- option to draw kinematic shapes with transparency
- slight change to triangle vs hull to reduce ghost collisions
- changed return of b3DebugDraw.DrawShapeFcn to void
#66 
#48 
#69 
#75 
#76
2026-07-19 21:43:43 -07:00
Erin Catto
c37cfe4cd7
SIMD hull collision (#93)
SIMD based hull collision inspired by example code from @cairnc in #54 

<img width="1676" height="1332" alt="image"
src="https://github.com/user-attachments/assets/58b137bd-bf7b-4c99-863c-64341b973a3d"
/>

- Fixed #78
- Fixed #85 and fixed CI to error on UB.
- Updated benchmarks
- Added AMD scalar benchmarks
- Added Neon benchmarks
- More determinism unit tests
- Sample leak detection
- Added b3Body_AllowFastRotation
- Added b3Body_IsFastRotationAllowed
- Bumped b3HullData version
- Bumped b3CompoundData version
2026-07-18 22:43:03 -07:00
Erin Catto
d421e45c82
Update benchmarks (#77)
The large pyramid got larger, not slower.

Renamed b3CreateCompound to b3CreateBakedCompound and added some
comments. There is confusion between run-time compounds and baked
compounds.
2026-07-12 22:49:25 -07:00
Erin Catto
e961bfb7bf
Friction center weighted average (#71)
The central friction anchors now have C0 continuity by using a weighted
average. Reduces jitter while letting the spinning top function
correctly.

Fixes #65
2026-07-11 23:26:31 -07:00
Erin Catto
e9f6f1d0aa
Add benchmark (#67)
Added benchmark from PEEL.
Implement #60
2026-07-10 23:21:37 -07:00
Erin Catto
aaa795e34f
Edge edge optimization (#63)
From #54
2026-07-10 16:14:53 -07:00
Erin Catto
ef8ef0187a
Ghost collision improvements (#61)
- flag to disable hull-mesh speculative collision
- faster atomics #55 
- fix triangle vs hull logic
- fix #58 and #59
- improved shadows in samples app, a bit more expensive
2026-07-08 23:53:06 -07:00
Erin Catto
52f1a254ad
Name cache (#53)
Removed B3_BODY_NAME_LENGTH and B3_SHAPE_NAME_LENGTH.
Now using a name cache instead to save memory and make recordings more
universal.
This is a recording version bump.
2026-07-06 17:33:45 -07:00
Erin Catto
540ea387b0
Draw sleep velocity (#49)
- draw sleep velocity for debugging
- added back shape names with B3_SHAPE_NAME_LENGTH
- zup command line option
2026-07-05 00:33:00 -07:00
Erin Catto
0f6fdad541
Set mass data consistent velocity (#45)
- Rename b3Body_GetWorldCenterOfMass to b3Body_GetWorldCenter.
- Rename b3Body_GetLocalCenterOfMass to b3Body_GetLocalCenter.
- Fixed b3Body_SetMassData to correct velocity when local center moves.
2026-07-04 11:22:29 -07:00
Erin Catto
1bec63c9ee
Draw distance slider (#44)
Helps render performance on integrated GPUs.
Added render culling for baked compounds.
2026-07-03 20:26:19 -07:00
Erin Catto
655799893a
Fixes 03 (#40)
Fixes #33, #34, #35, #37, #39, #41, #42, #43

Also fixes b3Body_SetMassData inertia tensor.
2026-07-03 17:15:03 -07:00
Erin Catto
29bf523ce7
Fixes 02 (#31)
Fixes for #29 and #30
2026-07-02 00:34:04 -07:00
Erin Catto
1c5ac42c37
Fixes 01 (#26)
Fix #25 
Fix replay mover colors
Update README
Added unit test for CCD move events
Avoid Linux crash when OpenGL 4.5 is not present
2026-07-01 23:19:23 -07:00
316 changed files with 91942 additions and 26504 deletions

View file

@ -12,7 +12,7 @@ BraceWrapping:
AfterUnion: true
BeforeWhile: true
ColumnLimit: 130
ColumnLimit: 120
PointerAlignment: Left
UseTab: Always
BreakConstructorInitializers: BeforeComma
@ -23,6 +23,8 @@ IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"(box3d\/)'
Priority: 2
- Regex: '^<ImGuizmo'
Priority: 4
- Regex: '^<.*'
Priority: 3
- Regex: '^".*'

5
.editorconfig Normal file
View file

@ -0,0 +1,5 @@
root = true
[*.{c,h,cpp,inl}]
guidelines = 120
guidelines_style = 1px dotted gray

1
.github/CODEOWNERS vendored Normal file
View file

@ -0,0 +1 @@
* @erincatto

28
.github/DISCUSSION_TEMPLATE/general.yml vendored Normal file
View file

@ -0,0 +1,28 @@
body:
- type: markdown
attributes:
value: |
Discussions are for people talking with people. Posts written by an LLM may be closed without a reply.
Avoid posting links to LLM generated text. For quick help, try the [Box2D discord](https://discord.gg/NKYgCBP).
- type: input
id: version
attributes:
label: Box3D version
description: Commit hash or release you are using.
placeholder: e.g. 5d83df8
validations:
required: true
- type: textarea
id: topic
attributes:
label: What would you like to discuss?
description: In your own words. Short is fine.
validations:
required: true
- type: checkboxes
id: human
attributes:
label: Authorship
options:
- label: I wrote this post myself, not an LLM.
required: true

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Box2D discord
url: https://discord.gg/NKYgCBP
about: Ask for help here first.

16
.github/ISSUE_TEMPLATE/issue.md vendored Normal file
View file

@ -0,0 +1,16 @@
---
name: Bug report or feature request
about: Please check these boxes before submitting
---
Make sure these boxes are checked before submitting your issue - thank you!
- [ ] Ask for help on [discord](https://discord.gg/NKYgCBP)
- [ ] Consider providing a recording.
- [ ] Bug reports by LLMs are welcome.
- [ ] Feature requests and enhancements must come from humans.
Use these to create a recording.
```c
b3CreateRecording, b3World_StartRecording, b3World_StopRecording, b3SaveRecordingToFile
```

View file

@ -1 +0,0 @@
Thank you for filing an issue!

View file

@ -1 +1,2 @@
Pull requests for Box3D code are not accepted. Please consider filing an issue instead.
- [ ] run unit tests
- [ ] run all samples

View file

@ -1,5 +1,5 @@
# https://docs.github.com/en/actions
name: CI Build
name: build_test
on:
push:
@ -15,7 +15,7 @@ jobs:
test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ matrix.timeout || 4 }}
timeout-minutes: ${{ matrix.timeout || 10 }}
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
strategy:
fail-fast: false
@ -24,15 +24,18 @@ jobs:
- name: ubuntu-gcc
os: ubuntu-latest
test: ./bin/test
# Clang jobs pin the image because each Ubuntu image ships a different set of clang versions
- name: ubuntu-clang
os: ubuntu-latest
args: '-DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread"'
os: ubuntu-26.04
args: '-DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_C_COMPILER=clang-20 -DCMAKE_C_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread"'
test: ./bin/test
# Runner speed varies about 3x by region and MSan at -O0 can exceed the timeout on the slow ones.
# -O1 is the level MSan recommends and Debug keeps asserts. Line buffering shows per test timing.
- name: ubuntu-clang-msan
os: ubuntu-latest
os: ubuntu-26.04
timeout: 10
args: '-DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=memory"'
test: ./bin/test
args: '-DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_C_COMPILER=clang-20 -DCMAKE_C_FLAGS="-O1 -fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-O1 -fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=memory"'
test: lscpu | grep 'Model name'; nproc; stdbuf -oL ./bin/test
msan-options: abort_on_error=1:halt_on_error=1
- name: macos
os: macos-latest
@ -43,7 +46,6 @@ jobs:
msvc: true
args: -DBOX3D_SANITIZE=ON
test: ./bin/Debug/test
# Box3D is width-4 SIMD only, so this covers the clang-cl toolchain, not AVX2.
- name: windows-clang-cl
os: windows-latest
msvc: true
@ -51,8 +53,21 @@ jobs:
test: ./bin/Debug/test
- name: windows-arm64
os: windows-11-arm
msvc: true
msvc-arch: arm64
args: -A arm64 -DBOX3D_DISABLE_SIMD=TRUE -DBOX3D_SANITIZE=ON
test: ./bin/Debug/test
# Optimized runs. The determinism golden hashes are otherwise only checked at -O0,
# and -O2 is where a value changing float transform would first show up.
- name: windows-relwithdebinfo
os: windows-latest
msvc: true
config: RelWithDebInfo
test: ./bin/RelWithDebInfo/test
- name: macos-relwithdebinfo
os: macos-latest
config: RelWithDebInfo
test: ./bin/test
- name: ubuntu-gcc-double
os: ubuntu-latest
args: -DBOX3D_DOUBLE_PRECISION=ON
@ -69,25 +84,29 @@ jobs:
if: ${{ matrix.msvc }}
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
arch: ${{ matrix['msvc-arch'] || 'x64' }}
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON ${{ matrix.args }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.config || env.BUILD_TYPE }} -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON ${{ matrix.args }}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build ${{github.workspace}}/build --config ${{ matrix.config || env.BUILD_TYPE }} --parallel
- name: Test
working-directory: ${{github.workspace}}/build
env:
MSAN_OPTIONS: ${{ matrix['msan-options'] || '' }}
UBSAN_OPTIONS: print_stacktrace=1
run: ${{ matrix.test }}
# mingw needs some extra setup so keeping it separate from the matrix.
# Debug -O0 copies whole structs and hid the b3SurfaceMaterial padding dedup bug.
# RelWithDebInfo tests -O2 codegen while B3_ENABLE_ASSERT keeps asserts alive,
# heavy validation stays Debug only.
build-windows-mingw:
name: windows-mingw
runs-on: windows-latest
timeout-minutes: 4
timeout-minutes: 10
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
defaults:
run:
@ -106,19 +125,37 @@ jobs:
mingw-w64-ucrt-x86_64-ninja
- name: Configure CMake
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build build --config ${{env.BUILD_TYPE}}
run: cmake --build build --config RelWithDebInfo --parallel
- name: Test
working-directory: build
run: ./bin/test
# Build-only: running the wasm test needs a node + pthread/SharedArrayBuffer harness.
# This still catches compile breaks in the box3d library and the test target.
emscripten:
name: emscripten
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v6
- uses: mymindstorm/setup-emsdk@v14
- name: Configure CMake
run: emcmake cmake -B build -DCMAKE_BUILD_TYPE=Debug -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON
- name: Build
run: cmake --build build --config Debug --parallel
samples:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 8
timeout-minutes: 10
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
strategy:
fail-fast: false
@ -164,4 +201,4 @@ jobs:
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBOX3D_SAMPLES=ON -DBOX3D_UNIT_TESTS=OFF ${{ matrix.args }}
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release
run: cmake --build ${{github.workspace}}/build --config Release --parallel

3
.gitignore vendored
View file

@ -8,8 +8,7 @@ settings.ini
CMakeUserPresets.json
.cache/
.idea/
.claude/
.tmp/
.fetchcontent-cache/
build-dp/
*.b3rec
*.zip

View file

@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.22)
include(CMakeDependentOption)
project(box3d
VERSION 0.1.0
@ -8,13 +7,6 @@ project(box3d
LANGUAGES C CXX
)
# sokol's Metal backend is Objective-C; samples/host/sokol_app_impl.c and
# samples/gfx/sokol_impl.c compile as OBJC on Apple. Enable the language here
# so those source properties are honored.
if(APPLE)
enable_language(OBJC)
endif()
# stuff to help debug cmake
# message(STATUS "cmake tool chain: ${CMAKE_TOOLCHAIN_FILE}")
# message(STATUS "cmake source dir: ${CMAKE_SOURCE_DIR}")
@ -25,7 +17,7 @@ message(STATUS "CMake system name: ${CMAKE_SYSTEM_NAME}")
message(STATUS "CMake host system processor: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
# static link to make leak checking easier (_crtBreakAlloc)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
if (MSVC OR APPLE OR UNIX)
option(BOX3D_SANITIZE "Enable sanitizers for some builds" OFF)
@ -41,15 +33,16 @@ if (MSVC OR APPLE OR UNIX)
add_link_options("$<$<CONFIG:Debug>:/INCREMENTAL:NO>")
elseif(APPLE)
# more sanitizers on Apple clang
# UBSan recovers by default, no-recover makes the first report fatal so CI fails
if(BOX3D_SANITIZER_TYPE STREQUAL "thread")
add_compile_options(-fsanitize=thread -fno-omit-frame-pointer)
add_link_options(-fsanitize=thread)
elseif(BOX3D_SANITIZER_TYPE STREQUAL "undefined")
add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
add_compile_options(-fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer)
add_link_options(-fsanitize=undefined)
else()
# default to address sanitizer
add_compile_options(-fsanitize=address -fsanitize-address-use-after-scope -fsanitize=undefined)
add_compile_options(-fsanitize=address -fsanitize-address-use-after-scope -fsanitize=undefined -fno-sanitize-recover=all)
add_link_options(-fsanitize=address -fsanitize-address-use-after-scope -fsanitize=undefined)
endif()
elseif(UNIX)
@ -60,19 +53,19 @@ if (MSVC OR APPLE OR UNIX)
add_compile_options(-fsanitize=thread -fno-omit-frame-pointer -fPIE)
add_link_options(-fsanitize=thread -pie)
elseif(BOX3D_SANITIZER_TYPE STREQUAL "undefined")
add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
add_compile_options(-fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer)
add_link_options(-fsanitize=undefined)
elseif(BOX3D_SANITIZER_TYPE STREQUAL "memory")
add_compile_options(-fsanitize=memory -fno-omit-frame-pointer)
add_link_options(-fsanitize=memory)
else()
# default to address sanitizer
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
add_link_options(-fsanitize=address)
add_compile_options(-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer)
add_link_options(-fsanitize=address -fsanitize=undefined)
endif()
endif()
else()
if(MSVC)
if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND PROJECT_IS_TOP_LEVEL)
# enable hot reloading
add_compile_options("$<$<CONFIG:Debug>:/ZI>")
add_link_options("$<$<CONFIG:Debug>:/INCREMENTAL>")
@ -82,27 +75,71 @@ endif()
# Deterministic math
# https://box2d.org/posts/2024/08/determinism/
if (MINGW OR APPLE OR UNIX)
add_compile_options(-ffp-contract=off)
# Contraction into FMA is the one value changing transform enabled by default, and whether
# it fires depends on the target. Test the compiler, not the platform, so every gcc and
# clang gets the flag including a clang that is neither MinGW nor clang-cl.
if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
if (CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
# clang-cl defaults to contraction on and silently drops the GNU spelling
add_compile_options(/clang:-ffp-contract=off)
else()
add_compile_options(-ffp-contract=off)
endif()
endif()
option(BOX3D_DISABLE_SIMD "Disable SIMD math (slower)" OFF)
option(BOX3D_COMPILE_WARNING_AS_ERROR "Compile warnings as errors" OFF)
option(BOX3D_DOUBLE_PRECISION "Enable double precision for large worlds" OFF)
# core.h selects the SIMD path from these definitions, so the unit tests and the SAT
# benchmark, which include the src headers, must compile with the same definitions and
# instruction set flags as the library. Selected once here for all of them.
set(BOX3D_SIMD_DEFINITIONS "")
set(BOX3D_SIMD_OPTIONS "")
if (BOX3D_DISABLE_SIMD)
message(STATUS "Box3D SIMD disabled")
set(BOX3D_SIMD_DEFINITIONS BOX3D_DISABLE_SIMD)
elseif (EMSCRIPTEN)
# core.h maps wasm onto the SSE2 path, the intrinsics only compile with simd128 enabled
set(BOX3D_SIMD_OPTIONS -msimd128 -msse2)
endif()
# These are read by the library build, so they must precede add_subdirectory(src),
# otherwise the first configure and a re-configure produce different libraries.
# Top level only, so they stay hidden from FetchContent consumers.
if(PROJECT_IS_TOP_LEVEL)
option(BOX3D_PROFILE "Enable profiling with Tracy" OFF)
option(BOX3D_VALIDATE "Enable heavy validation" ON)
endif()
# Emscripten pthread support. Must precede add_subdirectory(src) so the box3d library
# objects are built with the same atomics/bulk-memory features as the executables that
# link them, otherwise wasm-ld rejects --shared-memory. Top level only, so a FetchContent
# consumer keeps control of its own threading model.
if (EMSCRIPTEN AND PROJECT_IS_TOP_LEVEL)
set(EMSCRIPTEN_PTHREADS_COMPILER_FLAGS "-pthread -s USE_PTHREADS=1")
set(EMSCRIPTEN_PTHREADS_LINKER_FLAGS "${EMSCRIPTEN_PTHREADS_COMPILER_FLAGS} -s ALLOW_MEMORY_GROWTH")
string(APPEND CMAKE_C_FLAGS " ${EMSCRIPTEN_PTHREADS_COMPILER_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${EMSCRIPTEN_PTHREADS_COMPILER_FLAGS}")
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${EMSCRIPTEN_PTHREADS_LINKER_FLAGS}")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
# Leaving this here for testing
# set(CMAKE_VERBOSE_MAKEFILE ON)
# Needed for samples.exe to find box2d.dll
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
if(PROJECT_IS_TOP_LEVEL)
# Needed for samples.exe to find box3d.dll
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
# Collect FetchContent downloads outside the build dir so a clean rebuild reuses them.
# Must precede the first include(FetchContent)
if(NOT FETCHCONTENT_BASE_DIR)
set(FETCHCONTENT_BASE_DIR "${CMAKE_SOURCE_DIR}/.fetchcontent-cache"
CACHE PATH "Shared FetchContent populate cache")
# Collect FetchContent downloads outside the build dir so a clean rebuild reuses them.
# Must precede the first include(FetchContent)
if(NOT FETCHCONTENT_BASE_DIR)
set(FETCHCONTENT_BASE_DIR "${CMAKE_SOURCE_DIR}/.fetchcontent-cache"
CACHE PATH "Shared FetchContent populate cache")
endif()
endif()
include(FetchContent)
@ -114,8 +151,6 @@ if(PROJECT_IS_TOP_LEVEL)
option(BOX3D_SAMPLES "Build the Box3D samples" ON)
option(BOX3D_BENCHMARKS "Build the Box3D benchmarks" OFF)
option(BOX3D_DOCS "Build the Box3D documentation" OFF)
option(BOX3D_PROFILE "Enable profiling with Tracy" OFF)
option(BOX3D_VALIDATE "Enable heavy validation" ON)
option(BOX3D_UNIT_TESTS "Build the Box3D unit tests" ON)
# Enable this for shader development using sokol-shdc.
@ -123,16 +158,6 @@ if(PROJECT_IS_TOP_LEVEL)
option(BOX3D_BUILD_SHADERS "Recompile shaders with sokol-shdc" OFF)
if(BOX3D_UNIT_TESTS OR BOX3D_SAMPLES OR BOX3D_BENCHMARKS)
# Emscripten pthread support
if(EMSCRIPTEN)
set(EMSCRIPTEN_PTHREADS_COMPILER_FLAGS "-pthread -s USE_PTHREADS=1")
set(EMSCRIPTEN_PTHREADS_LINKER_FLAGS "${EMSCRIPTEN_PTHREADS_COMPILER_FLAGS} -s ALLOW_MEMORY_GROWTH")
string(APPEND CMAKE_C_FLAGS " ${EMSCRIPTEN_PTHREADS_COMPILER_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${EMSCRIPTEN_PTHREADS_COMPILER_FLAGS}")
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${EMSCRIPTEN_PTHREADS_LINKER_FLAGS}")
endif()
add_subdirectory(shared)
endif()
@ -141,7 +166,7 @@ if(PROJECT_IS_TOP_LEVEL)
message(STATUS "Adding Box3D unit tests")
add_subdirectory(test)
set_target_properties(test PROPERTIES XCODE_GENERATE_SCHEME TRUE)
else()
elseif(BOX3D_UNIT_TESTS)
message(STATUS "Skipping Box3D unit tests")
endif()
@ -154,9 +179,11 @@ if(PROJECT_IS_TOP_LEVEL)
set_property(TARGET samples PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
endif()
if(APPLE)
set_target_properties(samples PROPERTIES
XCODE_GENERATE_SCHEME TRUE
XCODE_SCHEME_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
endif()
endif()
if(BOX3D_BENCHMARKS)
@ -171,4 +198,4 @@ endif()
# https://stackoverflow.com/questions/72635402/how-to-set-working-directory-in-cmake-visual-studio-2022
# launch.vs.json
# "currentDir": "${workspaceRoot}"
# "currentDir": "${workspaceRoot}"

View file

@ -28,6 +28,68 @@
"generator": "Xcode",
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" },
"binaryDir": "${sourceDir}/build"
},
{
"name": "mingw-debug",
"displayName": "Windows MinGW Debug (Ninja, needs gcc on PATH)",
"generator": "Ninja",
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" },
"binaryDir": "${sourceDir}/build/mingw",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"FETCHCONTENT_BASE_DIR": "${sourceDir}/.fetchcontent-cache/mingw"
}
},
{
"name": "mingw-release",
"displayName": "Windows MinGW Release (Ninja, needs gcc on PATH)",
"generator": "Ninja",
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" },
"binaryDir": "${sourceDir}/build/mingw",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"FETCHCONTENT_BASE_DIR": "${sourceDir}/.fetchcontent-cache/mingw"
}
},
{
"name": "windows-clang-cl",
"displayName": "Windows clang-cl (Visual Studio solution, ClangCL toolset)",
"toolset": "ClangCL",
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" },
"binaryDir": "${sourceDir}/build/clang-cl-vs",
"cacheVariables": {
"FETCHCONTENT_BASE_DIR": "${sourceDir}/.fetchcontent-cache/clang-cl-vs"
}
},
{
"name": "clang-cl-debug",
"displayName": "Windows clang-cl Debug (Ninja, needs LLVM on PATH)",
"generator": "Ninja",
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" },
"binaryDir": "${sourceDir}/build/clang-cl",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "clang-cl",
"CMAKE_CXX_COMPILER": "clang-cl",
"FETCHCONTENT_BASE_DIR": "${sourceDir}/.fetchcontent-cache/clang-cl"
}
},
{
"name": "clang-cl-release",
"displayName": "Windows clang-cl Release (Ninja, needs LLVM on PATH)",
"generator": "Ninja",
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" },
"binaryDir": "${sourceDir}/build/clang-cl",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "clang-cl",
"CMAKE_CXX_COMPILER": "clang-cl",
"FETCHCONTENT_BASE_DIR": "${sourceDir}/.fetchcontent-cache/clang-cl"
}
}
],
"buildPresets": [
@ -36,6 +98,12 @@
{ "name": "linux-debug", "configurePreset": "linux-debug" },
{ "name": "linux-release", "configurePreset": "linux-release" },
{ "name": "macos-debug", "configurePreset": "macos", "configuration": "Debug" },
{ "name": "macos-release", "configurePreset": "macos", "configuration": "Release" }
{ "name": "macos-release", "configurePreset": "macos", "configuration": "Release" },
{ "name": "mingw-debug", "configurePreset": "mingw-debug" },
{ "name": "mingw-release", "configurePreset": "mingw-release" },
{ "name": "windows-clang-cl-debug", "configurePreset": "windows-clang-cl", "configuration": "Debug" },
{ "name": "windows-clang-cl-release", "configurePreset": "windows-clang-cl", "configuration": "Release" },
{ "name": "clang-cl-debug", "configurePreset": "clang-cl-debug" },
{ "name": "clang-cl-release", "configurePreset": "clang-cl-release" }
]
}

108
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,108 @@
# Contributing to Box3D
This project is open source under the [MIT License](LICENSE). Please read this document
before opening a pull request — **PRs that skip these steps will be closed.**
---
## TL;DR
1. **Discuss first.** Open an issue (or a [Discussion](../../discussions)) and
wait for it to be labeled `ready-for-pr` before writing code.
2. **Sign the CLA.** A bot will prompt you on your first PR. One signature
covers all future contributions.
3. **Link the issue.** Put `Closes #123` in your PR description. A required
check enforces this.
4. **Follow the style.** C17, no compiler warnings, formatted with
`clang-format`.
5. **Comments** Comment your code with human words. Create Doxygen comments for public APIs.
6. **Follow the LLM guidelines.** See the LLM guidelines in README.md
---
## 1. Discuss before you build
Open an issue or discussion before creating a PR.
I will review the issue or discussion and apply the **`ready-for-pr`** label. Please don't open
a PR until you get the label.
Please wait follow this process. I don't want people wasting time writing a PR that won't be accepted.
---
## 2. Contributor License Agreement (CLA)
Before your first contribution can be merged, you must sign the project's
**Individual Contributor License Agreement**. When you open your first pull
request, a bot will post a link; signing takes about a minute and covers all
your future contributions.
**What this means:** you retain the copyright to your contribution. The CLA
grants the project maintainer a broad, perpetual, irrevocable license to use,
modify, sublicense, and **relicense** your contribution. This lets the project
adapt its licensing in the future (for example, offering a commercial edition)
without having to track down every past contributor.
If you're contributing on behalf of an employer, make sure you have the right
to do so — some employment agreements assign your work to your employer, in
which case a Corporate CLA may be required. Contact the maintainer if you're
unsure.
By submitting a contribution you also confirm that it is your original work and
that you have the right to submit it under these terms.
---
## 3. Opening a pull request
Once your issue is labeled `ready-for-pr`:
1. **Fork** the repository and create a branch from `main`:
```bash
git checkout -b fix/short-description
```
2. Make your change in small, focused commits.
3. **Reference the issue** in your PR description using a closing keyword:
```text
Closes #(Issue Number)
```
A required status check parses this and will fail if no linked, approved
issue is found — the PR cannot be merged without it.
4. Ensure the full test suite and CI pass.
5. Fill out the PR template completely.
Keep PRs scoped to a single logical change. If you find yourself touching
unrelated things, split them into separate PRs (each with its own approved
issue).
---
## 4. Coding conventions
Source files must be in C17. Samples use C++20. Please follow existing coding
conventions and use clang format.
---
## 5. Tests and documentation
- Comment your code.
- Public API must have Doxygen comments.
---
## 6. LLM Policy
- Follow the LLM policy in README.md
---
## Questions?
Open a [Discussion](../../discussions) — that's the best place for anything not
covered here. Thanks for helping make Box3D better!

View file

@ -1,12 +1,13 @@
# Box3D
[![Build Status](https://github.com/erincatto/box3d/actions/workflows/build.yml/badge.svg)](https://github.com/erincatto/box3d/actions)
[![CLA assistant](https://cla-assistant.io/readme/badge/erincatto/box3d)](https://cla-assistant.io/erincatto/box3d)
![Box3D Logo](https://box2d.org/images/logo.svg)
Box3D is a 3D physics engine for games.
## Build status
[![Build Status](https://github.com/erincatto/box3d/actions/workflows/build.yml/badge.svg)](https://github.com/erincatto/box3d/actions)
[![Introducing Box3D](https://img.youtube.com/vi/jr_Fzl2XwKU/maxresdefault.jpg)](https://www.youtube.com/watch?v=jr_Fzl2XwKU)
## Features
@ -19,13 +20,14 @@ Box3D is a 3D physics engine for games.
- Collision filtering
- Ray casts, shape casts, and overlap queries
- Sensor system
- Character mover
### Physics
- Robust _Soft Step_ rigid body solver
- Continuous physics for fast translations and rotations
- Island based sleep
- Revolute, prismatic, distance, mouse joint, weld, and wheel joints
- Revolute, prismatic, distance, motor, weld, and wheel joints
- Joint limits, motors, springs, and friction
- Joint and contact forces
- Body movement events and sleep notification
@ -36,12 +38,14 @@ Box3D is a 3D physics engine for games.
- Written in portable C17
- Extensive multithreading and SIMD
- Optimized for large piles of bodies
- Cross platform determinism
- Recording and replay
### Samples
- Uses sokol to run with D3D11 on Window, Metal on macOS, and OpenGL 4.3 on Linux
- Graphical user interface with imgui
- Many samples to demonstrate features and performance
- Uses sokol to run with D3D11 on Windows, Metal on macOS, and OpenGL 4.5 on Linux.
- Graphical user interface with imgui.
- Many samples to demonstrate features and performance.
## Building all platforms
@ -51,11 +55,12 @@ Box3D is a 3D physics engine for games.
## Building with CMake presets (recommended)
The presets in `CMakePresets.json` give one build flow on every platform and are picked up automatically by Visual Studio, VS Code, and CLion (open the folder and choose a preset). From the command line:
This uses the presets in `CMakePresets.json`.
- Windows: `cmake --preset windows` then `cmake --build --preset windows-release`
- Linux: `cmake --preset linux-release` then `cmake --build --preset linux-release`
- macOS: `cmake --preset macos` then `cmake --build --preset macos-release`
- Windows MinGW: `cmake --preset mingw-release` then `cmake --build --preset mingw-release`
Run the samples app (must be in the Box3D directory).
@ -83,6 +88,14 @@ Run the samples app (must be in the Box3D directory).
- Select the samples scheme
- Build and run the samples
## Building for Web
- [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html)
- `emcmake cmake -B build -DBOX3D_SAMPLES=OFF`
- `cmake --build build`
Box3D uses SSE2 with WebAssembly. Define `BOX3D_DISABLE_SIMD` to disable SSE2.
## Building and installing
- mkdir build
@ -94,10 +107,9 @@ Run the samples app (must be in the Box3D directory).
## Using Box3D in your project
The core library has no dependencies beyond the C runtime (and `libm` on Unix). Linking it
gives you the `box3d::box3d` target. When Box3D is consumed as a subproject it builds the
library only; samples, tests, and benchmarks are skipped.
gives you the `box3d::box3d` target.
The recommended path is FetchContent, which pins a tag and needs no separate install step:
I recommend to use FetchContent:
```cmake
include(FetchContent)
@ -135,7 +147,9 @@ You will need a compiler that supports C17 to build the Box3D library.
You will need a compiler that supports C++20 to build the samples.
Box3D uses SSE2 and Neon SIMD math to improve performance. This can be disabled by defining `BOX3D_DISABLE_SIMD`.
Box3D uses SSE2, AVX2, and Neon (AArch64) SIMD math to improve performance. This can be disabled by
defining `BOX3D_DISABLE_SIMD`. SSE2 is automatically used as a fallback when the CPU doesn't support
AVX2.
## Documentation
@ -147,7 +161,7 @@ The user manual lives in [`docs/`](docs/) and is built with Doxygen. Enable the
## Contributing
Please do not submit pull requests. Instead, please file an issue for bugs or feature requests. For support, please visit the Discord server.
Pull requests are currently disabled. Instead, please file an issue for bugs or feature requests. For support, please visit the Discord server.
## Giving feedback
@ -162,3 +176,16 @@ Box3D is developed by Erin Catto and uses the [MIT license](https://en.wikipedia
Support development of Box3D through [Github Sponsors](https://github.com/sponsors/erincatto).
Please consider starring this repository and subscribing to my [YouTube channel](https://www.youtube.com/@erin_catto).
## LLM Usage
LLMs are used in the following areas:
- unit tests
- samples app
- migrating code between Box2D and Box3D
- build configuration
- code reviews
- benchmarking
Elsewhere all code is developed and written by me. I take responsibility for every line of code in Box2D/3D.

View file

@ -2,12 +2,54 @@
set(BOX3D_BENCHMARK_FILES
main.c
mesh_benchmark.c
mesh_benchmark.h
)
add_executable(benchmark ${BOX3D_BENCHMARK_FILES})
set_target_properties(benchmark PROPERTIES C_STANDARD 17)
set_target_properties(benchmark PROPERTIES
C_STANDARD 17
C_STANDARD_REQUIRED YES
C_EXTENSIONS NO
)
if (BOX3D_COMPILE_WARNING_AS_ERROR)
set_target_properties(benchmark PROPERTIES COMPILE_WARNING_AS_ERROR ON)
endif()
target_link_libraries(benchmark PRIVATE box3d shared)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${BOX3D_BENCHMARK_FILES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${BOX3D_BENCHMARK_FILES})
# Mesh drop soak. Uses internal threads, so it needs the static library.
if (NOT BUILD_SHARED_LIBS)
add_executable(mesh_soak mesh_soak.c)
set_target_properties(mesh_soak PROPERTIES
C_STANDARD 17
C_STANDARD_REQUIRED YES
C_EXTENSIONS NO
)
if (BOX3D_COMPILE_WARNING_AS_ERROR)
set_target_properties(mesh_soak PROPERTIES COMPILE_WARNING_AS_ERROR ON)
endif()
target_include_directories(mesh_soak PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src)
target_link_libraries(mesh_soak PRIVATE box3d shared)
endif()
# Headless Ghost Collisions sample. Counts ghost manifolds per scene and body.
add_executable(ghost_scan ghost_scan.c)
set_target_properties(ghost_scan PROPERTIES
C_STANDARD 17
C_STANDARD_REQUIRED YES
C_EXTENSIONS NO
)
if (BOX3D_COMPILE_WARNING_AS_ERROR)
set_target_properties(ghost_scan PROPERTIES COMPILE_WARNING_AS_ERROR ON)
endif()
target_link_libraries(ghost_scan PRIVATE box3d shared)

View file

@ -0,0 +1,9 @@
threads,ms
1,5092.98
2,2683.53
3,1843.54
4,1439.27
5,1192.14
6,1033.23
7,923.268
8,846.347
1 threads ms
2 1 5092.98
3 2 2683.53
4 3 1843.54
5 4 1439.27
6 5 1192.14
7 6 1033.23
8 7 923.268
9 8 846.347

View file

@ -0,0 +1,9 @@
threads,ms
1,1332.87
2,689.909
3,463.412
4,352.244
5,282.623
6,239.524
7,207.957
8,185.382
1 threads ms
2 1 1332.87
3 2 689.909
4 3 463.412
5 4 352.244
6 5 282.623
7 6 239.524
8 7 207.957
9 8 185.382

View file

@ -0,0 +1,9 @@
threads,ms
1,11236.9
2,5885.02
3,4063.23
4,3147.56
5,2601.85
6,2248.15
7,2001.73
8,1822.96
1 threads ms
2 1 11236.9
3 2 5885.02
4 3 4063.23
5 4 3147.56
6 5 2601.85
7 6 2248.15
8 7 2001.73
9 8 1822.96

View file

@ -0,0 +1,9 @@
threads,ms
1,1099.9
2,567.505
3,392.791
4,302.607
5,250.85
6,218.705
7,193.731
8,175.831
1 threads ms
2 1 1099.9
3 2 567.505
4 3 392.791
5 4 302.607
6 5 250.85
7 6 218.705
8 7 193.731
9 8 175.831

View file

@ -0,0 +1,9 @@
threads,ms
1,5.2893
2,6.8593
3,8.2452
4,8.7965
5,8.88
6,8.8702
7,9.0274
8,9.3917
1 threads ms
2 1 5.2893
3 2 6.8593
4 3 8.2452
5 4 8.7965
6 5 8.88
7 6 8.8702
8 7 9.0274
9 8 9.3917

View file

@ -0,0 +1,9 @@
threads,ms
1,1252.28
2,603.36
3,412.994
4,311.517
5,249.951
6,210.331
7,185.742
8,162.021
1 threads ms
2 1 1252.28
3 2 603.36
4 3 412.994
5 4 311.517
6 5 249.951
7 6 210.331
8 7 185.742
9 8 162.021

View file

@ -0,0 +1,9 @@
threads,ms
1,1287.05
2,665.133
3,463.048
4,360.315
5,300.983
6,262.112
7,236.27
8,214.998
1 threads ms
2 1 1287.05
3 2 665.133
4 3 463.048
5 4 360.315
6 5 300.983
7 6 262.112
8 7 236.27
9 8 214.998

View file

@ -0,0 +1,9 @@
threads,ms
1,1832.38
2,995.626
3,699.212
4,547.216
5,456.76
6,396.698
7,356.024
8,325.755
1 threads ms
2 1 1832.38
3 2 995.626
4 3 699.212
5 4 547.216
6 5 456.76
7 6 396.698
8 7 356.024
9 8 325.755

View file

@ -0,0 +1,9 @@
threads,ms
1,625.709
2,330.685
3,233.065
4,187.897
5,160.823
6,143.489
7,131.729
8,125.636
1 threads ms
2 1 625.709
3 2 330.685
4 3 233.065
5 4 187.897
6 5 160.823
7 6 143.489
8 7 131.729
9 8 125.636

View file

@ -0,0 +1,9 @@
threads,ms
1,2274.2
2,1328.84
3,960.76
4,782.728
5,679.039
6,633.552
7,567.926
8,541.742
1 threads ms
2 1 2274.2
3 2 1328.84
4 3 960.76
5 4 782.728
6 5 679.039
7 6 633.552
8 7 567.926
9 8 541.742

View file

@ -0,0 +1,9 @@
threads,ms
1,103.803
2,69.6303
3,59.0807
4,53.6692
5,50.927
6,49.0812
7,48.3124
8,47.7709
1 threads ms
2 1 103.803
3 2 69.6303
4 3 59.0807
5 4 53.6692
6 5 50.927
7 6 49.0812
8 7 48.3124
9 8 47.7709

View file

@ -0,0 +1,9 @@
threads,ms
1,357.883
2,217.829
3,169.684
4,147.551
5,135.274
6,126.444
7,122.615
8,119.284
1 threads ms
2 1 357.883
3 2 217.829
4 3 169.684
5 4 147.551
6 5 135.274
7 6 126.444
8 7 122.615
9 8 119.284

View file

@ -0,0 +1,9 @@
threads,ms
1,162.522
2,103.266
3,84.4805
4,74.2779
5,70.0241
6,66.3925
7,64.5923
8,63.7022
1 threads ms
2 1 162.522
3 2 103.266
4 3 84.4805
5 4 74.2779
6 5 70.0241
7 6 66.3925
8 7 64.5923
9 8 63.7022

View file

@ -0,0 +1,9 @@
threads,ms
1,15659.7
2,8342.79
3,5752.42
4,4424.66
5,3715.88
6,3211.79
7,2848.87
8,2534.36
1 threads ms
2 1 15659.7
3 2 8342.79
4 3 5752.42
5 4 4424.66
6 5 3715.88
7 6 3211.79
8 7 2848.87
9 8 2534.36

View file

@ -0,0 +1,9 @@
threads,ms
1,40706
2,20798.5
3,13788.7
4,10323.8
5,8358.62
6,6957.96
7,6005.53
8,5292.26
1 threads ms
2 1 40706
3 2 20798.5
4 3 13788.7
5 4 10323.8
6 5 8358.62
7 6 6957.96
8 7 6005.53
9 8 5292.26

View file

@ -0,0 +1,9 @@
threads,ms
1,1525.94
2,780.126
3,524.776
4,401.402
5,325.756
6,273.225
7,238.761
8,213.639
1 threads ms
2 1 1525.94
3 2 780.126
4 3 524.776
5 4 401.402
6 5 325.756
7 6 273.225
8 7 238.761
9 8 213.639

View file

@ -0,0 +1,9 @@
threads,ms
1,31501.3
2,16601.6
3,11227.1
4,8563.17
5,6942.15
6,5857.2
7,5070.54
8,4517.74
1 threads ms
2 1 31501.3
3 2 16601.6
4 3 11227.1
5 4 8563.17
6 5 6942.15
7 6 5857.2
8 7 5070.54
9 8 4517.74

View file

@ -0,0 +1,9 @@
threads,ms
1,5026.74
2,2674.22
3,1794.82
4,1368.46
5,1105.67
6,939.709
7,808.349
8,720.536
1 threads ms
2 1 5026.74
3 2 2674.22
4 3 1794.82
5 4 1368.46
6 5 1105.67
7 6 939.709
8 7 808.349
9 8 720.536

View file

@ -0,0 +1,9 @@
threads,ms
1,24.5593
2,26.5894
3,27.5323
4,27.8544
5,27.8073
6,28.2759
7,28.1201
8,28.7588
1 threads ms
2 1 24.5593
3 2 26.5894
4 3 27.5323
5 4 27.8544
6 5 27.8073
7 6 28.2759
8 7 28.1201
9 8 28.7588

View file

@ -0,0 +1,9 @@
threads,ms
1,4932.85
2,2561.79
3,1704.06
4,1272.41
5,1017.39
6,850.793
7,724.552
8,635.926
1 threads ms
2 1 4932.85
3 2 2561.79
4 3 1704.06
5 4 1272.41
6 5 1017.39
7 6 850.793
8 7 724.552
9 8 635.926

View file

@ -0,0 +1,9 @@
threads,ms
1,2540.8
2,1420.77
3,992.02
4,783.73
5,650.823
6,570.124
7,510.213
8,467.848
1 threads ms
2 1 2540.8
3 2 1420.77
4 3 992.02
5 4 783.73
6 5 650.823
7 6 570.124
8 7 510.213
9 8 467.848

View file

@ -0,0 +1,9 @@
threads,ms
1,221.556
2,143.138
3,113.761
4,100.076
5,93.3681
6,89.6276
7,88.2381
8,85.6611
1 threads ms
2 1 221.556
3 2 143.138
4 3 113.761
5 4 100.076
6 5 93.3681
7 6 89.6276
8 7 88.2381
9 8 85.6611

View file

@ -0,0 +1,9 @@
threads,ms
1,815.263
2,468.217
3,344.646
4,296.781
5,269.952
6,252.229
7,240.146
8,234.044
1 threads ms
2 1 815.263
3 2 468.217
4 3 344.646
5 4 296.781
6 5 269.952
7 6 252.229
8 7 240.146
9 8 234.044

View file

@ -0,0 +1,9 @@
threads,ms
1,346.159
2,201.958
3,154.425
4,134.719
5,126.168
6,118.983
7,114.768
8,113.253
1 threads ms
2 1 346.159
3 2 201.958
4 3 154.425
5 4 134.719
6 5 126.168
7 6 118.983
8 7 114.768
9 8 113.253

View file

@ -1,9 +1,9 @@
threads,ms
1,0
2,0
3,0
4,0
5,0
6,0
7,0
8,5488.14
1,42026.4
2,22031.7
3,15189.6
4,11643.4
5,9501.71
6,8106.17
7,7077.93
8,6338.72

1 threads ms
2 1 0 42026.4
3 2 0 22031.7
4 3 0 15189.6
5 4 0 11643.4
6 5 0 9501.71
7 6 0 8106.17
8 7 0 7077.93
9 8 5488.14 6338.72

View file

@ -0,0 +1,9 @@
threads,ms
1,5834.56
2,3071.09
3,2104.65
4,1629.92
5,1347.05
6,1160.72
7,1031.3
8,938.203
1 threads ms
2 1 5834.56
3 2 3071.09
4 3 2104.65
5 4 1629.92
6 5 1347.05
7 6 1160.72
8 7 1031.3
9 8 938.203

View file

@ -1,9 +1,9 @@
threads,ms
1,1405.95
2,771.262
3,525.161
4,396.555
5,319.261
6,273.429
7,236.346
8,212.377
1,1311.69
2,684.485
3,463.171
4,351.927
5,283.58
6,239.664
7,208.766
8,185.503

1 threads ms
2 1 1405.95 1311.69
3 2 771.262 684.485
4 3 525.161 463.171
5 4 396.555 351.927
6 5 319.261 283.58
7 6 273.429 239.664
8 7 236.346 208.766
9 8 212.377 185.503

View file

@ -1,9 +1,9 @@
threads,ms
1,24484.3
2,13666.7
3,9769.51
4,7573.72
5,6165.49
6,5234.91
7,4569.35
8,4096.21
1,12295.2
2,6543.68
3,4507.87
4,3479.32
5,2860.52
6,2465.78
7,2181.07
8,1976.01

1 threads ms
2 1 24484.3 12295.2
3 2 13666.7 6543.68
4 3 9769.51 4507.87
5 4 7573.72 3479.32
6 5 6165.49 2860.52
7 6 5234.91 2465.78
8 7 4569.35 2181.07
9 8 4096.21 1976.01

View file

@ -1,9 +1,9 @@
threads,ms
1,1776.98
2,887.705
3,611.107
4,477.959
5,393.24
6,338.688
7,301.258
8,272.38
1,1482.54
2,779.924
3,539.552
4,412.933
5,337.409
6,296.132
7,258.414
8,234.912

1 threads ms
2 1 1776.98 1482.54
3 2 887.705 779.924
4 3 611.107 539.552
5 4 477.959 412.933
6 5 393.24 337.409
7 6 338.688 296.132
8 7 301.258 258.414
9 8 272.38 234.912

View file

@ -1,9 +1,9 @@
threads,ms
1,9.6721
2,12.2776
3,13.8174
4,15.0718
5,14.2408
6,14.8061
7,15.4252
8,15.7804
1,6.4003
2,8.3039
3,9.2919
4,9.5648
5,10.014
6,9.8492
7,9.9471
8,10.1759

1 threads ms
2 1 9.6721 6.4003
3 2 12.2776 8.3039
4 3 13.8174 9.2919
5 4 15.0718 9.5648
6 5 14.2408 10.014
7 6 14.8061 9.8492
8 7 15.4252 9.9471
9 8 15.7804 10.1759

View file

@ -1,9 +1,9 @@
threads,ms
1,2540.44
2,1220.31
3,813.901
4,609.715
5,497.305
6,413.889
7,361.679
8,319.254
1,1589.75
2,818.695
3,552.764
4,419.151
5,335.022
6,282.792
7,244.754
8,217.593

1 threads ms
2 1 2540.44 1589.75
3 2 1220.31 818.695
4 3 813.901 552.764
5 4 609.715 419.151
6 5 497.305 335.022
7 6 413.889 282.792
8 7 361.679 244.754
9 8 319.254 217.593

View file

@ -1,9 +1,9 @@
threads,ms
1,2314.36
2,1306.31
3,932.724
4,735.735
5,610.991
6,529.984
7,478.004
8,442.816
1,2062.84
2,1128.22
3,787.495
4,615.21
5,510.128
6,441.225
7,393.722
8,360.659

1 threads ms
2 1 2314.36 2062.84
3 2 1306.31 1128.22
4 3 932.724 787.495
5 4 735.735 615.21
6 5 610.991 510.128
7 6 529.984 441.225
8 7 478.004 393.722
9 8 442.816 360.659

View file

@ -0,0 +1,9 @@
threads,ms
1,844.093
2,457.862
3,318.846
4,250.452
5,209.426
6,185.657
7,169.441
8,159.537
1 threads ms
2 1 844.093
3 2 457.862
4 3 318.846
5 4 250.452
6 5 209.426
7 6 185.657
8 7 169.441
9 8 159.537

View file

@ -0,0 +1,9 @@
threads,ms
1,3134.14
2,1823.2
3,1303
4,1047.41
5,895.276
6,799.402
7,736.174
8,697.184
1 threads ms
2 1 3134.14
3 2 1823.2
4 3 1303
5 4 1047.41
6 5 895.276
7 6 799.402
8 7 736.174
9 8 697.184

View file

@ -1,9 +1,9 @@
threads,ms
1,252.889
2,159.521
3,130.152
4,114.981
5,110.742
6,98.8688
7,99.0887
8,99.0417
1,167.791
2,110.927
3,87.9977
4,78.3566
5,73.6954
6,71.5957
7,70.7282
8,69.9302

1 threads ms
2 1 252.889 167.791
3 2 159.521 110.927
4 3 130.152 87.9977
5 4 114.981 78.3566
6 5 110.742 73.6954
7 6 98.8688 71.5957
8 7 99.0887 70.7282
9 8 99.0417 69.9302

View file

@ -1,9 +1,9 @@
threads,ms
1,816.219
2,486.479
3,371.869
4,315.809
5,282.72
6,262.329
7,252.624
8,244.159
1,659.503
2,387.181
3,283.605
4,245.555
5,222.887
6,208.297
7,198.029
8,191.382

1 threads ms
2 1 816.219 659.503
3 2 486.479 387.181
4 3 371.869 283.605
5 4 315.809 245.555
6 5 282.72 222.887
7 6 262.329 208.297
8 7 252.624 198.029
9 8 244.159 191.382

View file

@ -1,9 +1,9 @@
threads,ms
1,334.239
2,226.053
3,182.466
4,159.489
5,149.676
6,140.113
7,132.326
8,132.251
1,285.725
2,176.941
3,135.635
4,119.013
5,109.379
6,104.485
7,101.719
8,99.5091

1 threads ms
2 1 334.239 285.725
3 2 226.053 176.941
4 3 182.466 135.635
5 4 159.489 119.013
6 5 149.676 109.379
7 6 140.113 104.485
8 7 132.326 101.719
9 8 132.251 99.5091

View file

@ -1,9 +1,9 @@
threads,ms
1,30675.7
2,16370.1
3,11431
4,8895.99
5,7391.02
6,6300.97
7,5618.21
8,5073.84
1,17570
2,9467.24
3,6511.07
4,5051.22
5,4128.07
6,3545.32
7,3142.81
8,2844.68

1 threads ms
2 1 30675.7 17570
3 2 16370.1 9467.24
4 3 11431 6511.07
5 4 8895.99 5051.22
6 5 7391.02 4128.07
7 6 6300.97 3545.32
8 7 5618.21 3142.81
9 8 5073.84 2844.68

View file

@ -0,0 +1,109 @@
scene,preset,mirror,body,ghosts,runs
flat,0,0,box,0,2
flat,0,0,capsule,0,2
flat,0,0,upright,0,2
flat,0,0,sphere,0,2
flat,0,0,cylinder,0,2
flat,0,1,box,0,2
flat,0,1,capsule,0,2
flat,0,1,upright,0,2
flat,0,1,sphere,0,2
flat,0,1,cylinder,0,2
ramp,0,0,box,0,3
ramp,0,0,capsule,0,3
ramp,0,0,upright,0,3
ramp,0,0,sphere,0,3
ramp,0,0,cylinder,0,3
ramp,0,1,box,0,3
ramp,0,1,capsule,0,3
ramp,0,1,upright,0,3
ramp,0,1,sphere,0,3
ramp,0,1,cylinder,0,3
cliff,0,0,box,0,2
cliff,0,0,capsule,0,2
cliff,0,0,upright,0,2
cliff,0,0,sphere,0,2
cliff,0,0,cylinder,0,2
cliff,0,1,box,0,2
cliff,0,1,capsule,0,2
cliff,0,1,upright,0,2
cliff,0,1,sphere,0,2
cliff,0,1,cylinder,0,2
crest,0,0,box,0,2
crest,0,0,capsule,0,2
crest,0,0,upright,0,2
crest,0,0,sphere,0,2
crest,0,0,cylinder,0,2
crest,0,1,box,0,2
crest,0,1,capsule,0,2
crest,0,1,upright,0,2
crest,0,1,sphere,0,2
crest,0,1,cylinder,0,2
bumps,0,0,box,0,1
bumps,0,0,capsule,0,1
bumps,0,0,upright,0,1
bumps,0,0,sphere,0,1
bumps,0,0,cylinder,0,1
bumps,0,1,box,0,1
bumps,0,1,capsule,0,1
bumps,0,1,upright,0,1
bumps,0,1,sphere,0,1
bumps,0,1,cylinder,0,1
peel,0,0,box,0,2
peel,0,0,capsule,0,2
peel,0,0,upright,0,2
peel,0,0,sphere,0,2
peel,0,0,cylinder,0,2
peel,0,1,box,0,2
peel,0,1,capsule,0,2
peel,0,1,upright,0,2
peel,0,1,sphere,0,2
peel,0,1,cylinder,0,2
peel,1,0,box,0,2
peel,1,0,capsule,0,2
peel,1,0,upright,0,2
peel,1,0,sphere,0,2
peel,1,0,cylinder,0,2
peel,1,1,box,0,2
peel,1,1,capsule,0,2
peel,1,1,upright,0,2
peel,1,1,sphere,0,2
peel,1,1,cylinder,0,2
peel,2,0,box,0,2
peel,2,0,capsule,0,2
peel,2,0,upright,0,2
peel,2,0,sphere,0,2
peel,2,0,cylinder,0,2
peel,2,1,box,0,2
peel,2,1,capsule,0,2
peel,2,1,upright,0,2
peel,2,1,sphere,0,2
peel,2,1,cylinder,0,2
peel,3,0,box,0,2
peel,3,0,capsule,0,2
peel,3,0,upright,0,2
peel,3,0,sphere,0,2
peel,3,0,cylinder,0,2
peel,3,1,box,0,2
peel,3,1,capsule,0,2
peel,3,1,upright,0,2
peel,3,1,sphere,0,2
peel,3,1,cylinder,0,2
chamfer,0,0,box,0,2
chamfer,0,0,cylinder,0,2
chamfer,0,1,box,0,2
chamfer,0,1,cylinder,0,2
rail,0,0,box,0,2
rail,0,0,capsule,0,2
rail,0,0,upright,0,5
rail,0,0,sphere,0,4
rail,0,0,cylinder,0,3
rail,0,1,box,0,2
rail,0,1,capsule,0,2
rail,0,1,upright,0,5
rail,0,1,sphere,0,4
rail,0,1,cylinder,0,3
beams,0,0,box,0,3
beams,0,0,cylinder,0,3
beams,0,1,box,0,3
beams,0,1,cylinder,0,3
1 scene preset mirror body ghosts runs
2 flat 0 0 box 0 2
3 flat 0 0 capsule 0 2
4 flat 0 0 upright 0 2
5 flat 0 0 sphere 0 2
6 flat 0 0 cylinder 0 2
7 flat 0 1 box 0 2
8 flat 0 1 capsule 0 2
9 flat 0 1 upright 0 2
10 flat 0 1 sphere 0 2
11 flat 0 1 cylinder 0 2
12 ramp 0 0 box 0 3
13 ramp 0 0 capsule 0 3
14 ramp 0 0 upright 0 3
15 ramp 0 0 sphere 0 3
16 ramp 0 0 cylinder 0 3
17 ramp 0 1 box 0 3
18 ramp 0 1 capsule 0 3
19 ramp 0 1 upright 0 3
20 ramp 0 1 sphere 0 3
21 ramp 0 1 cylinder 0 3
22 cliff 0 0 box 0 2
23 cliff 0 0 capsule 0 2
24 cliff 0 0 upright 0 2
25 cliff 0 0 sphere 0 2
26 cliff 0 0 cylinder 0 2
27 cliff 0 1 box 0 2
28 cliff 0 1 capsule 0 2
29 cliff 0 1 upright 0 2
30 cliff 0 1 sphere 0 2
31 cliff 0 1 cylinder 0 2
32 crest 0 0 box 0 2
33 crest 0 0 capsule 0 2
34 crest 0 0 upright 0 2
35 crest 0 0 sphere 0 2
36 crest 0 0 cylinder 0 2
37 crest 0 1 box 0 2
38 crest 0 1 capsule 0 2
39 crest 0 1 upright 0 2
40 crest 0 1 sphere 0 2
41 crest 0 1 cylinder 0 2
42 bumps 0 0 box 0 1
43 bumps 0 0 capsule 0 1
44 bumps 0 0 upright 0 1
45 bumps 0 0 sphere 0 1
46 bumps 0 0 cylinder 0 1
47 bumps 0 1 box 0 1
48 bumps 0 1 capsule 0 1
49 bumps 0 1 upright 0 1
50 bumps 0 1 sphere 0 1
51 bumps 0 1 cylinder 0 1
52 peel 0 0 box 0 2
53 peel 0 0 capsule 0 2
54 peel 0 0 upright 0 2
55 peel 0 0 sphere 0 2
56 peel 0 0 cylinder 0 2
57 peel 0 1 box 0 2
58 peel 0 1 capsule 0 2
59 peel 0 1 upright 0 2
60 peel 0 1 sphere 0 2
61 peel 0 1 cylinder 0 2
62 peel 1 0 box 0 2
63 peel 1 0 capsule 0 2
64 peel 1 0 upright 0 2
65 peel 1 0 sphere 0 2
66 peel 1 0 cylinder 0 2
67 peel 1 1 box 0 2
68 peel 1 1 capsule 0 2
69 peel 1 1 upright 0 2
70 peel 1 1 sphere 0 2
71 peel 1 1 cylinder 0 2
72 peel 2 0 box 0 2
73 peel 2 0 capsule 0 2
74 peel 2 0 upright 0 2
75 peel 2 0 sphere 0 2
76 peel 2 0 cylinder 0 2
77 peel 2 1 box 0 2
78 peel 2 1 capsule 0 2
79 peel 2 1 upright 0 2
80 peel 2 1 sphere 0 2
81 peel 2 1 cylinder 0 2
82 peel 3 0 box 0 2
83 peel 3 0 capsule 0 2
84 peel 3 0 upright 0 2
85 peel 3 0 sphere 0 2
86 peel 3 0 cylinder 0 2
87 peel 3 1 box 0 2
88 peel 3 1 capsule 0 2
89 peel 3 1 upright 0 2
90 peel 3 1 sphere 0 2
91 peel 3 1 cylinder 0 2
92 chamfer 0 0 box 0 2
93 chamfer 0 0 cylinder 0 2
94 chamfer 0 1 box 0 2
95 chamfer 0 1 cylinder 0 2
96 rail 0 0 box 0 2
97 rail 0 0 capsule 0 2
98 rail 0 0 upright 0 5
99 rail 0 0 sphere 0 4
100 rail 0 0 cylinder 0 3
101 rail 0 1 box 0 2
102 rail 0 1 capsule 0 2
103 rail 0 1 upright 0 5
104 rail 0 1 sphere 0 4
105 rail 0 1 cylinder 0 3
106 beams 0 0 box 0 3
107 beams 0 0 cylinder 0 3
108 beams 0 1 box 0 3
109 beams 0 1 cylinder 0 3

View file

@ -0,0 +1,109 @@
scene,preset,mirror,body,ghosts,runs
flat,0,0,box,0,2
flat,0,0,capsule,0,2
flat,0,0,upright,0,2
flat,0,0,sphere,0,2
flat,0,0,cylinder,0,2
flat,0,1,box,0,2
flat,0,1,capsule,0,2
flat,0,1,upright,0,2
flat,0,1,sphere,0,2
flat,0,1,cylinder,0,2
ramp,0,0,box,0,3
ramp,0,0,capsule,0,3
ramp,0,0,upright,0,3
ramp,0,0,sphere,0,3
ramp,0,0,cylinder,0,3
ramp,0,1,box,0,3
ramp,0,1,capsule,0,3
ramp,0,1,upright,0,3
ramp,0,1,sphere,0,3
ramp,0,1,cylinder,0,3
cliff,0,0,box,0,2
cliff,0,0,capsule,0,2
cliff,0,0,upright,0,2
cliff,0,0,sphere,0,2
cliff,0,0,cylinder,0,2
cliff,0,1,box,0,2
cliff,0,1,capsule,0,2
cliff,0,1,upright,0,2
cliff,0,1,sphere,0,2
cliff,0,1,cylinder,0,2
crest,0,0,box,0,2
crest,0,0,capsule,0,2
crest,0,0,upright,0,2
crest,0,0,sphere,0,2
crest,0,0,cylinder,0,2
crest,0,1,box,0,2
crest,0,1,capsule,0,2
crest,0,1,upright,0,2
crest,0,1,sphere,0,2
crest,0,1,cylinder,0,2
bumps,0,0,box,0,1
bumps,0,0,capsule,0,1
bumps,0,0,upright,0,1
bumps,0,0,sphere,0,1
bumps,0,0,cylinder,0,1
bumps,0,1,box,0,1
bumps,0,1,capsule,0,1
bumps,0,1,upright,0,1
bumps,0,1,sphere,0,1
bumps,0,1,cylinder,0,1
peel,0,0,box,0,2
peel,0,0,capsule,0,2
peel,0,0,upright,0,2
peel,0,0,sphere,0,2
peel,0,0,cylinder,0,2
peel,0,1,box,0,2
peel,0,1,capsule,0,2
peel,0,1,upright,0,2
peel,0,1,sphere,0,2
peel,0,1,cylinder,0,2
peel,1,0,box,0,2
peel,1,0,capsule,0,2
peel,1,0,upright,0,2
peel,1,0,sphere,0,2
peel,1,0,cylinder,0,2
peel,1,1,box,0,2
peel,1,1,capsule,0,2
peel,1,1,upright,0,2
peel,1,1,sphere,0,2
peel,1,1,cylinder,0,2
peel,2,0,box,0,2
peel,2,0,capsule,0,2
peel,2,0,upright,0,2
peel,2,0,sphere,0,2
peel,2,0,cylinder,0,2
peel,2,1,box,0,2
peel,2,1,capsule,0,2
peel,2,1,upright,0,2
peel,2,1,sphere,0,2
peel,2,1,cylinder,0,2
peel,3,0,box,0,2
peel,3,0,capsule,0,2
peel,3,0,upright,0,2
peel,3,0,sphere,0,2
peel,3,0,cylinder,0,2
peel,3,1,box,0,2
peel,3,1,capsule,0,2
peel,3,1,upright,0,2
peel,3,1,sphere,0,2
peel,3,1,cylinder,0,2
chamfer,0,0,box,0,2
chamfer,0,0,cylinder,0,2
chamfer,0,1,box,0,2
chamfer,0,1,cylinder,0,2
rail,0,0,box,0,5
rail,0,0,capsule,0,4
rail,0,0,upright,0,5
rail,0,0,sphere,0,5
rail,0,0,cylinder,0,4
rail,0,1,box,0,5
rail,0,1,capsule,0,4
rail,0,1,upright,0,5
rail,0,1,sphere,0,5
rail,0,1,cylinder,0,4
beams,0,0,box,0,3
beams,0,0,cylinder,0,3
beams,0,1,box,0,3
beams,0,1,cylinder,0,3
1 scene preset mirror body ghosts runs
2 flat 0 0 box 0 2
3 flat 0 0 capsule 0 2
4 flat 0 0 upright 0 2
5 flat 0 0 sphere 0 2
6 flat 0 0 cylinder 0 2
7 flat 0 1 box 0 2
8 flat 0 1 capsule 0 2
9 flat 0 1 upright 0 2
10 flat 0 1 sphere 0 2
11 flat 0 1 cylinder 0 2
12 ramp 0 0 box 0 3
13 ramp 0 0 capsule 0 3
14 ramp 0 0 upright 0 3
15 ramp 0 0 sphere 0 3
16 ramp 0 0 cylinder 0 3
17 ramp 0 1 box 0 3
18 ramp 0 1 capsule 0 3
19 ramp 0 1 upright 0 3
20 ramp 0 1 sphere 0 3
21 ramp 0 1 cylinder 0 3
22 cliff 0 0 box 0 2
23 cliff 0 0 capsule 0 2
24 cliff 0 0 upright 0 2
25 cliff 0 0 sphere 0 2
26 cliff 0 0 cylinder 0 2
27 cliff 0 1 box 0 2
28 cliff 0 1 capsule 0 2
29 cliff 0 1 upright 0 2
30 cliff 0 1 sphere 0 2
31 cliff 0 1 cylinder 0 2
32 crest 0 0 box 0 2
33 crest 0 0 capsule 0 2
34 crest 0 0 upright 0 2
35 crest 0 0 sphere 0 2
36 crest 0 0 cylinder 0 2
37 crest 0 1 box 0 2
38 crest 0 1 capsule 0 2
39 crest 0 1 upright 0 2
40 crest 0 1 sphere 0 2
41 crest 0 1 cylinder 0 2
42 bumps 0 0 box 0 1
43 bumps 0 0 capsule 0 1
44 bumps 0 0 upright 0 1
45 bumps 0 0 sphere 0 1
46 bumps 0 0 cylinder 0 1
47 bumps 0 1 box 0 1
48 bumps 0 1 capsule 0 1
49 bumps 0 1 upright 0 1
50 bumps 0 1 sphere 0 1
51 bumps 0 1 cylinder 0 1
52 peel 0 0 box 0 2
53 peel 0 0 capsule 0 2
54 peel 0 0 upright 0 2
55 peel 0 0 sphere 0 2
56 peel 0 0 cylinder 0 2
57 peel 0 1 box 0 2
58 peel 0 1 capsule 0 2
59 peel 0 1 upright 0 2
60 peel 0 1 sphere 0 2
61 peel 0 1 cylinder 0 2
62 peel 1 0 box 0 2
63 peel 1 0 capsule 0 2
64 peel 1 0 upright 0 2
65 peel 1 0 sphere 0 2
66 peel 1 0 cylinder 0 2
67 peel 1 1 box 0 2
68 peel 1 1 capsule 0 2
69 peel 1 1 upright 0 2
70 peel 1 1 sphere 0 2
71 peel 1 1 cylinder 0 2
72 peel 2 0 box 0 2
73 peel 2 0 capsule 0 2
74 peel 2 0 upright 0 2
75 peel 2 0 sphere 0 2
76 peel 2 0 cylinder 0 2
77 peel 2 1 box 0 2
78 peel 2 1 capsule 0 2
79 peel 2 1 upright 0 2
80 peel 2 1 sphere 0 2
81 peel 2 1 cylinder 0 2
82 peel 3 0 box 0 2
83 peel 3 0 capsule 0 2
84 peel 3 0 upright 0 2
85 peel 3 0 sphere 0 2
86 peel 3 0 cylinder 0 2
87 peel 3 1 box 0 2
88 peel 3 1 capsule 0 2
89 peel 3 1 upright 0 2
90 peel 3 1 sphere 0 2
91 peel 3 1 cylinder 0 2
92 chamfer 0 0 box 0 2
93 chamfer 0 0 cylinder 0 2
94 chamfer 0 1 box 0 2
95 chamfer 0 1 cylinder 0 2
96 rail 0 0 box 0 5
97 rail 0 0 capsule 0 4
98 rail 0 0 upright 0 5
99 rail 0 0 sphere 0 5
100 rail 0 0 cylinder 0 4
101 rail 0 1 box 0 5
102 rail 0 1 capsule 0 4
103 rail 0 1 upright 0 5
104 rail 0 1 sphere 0 5
105 rail 0 1 cylinder 0 4
106 beams 0 0 box 0 3
107 beams 0 0 cylinder 0 3
108 beams 0 1 box 0 3
109 beams 0 1 cylinder 0 3

535
benchmark/ghost_scan.c Normal file
View file

@ -0,0 +1,535 @@
// SPDX-FileCopyrightText: 2026 Erin Catto
// SPDX-License-Identifier: MIT
// Headless scan of the Mesh / Ghost Collisions sample. Runs every scene, body, mirror and PEEL
// preset for a fixed number of steps and counts the ghost manifolds that pushed on the body. A
// written result file can be compared against a later build, which fails on any count that grew. It
// also fails on a config that completed fewer runs, because a body stopped on an edge or dropped
// through the ground crosses fewer edges and so logs fewer ghosts.
#if defined( _MSC_VER ) && !defined( _CRT_SECURE_NO_WARNINGS )
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "ghost_collisions.h"
#include "box3d/box3d.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Command line and result file keys
static const char* s_sceneKeys[e_ghostSceneCount] = {
"flat", "ramp", "cliff", "crest", "bumps", "peel", "chamfer", "rail", "beams",
};
static const char* s_bodyKeys[e_ghostBodyCount] = { "box", "capsule", "upright", "sphere", "cylinder" };
#define MAX_CONFIGS 256
static bool s_recycling = true;
typedef struct Config
{
GhostScene scene;
int preset;
bool mirror;
GhostBody body;
int ghostCount;
int runCount;
// From the compare file, -1 when absent
int baseGhostCount;
int baseRunCount;
} Config;
static const char* MatchValue( const char* arg, const char* shortName, const char* longName )
{
size_t shortLength = strlen( shortName );
if ( strncmp( arg, shortName, shortLength ) == 0 )
{
return arg + shortLength;
}
size_t longLength = strlen( longName );
if ( strncmp( arg, longName, longLength ) == 0 )
{
return arg + longLength;
}
return NULL;
}
// Returns -1 for all, -2 for unknown
static int ParseKey( const char* value, const char** keys, int count )
{
if ( strcmp( value, "all" ) == 0 )
{
return -1;
}
for ( int i = 0; i < count; ++i )
{
if ( strcmp( value, keys[i] ) == 0 )
{
return i;
}
}
char* end;
long index = strtol( value, &end, 10 );
if ( *end == '\0' && 0 <= index && index < count )
{
return (int)index;
}
return -2;
}
static void RunConfig( Config* config, GhostSettings settings, int stepCount, bool verbose )
{
settings.scene = config->scene;
settings.peelPreset = config->preset;
settings.mirror = config->mirror;
settings.body = config->body;
// The s&box character is a fixed rotation hull without speculative contact. Speculative contact or
// rotation hide the ghost.
if ( config->scene == e_ghostChamfer )
{
settings.fixedRotation = true;
settings.speculative = false;
}
// The s&box character over the beam pits, hovering on speculative contacts. A resting cull that keeps
// the chamfers flush with the top launches it.
if ( config->scene == e_ghostBeams )
{
settings.fixedRotation = true;
settings.speculative = true;
settings.speed = GHOST_BEAM_SPEED;
}
b3WorldDef worldDef = b3DefaultWorldDef();
b3WorldId worldId = b3CreateWorld( &worldDef );
if ( s_recycling == false )
{
b3World_SetContactRecycleDistance( worldId, 0.0f );
}
GhostCollisionsData data = CreateGhostCollisions( worldId, settings );
for ( int step = 0; step < stepCount; ++step )
{
b3World_Step( worldId, 1.0f / 60.0f, 4 );
GhostReport reports[16];
int ghostCount = UpdateGhostCollisions( worldId, &data, reports, 16 );
if ( verbose )
{
ghostCount = b3MinInt( ghostCount, 16 );
for ( int i = 0; i < ghostCount; ++i )
{
GhostReport* r = reports + i;
printf( " ghost step %d run %d n (%.3f %.3f %.3f) p (%.2f %.2f %.2f) sep %.4f impulse %.3f\n", step + 1, data.runCount,
r->normal.x, r->normal.y, r->normal.z, (float)r->point.x, (float)r->point.y, (float)r->point.z,
r->separation, r->impulse );
}
}
}
config->ghostCount = data.ghostCount;
config->runCount = data.runCount;
b3DestroyWorld( worldId );
DestroyGhostCollisions( &data );
}
static void FormatRow( char* buffer, size_t size, const Config* config )
{
if ( config->scene == e_ghostInternal )
{
snprintf( buffer, size, "%s %d%s", s_sceneKeys[config->scene], config->preset, config->mirror ? " mirror" : "" );
}
else
{
snprintf( buffer, size, "%s%s", s_sceneKeys[config->scene], config->mirror ? " mirror" : "" );
}
}
static bool SameConfig( const Config* a, const Config* b )
{
return a->scene == b->scene && a->preset == b->preset && a->mirror == b->mirror && a->body == b->body;
}
// Filters are -1 for all
static int BuildConfigs( Config* configs, int sceneFilter, int presetFilter, int mirrorFilter, int bodyFilter )
{
int configCount = 0;
for ( int scene = 0; scene < e_ghostSceneCount; ++scene )
{
if ( sceneFilter >= 0 && scene != sceneFilter )
{
continue;
}
int presetCount = scene == e_ghostInternal ? GHOST_PEEL_PRESET_COUNT : 1;
for ( int preset = 0; preset < presetCount; ++preset )
{
if ( scene == e_ghostInternal && presetFilter >= 0 && preset != presetFilter )
{
continue;
}
for ( int mirror = 0; mirror < 2; ++mirror )
{
if ( mirrorFilter >= 0 && mirror != mirrorFilter )
{
continue;
}
for ( int body = 0; body < e_ghostBodyCount; ++body )
{
if ( bodyFilter >= 0 && body != bodyFilter )
{
continue;
}
// Only a flat bottom can rest on the chamfer edges
bool chamferScene = scene == e_ghostChamfer || scene == e_ghostBeams;
if ( chamferScene && body != e_ghostBox && body != e_ghostCylinder )
{
continue;
}
B3_ASSERT( configCount < MAX_CONFIGS );
configs[configCount++] = (Config){
.scene = (GhostScene)scene,
.preset = preset,
.mirror = mirror != 0,
.body = (GhostBody)body,
.baseGhostCount = -1,
.baseRunCount = -1,
};
}
}
}
}
return configCount;
}
static bool ReadBaseline( const char* path, Config* configs, int configCount )
{
FILE* file = fopen( path, "r" );
if ( file == NULL )
{
printf( "cannot read %s\n", path );
return false;
}
char line[256];
while ( fgets( line, sizeof( line ), file ) != NULL )
{
char sceneKey[32], bodyKey[32];
int preset, mirror, ghosts, runs;
if ( sscanf( line, "%31[^,],%d,%d,%31[^,],%d,%d", sceneKey, &preset, &mirror, bodyKey, &ghosts, &runs ) != 6 )
{
continue;
}
int scene = ParseKey( sceneKey, s_sceneKeys, e_ghostSceneCount );
int body = ParseKey( bodyKey, s_bodyKeys, e_ghostBodyCount );
for ( int i = 0; i < configCount; ++i )
{
Config* c = configs + i;
if ( (int)c->scene == scene && c->preset == preset && c->mirror == ( mirror != 0 ) && (int)c->body == body )
{
c->baseGhostCount = ghosts;
c->baseRunCount = runs;
}
}
}
fclose( file );
return true;
}
// Replaces only the rows of this run and keeps the rest of an existing file, in canonical order
static bool WriteResults( const char* path, const Config* configs, int configCount )
{
Config allConfigs[MAX_CONFIGS];
int allCount = BuildConfigs( allConfigs, -1, -1, -1, -1 );
FILE* existing = fopen( path, "r" );
if ( existing != NULL )
{
fclose( existing );
if ( ReadBaseline( path, allConfigs, allCount ) == false )
{
return false;
}
}
FILE* file = fopen( path, "w" );
if ( file == NULL )
{
printf( "cannot write %s\n", path );
return false;
}
fprintf( file, "scene,preset,mirror,body,ghosts,runs\n" );
for ( int i = 0; i < allCount; ++i )
{
const Config* c = allConfigs + i;
int ghostCount = c->baseGhostCount;
int runCount = c->baseRunCount;
for ( int j = 0; j < configCount; ++j )
{
if ( SameConfig( c, configs + j ) )
{
ghostCount = configs[j].ghostCount;
runCount = configs[j].runCount;
break;
}
}
if ( ghostCount < 0 )
{
continue;
}
fprintf( file, "%s,%d,%d,%s,%d,%d\n", s_sceneKeys[c->scene], c->preset, c->mirror ? 1 : 0, s_bodyKeys[c->body], ghostCount,
runCount );
}
fclose( file );
return true;
}
int main( int argc, char** argv )
{
int sceneFilter = -1;
int bodyFilter = -1;
int mirrorFilter = -1;
int presetFilter = -1;
int stepCount = 900;
bool verbose = false;
const char* writePath = NULL;
const char* comparePath = NULL;
GhostSettings settings = GetDefaultGhostSettings();
for ( int i = 1; i < argc; ++i )
{
const char* arg = argv[i];
const char* value;
if ( ( value = MatchValue( arg, "-s=", "--scene=" ) ) != NULL )
{
sceneFilter = ParseKey( value, s_sceneKeys, e_ghostSceneCount );
}
else if ( ( value = MatchValue( arg, "-b=", "--body=" ) ) != NULL )
{
bodyFilter = ParseKey( value, s_bodyKeys, e_ghostBodyCount );
}
else if ( ( value = MatchValue( arg, "-m=", "--mirror=" ) ) != NULL )
{
mirrorFilter = strcmp( value, "all" ) == 0 ? -1 : atoi( value ) != 0;
}
else if ( ( value = MatchValue( arg, "-p=", "--preset=" ) ) != NULL )
{
presetFilter = strcmp( value, "all" ) == 0 ? -1 : b3ClampInt( atoi( value ), 0, GHOST_PEEL_PRESET_COUNT - 1 );
}
else if ( ( value = MatchValue( arg, "-n=", "--steps=" ) ) != NULL )
{
stepCount = atoi( value );
}
else if ( ( value = MatchValue( arg, "-w=", "--write=" ) ) != NULL )
{
writePath = value;
}
else if ( ( value = MatchValue( arg, "-c=", "--compare=" ) ) != NULL )
{
comparePath = value;
}
else if ( ( value = MatchValue( arg, "--speed=", "--speed=" ) ) != NULL )
{
settings.speed = (float)atof( value );
}
else if ( ( value = MatchValue( arg, "--yaw=", "--yaw=" ) ) != NULL )
{
settings.yaw = (float)atof( value );
}
else if ( ( value = MatchValue( arg, "--friction=", "--friction=" ) ) != NULL )
{
settings.friction = (float)atof( value );
}
else if ( ( value = MatchValue( arg, "--cell=", "--cell=" ) ) != NULL )
{
settings.cellSize = (float)atof( value );
}
else if ( strcmp( arg, "--fixed-rotation" ) == 0 )
{
settings.fixedRotation = true;
}
else if ( strcmp( arg, "--no-speculative" ) == 0 )
{
settings.speculative = false;
}
else if ( strcmp( arg, "--no-recycling" ) == 0 )
{
s_recycling = false;
}
else if ( strcmp( arg, "--height-field" ) == 0 )
{
settings.heightField = true;
}
else if ( strcmp( arg, "-v" ) == 0 || strcmp( arg, "--verbose" ) == 0 )
{
verbose = true;
}
else
{
sceneFilter = -2;
}
if ( sceneFilter == -2 || bodyFilter == -2 )
{
printf( "Usage: ghost_scan [options]\n"
"Runs the Ghost Collisions sample headless and counts ghost manifolds per scene and body.\n"
" -s, --scene=<key|all> flat, ramp, cliff, crest, bumps, peel, chamfer, rail, beams (default all)\n"
" chamfer runs only the box and cylinder, fixed rotation without speculative\n"
" beams runs only the box and cylinder, fixed rotation with speculative,\n"
" always at 8 m/s\n"
" -b, --body=<key|all> box, capsule, upright, sphere, cylinder (default all)\n"
" -m, --mirror=<0|1|all> mirrored mesh (default all)\n"
" -p, --preset=<0-3|all> PEEL preset (default all)\n"
" -n, --steps=<int> steps per config (default 900)\n"
" -w, --write=<file> write results as csv, replacing only the rows of this run\n"
" -c, --compare=<file> compare with a written csv, fail if any count grew, any config\n"
" completed fewer runs, or has no row\n"
" --speed=, --yaw=, --friction=, --cell=, --fixed-rotation, --no-speculative\n"
" --height-field height field ground, one static body per height field\n"
" --no-recycling disable contact recycling\n"
" -v, --verbose print every ghost\n"
"Exit code is 1 when a compared count grew, completed fewer runs or has no row, 0 otherwise.\n" );
return 2;
}
}
Config configs[MAX_CONFIGS];
int configCount = BuildConfigs( configs, sceneFilter, presetFilter, mirrorFilter, bodyFilter );
if ( comparePath != NULL && ReadBaseline( comparePath, configs, configCount ) == false )
{
return 2;
}
printf( "ghost scan: %d configs, %d steps, speed %.1f, yaw %.0f, friction %.2f, cell %.2f%s\n", configCount, stepCount,
settings.speed, settings.yaw, settings.friction, settings.cellSize, settings.heightField ? ", height field" : "" );
fflush( stdout );
uint64_t ticks = b3GetTicks();
for ( int i = 0; i < configCount; ++i )
{
if ( verbose )
{
char row[64];
FormatRow( row, sizeof( row ), configs + i );
printf( "%s %s\n", row, s_bodyKeys[configs[i].body] );
}
RunConfig( configs + i, settings, stepCount, verbose );
}
float seconds = 0.001f * b3GetMilliseconds( ticks );
// One row per ground, one column per body. A compared cell that changed prints as old>new.
printf( "\n%-18s", "" );
for ( int body = 0; body < e_ghostBodyCount; ++body )
{
if ( bodyFilter < 0 || body == bodyFilter )
{
printf( "%10s", s_bodyKeys[body] );
}
}
printf( "\n" );
int totalGhosts = 0;
int grewCount = 0;
int shrankCount = 0;
int missingCount = 0;
int fewerRunsCount = 0;
int column = 0;
for ( int i = 0; i < configCount; ++i )
{
const Config* c = configs + i;
bool newRow = i == 0 || c->scene != configs[i - 1].scene || c->preset != configs[i - 1].preset ||
c->mirror != configs[i - 1].mirror;
if ( newRow )
{
char row[64];
FormatRow( row, sizeof( row ), c );
printf( "%s%-18s", i == 0 ? "" : "\n", row );
column = 0;
}
// A scene that skips a body leaves its column empty
int bodyColumn = bodyFilter >= 0 ? 0 : (int)c->body;
while ( column < bodyColumn )
{
printf( "%10s", "-" );
column += 1;
}
column += 1;
char cell[32];
if ( comparePath != NULL && c->baseGhostCount < 0 )
{
snprintf( cell, sizeof( cell ), "?>%d", c->ghostCount );
}
else if ( c->baseGhostCount >= 0 && c->baseGhostCount != c->ghostCount )
{
snprintf( cell, sizeof( cell ), "%d>%d", c->baseGhostCount, c->ghostCount );
}
else
{
snprintf( cell, sizeof( cell ), "%d", c->ghostCount );
}
printf( "%10s", cell );
totalGhosts += c->ghostCount;
grewCount += c->baseGhostCount >= 0 && c->ghostCount > c->baseGhostCount;
shrankCount += c->baseGhostCount >= 0 && c->ghostCount < c->baseGhostCount;
missingCount += c->baseGhostCount < 0;
fewerRunsCount += c->baseRunCount >= 0 && c->runCount < c->baseRunCount;
}
printf( "\n\ntotal ghosts %d, time %.1f s\n", totalGhosts, seconds );
for ( int i = 0; i < configCount && fewerRunsCount > 0; ++i )
{
const Config* c = configs + i;
if ( c->baseRunCount >= 0 && c->runCount < c->baseRunCount )
{
char row[64];
FormatRow( row, sizeof( row ), c );
printf( "fewer runs: %s %s %d>%d\n", row, s_bodyKeys[c->body], c->baseRunCount, c->runCount );
}
}
if ( writePath != NULL && WriteResults( writePath, configs, configCount ) == false )
{
return 2;
}
if ( comparePath != NULL )
{
bool pass = grewCount == 0 && missingCount == 0 && fewerRunsCount == 0;
printf( "compared with %s: %d grew, %d shrank, %d missing, %d with fewer runs\n", comparePath, grewCount, shrankCount,
missingCount, fewerRunsCount );
printf( pass ? "PASS\n" : "FAIL\n" );
return pass ? 0 : 1;
}
return 0;
}

View file

@ -0,0 +1,5 @@
threads,ms
1,15032.6
2,7877.68
3,5546.68
4,4296.53
1 threads ms
2 1 15032.6
3 2 7877.68
4 3 5546.68
5 4 4296.53

View file

@ -0,0 +1,5 @@
threads,ms
1,1089.82
2,569.935
3,399.883
4,309.318
1 threads ms
2 1 1089.82
3 2 569.935
4 3 399.883
5 4 309.318

View file

@ -0,0 +1,5 @@
threads,ms
1,13501.4
2,7288.19
3,5229.53
4,4253.67
1 threads ms
2 1 13501.4
3 2 7288.19
4 3 5229.53
5 4 4253.67

View file

@ -0,0 +1,5 @@
threads,ms
1,1810.73
2,976.492
3,687.311
4,563.518
1 threads ms
2 1 1810.73
3 2 976.492
4 3 687.311
5 4 563.518

View file

@ -0,0 +1,5 @@
threads,ms
1,8.9855
2,10.7568
3,14.1527
4,14.9816
1 threads ms
2 1 8.9855
3 2 10.7568
4 3 14.1527
5 4 14.9816

View file

@ -0,0 +1,5 @@
threads,ms
1,1917.44
2,1025.05
3,727.266
4,621.283
1 threads ms
2 1 1917.44
3 2 1025.05
4 3 727.266
5 4 621.283

View file

@ -0,0 +1,5 @@
threads,ms
1,1954.85
2,1079.88
3,789.64
4,626.161
1 threads ms
2 1 1954.85
3 2 1079.88
4 3 789.64
5 4 626.161

View file

@ -0,0 +1,5 @@
threads,ms
1,186.082
2,119.994
3,103.081
4,91.2481
1 threads ms
2 1 186.082
3 2 119.994
4 3 103.081
5 4 91.2481

View file

@ -0,0 +1,5 @@
threads,ms
1,609.865
2,348.635
3,272.314
4,236.167
1 threads ms
2 1 609.865
3 2 348.635
4 3 272.314
5 4 236.167

View file

@ -0,0 +1,5 @@
threads,ms
1,288.292
2,184.331
3,144.592
4,156.867
1 threads ms
2 1 288.292
3 2 184.331
4 3 144.592
5 4 156.867

View file

@ -0,0 +1,5 @@
threads,ms
1,21065.2
2,11419.4
3,8383.39
4,7675.16
1 threads ms
2 1 21065.2
3 2 11419.4
4 3 8383.39
5 4 7675.16

View file

@ -6,13 +6,19 @@
#endif
#include "benchmarks.h"
#include "mesh_benchmark.h"
#include "utils.h"
#ifdef BOX3D_INTERNAL_BENCHMARKS
#include "sat_benchmark.h"
#endif
#include "box3d/box3d.h"
#include "box3d/constants.h"
#include "box3d/math_functions.h"
#include <assert.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@ -51,6 +57,139 @@ static void MinProfile( b3Profile* p1, const b3Profile* p2 )
p1->sleepIslands = b3MinFloat( p1->sleepIslands, p2->sleepIslands );
}
// Match a name=value option in either its short or long spelling. Returns the value or NULL.
static const char* MatchValue( const char* arg, const char* shortName, const char* longName )
{
size_t n = strlen( shortName );
if ( strncmp( arg, shortName, n ) == 0 )
{
return arg + n;
}
n = strlen( longName );
if ( strncmp( arg, longName, n ) == 0 )
{
return arg + n;
}
return NULL;
}
// Distinguish a numeric benchmark index from a name. Empty string is not numeric.
static bool IsAllDigits( const char* s )
{
if ( *s == 0 )
{
return false;
}
for ( ; *s != 0; ++s )
{
if ( isdigit( (unsigned char)*s ) == 0 )
{
return false;
}
}
return true;
}
static bool EqualsIgnoreCase( const char* a, const char* b )
{
while ( *a != 0 && *b != 0 )
{
if ( tolower( (unsigned char)*a ) != tolower( (unsigned char)*b ) )
{
return false;
}
++a;
++b;
}
return *a == *b;
}
static int FindBenchmark( const Benchmark* benchmarks, int count, const char* name )
{
for ( int i = 0; i < count; ++i )
{
if ( EqualsIgnoreCase( benchmarks[i].name, name ) )
{
return i;
}
}
return -1;
}
#ifdef BOX3D_INTERNAL_BENCHMARKS
// GJK versus SAT on hull pairs held inside the speculative margin. Reports the min time per query over the runs.
static void RunSatBenchmarks( int runCount )
{
#ifdef NDEBUG
int repeatCount = 20;
#else
int repeatCount = 1;
#endif
printf( "benchmark: sat, pairs = %d, repeats = %d, simd width = %d\n", SAT_PAIR_COUNT, repeatCount, GetSimdWidth() );
printf( "time per query (us), sat full has the inscribed sphere bound disabled\n" );
printf( "%-20s %10s %10s %10s %10s\n", "pair", "gjk cold", "gjk warm", "sat", "sat full" );
for ( int typeA = 0; typeA < satHull_count; ++typeA )
{
for ( int typeB = typeA; typeB < satHull_count; ++typeB )
{
SatBenchmarkData* data = CreateSatBenchmark( (SatHullType)typeA, (SatHullType)typeB );
float coldMs = FLT_MAX;
float warmMs = FLT_MAX;
float satMs = FLT_MAX;
float fullMs = FLT_MAX;
int queryCount = 0;
int earlyReturnCount = 0;
for ( int runIndex = 0; runIndex < runCount; ++runIndex )
{
EnableSatInscribedSphere( data, true );
SatBenchmarkResult cold = RunSatBenchmark( data, repeatCount, false );
SatBenchmarkResult warm = RunSatBenchmark( data, repeatCount, true );
EnableSatInscribedSphere( data, false );
SatBenchmarkResult full = RunSatBenchmark( data, repeatCount, false );
coldMs = b3MinFloat( coldMs, cold.distanceMs );
warmMs = b3MinFloat( warmMs, warm.distanceMs );
satMs = b3MinFloat( satMs, b3MinFloat( cold.satMs, warm.satMs ) );
fullMs = b3MinFloat( fullMs, full.satMs );
queryCount = cold.queryCount;
earlyReturnCount += cold.earlyReturnCount + full.earlyReturnCount;
}
char name[32];
snprintf( name, sizeof( name ), "%s/%s", GetSatHullName( (SatHullType)typeA ), GetSatHullName( (SatHullType)typeB ) );
float scale = 1000.0f / queryCount;
printf( "%-20s %10.3f %10.3f %10.3f %10.3f\n", name, scale * coldMs, scale * warmMs, scale * satMs,
scale * fullMs );
if ( earlyReturnCount > 0 || data->maxPlacementError > 0.01f * data->targetDistance )
{
printf( " warning: early returns = %d, max placement error = %g\n", earlyReturnCount,
data->maxPlacementError );
}
DestroySatBenchmark( data );
}
}
printf( "\n" );
}
#endif
static void PrintBenchmarks( const Benchmark* benchmarks, int count )
{
printf( "Registered benchmarks:\n" );
for ( int i = 0; i < count; ++i )
{
printf( " %2d %s\n", i, benchmarks[i].name );
}
}
// Box3D benchmark application. On Windows it is important to use affinity avoid cross CCD
// usage or efficiency cores. Also on Windows create a power plan with Processor power management
// Min/Max of 99%. This prevents boosting and makes the benchmarks more repeatable.
@ -62,7 +201,11 @@ static void MinProfile( b3Profile* p1, const b3Profile* p2 )
// Run all benchmarks with 4 workers only.
// start /affinity 0x5555 .\build\bin\Release\benchmark.exe -t=4 -w=4
// start /affinity 0x5555 .\build\bin\Release\benchmark.exe -t=4 -w=4 -b=5 -r=5
// List the registered benchmarks.
// .\build\bin\Release\benchmark.exe -l
// Run a single benchmark by name with 4 workers.
// start /affinity 0x5555 .\build\bin\Release\benchmark.exe -t=4 -w=4 --benchmark=many_pyramids -r=5
// Run benchmark 3 with 4 workers and repeat 20 times. Record the step times.
// start /affinity 0x5555 .\build\bin\Release\benchmark.exe -t=4 -w=4 -b=3 -r=20 -s
@ -70,6 +213,12 @@ static void MinProfile( b3Profile* p1, const b3Profile* p2 )
// Run benchmark 3 with 4 workers and run once. Disable continuous collision. Record the step times.
// start /affinity 0x5555 .\build\bin\Release\benchmark.exe -t=4 -w=4 -b=3 -r=1 -nc -s
// Compare GJK and SAT on hull pairs in the speculative regime. Static Box3D only.
// start /affinity 0x5555 .\build\bin\Release\benchmark.exe --sat -r=5
// Time mesh creation.
// start /affinity 0x5555 .\build\bin\Release\benchmark.exe --mesh -r=5
int main( int argc, char** argv )
{
#ifdef TRACY_ENABLE
@ -77,18 +226,25 @@ int main( int argc, char** argv )
#endif
Benchmark benchmarks[] = {
{ "convex_pile", GetConvexPileCapacity, CreateConvexPile, NULL, NULL, 500 },
{ "joint_grid", NULL, CreateJointGrid, NULL, NULL, 100 },
{ "junkyard", GetJunkyardCapacity, CreateJunkyard, NULL, StepJunkyard, 500 },
{ "large_pyramid", NULL, CreateLargePyramid, NULL, NULL, 200 },
{ "large_world", GetLargeWorldCapacity, CreateLargeWorld, NULL, StepLargeWorld, 500 },
{ "many_pyramids", NULL, CreateManyPyramids, NULL, NULL, 100 },
{ "mesh_drop", NULL, CreateMeshDropBenchmark, DestroyMeshDropBenchmark, NULL, 170 },
{ "rain", GetRainCapacity, CreateRain, DestroyRain, StepRain, 400 },
{ "sleep", GetSleepCapacity, CreateSleep, NULL, StepSleep, 300 },
{ "spinner", GetSpinnerCapacity, CreateSpinner, DestroySpinner, NULL, 800 },
{ "trees100", NULL, CreateTrees100, DestroyTrees, NULL, 500 },
{ "trees50", NULL, CreateTrees50, DestroyTrees, NULL, 500 },
{ "trees25", NULL, CreateTrees25, DestroyTrees, NULL, 500 },
{ "joint_grid", NULL, CreateJointGrid, NULL, NULL, 100 },
{ "junkyard", NULL, CreateJunkyard, NULL, StepJunkyard, 500 },
{ "large_pyramid", NULL, CreateLargePyramid, NULL, NULL, 200 },
{ "many_pyramids", NULL, CreateManyPyramids, NULL, NULL, 100 },
{ "rain", GetRainCapacity, CreateRain, DestroyRain, StepRain, 400 },
{ "trees100hf", NULL, CreateTrees100HeightField, DestroyTrees, NULL, 500 },
{ "trees50hf", NULL, CreateTrees50HeightField, DestroyTrees, NULL, 500 },
{ "trees25hf", NULL, CreateTrees25HeightField, DestroyTrees, NULL, 500 },
{ "village", GetVillageCapacity, CreateVillage, DestroyVillage, StepVillage, VILLAGE_STEP_COUNT },
{ "washer", GetWasherCapacity, CreateWasher, NULL, NULL, 1000 },
{ "large_world", GetLargeWorldCapacity, CreateLargeWorld, NULL, StepLargeWorld, 500 },
//{ "smash", CreateSmash, NULL, 300 },
//{ "spinner", CreateSpinner, StepSpinner, 1400 },
//{ "tumbler", CreateTumbler, NULL, 750 },
};
@ -113,7 +269,7 @@ int main( int argc, char** argv )
.solveImpulses = FLT_MAX,
.integratePositions = FLT_MAX,
.relaxImpulses = FLT_MAX,
.applyRestitution = FLT_MAX,
.restitution = FLT_MAX,
.storeImpulses = FLT_MAX,
.splitIslands = FLT_MAX,
.transforms = FLT_MAX,
@ -136,49 +292,114 @@ int main( int argc, char** argv )
b3Counters counters = { 0 };
bool enableContinuous = true;
bool recordStepTimes = false;
bool runSat = false;
bool runMesh = false;
const char* meshCase = NULL;
int simdWidth = 0;
assert( maxThreadCount <= B3_MAX_WORKERS );
for ( int i = 1; i < argc; ++i )
{
const char* arg = argv[i];
if ( strncmp( arg, "-t=", 3 ) == 0 )
const char* value;
if ( ( value = MatchValue( arg, "-t=", "--threads=" ) ) != NULL )
{
int threadCount = atoi( arg + 3 );
int threadCount = atoi( value );
maxThreadCount = b3ClampInt( threadCount, 1, maxThreadCount );
}
else if ( strncmp( arg, "-b=", 3 ) == 0 )
else if ( ( value = MatchValue( arg, "-b=", "--benchmark=" ) ) != NULL )
{
singleBenchmark = atoi( arg + 3 );
singleBenchmark = b3ClampInt( singleBenchmark, 0, benchmarkCount - 1 );
// Accept an index for backward compatibility, otherwise an exact name
if ( IsAllDigits( value ) )
{
singleBenchmark = b3ClampInt( atoi( value ), 0, benchmarkCount - 1 );
}
else
{
singleBenchmark = FindBenchmark( benchmarks, benchmarkCount, value );
if ( singleBenchmark == -1 )
{
printf( "No benchmark named \"%s\"\n", value );
PrintBenchmarks( benchmarks, benchmarkCount );
exit( 1 );
}
}
}
else if ( strncmp( arg, "-w=", 3 ) == 0 )
else if ( ( value = MatchValue( arg, "-w=", "--workers=" ) ) != NULL )
{
singleWorkerCount = atoi( arg + 3 );
singleWorkerCount = atoi( value );
}
else if ( strncmp( arg, "-r=", 3 ) == 0 )
else if ( ( value = MatchValue( arg, "-r=", "--repeats=" ) ) != NULL )
{
runCount = b3ClampInt( atoi( arg + 3 ), 1, 1000 );
runCount = b3ClampInt( atoi( value ), 1, 1000 );
}
else if ( strncmp( arg, "-nc", 3 ) == 0 )
else if ( strcmp( arg, "-nc" ) == 0 || strcmp( arg, "--no-continuous" ) == 0 )
{
enableContinuous = false;
printf( "Continuous disabled\n" );
}
else if ( strncmp( arg, "-s", 3 ) == 0 )
else if ( strcmp( arg, "-s" ) == 0 || strcmp( arg, "--record-steps" ) == 0 )
{
recordStepTimes = true;
}
else if ( strcmp( arg, "-h" ) == 0 )
else if ( strcmp( arg, "-sat" ) == 0 || strcmp( arg, "--sat" ) == 0 )
{
#ifdef BOX3D_INTERNAL_BENCHMARKS
runSat = true;
#else
printf( "The SAT benchmark requires static linkage\n" );
exit( 1 );
#endif
}
else if ( ( value = MatchValue( arg, "-mesh=", "--mesh=" ) ) != NULL )
{
runMesh = true;
meshCase = value;
}
else if ( strcmp( arg, "-mesh" ) == 0 || strcmp( arg, "--mesh" ) == 0 )
{
runMesh = true;
}
else if ( ( value = MatchValue( arg, "-simd=", "--simd-width=" ) ) != NULL )
{
simdWidth = atoi( value );
if ( simdWidth != 4 && simdWidth != 8 )
{
printf( "The SIMD width must be 4 or 8\n" );
exit( 1 );
}
#ifndef BOX3D_INTERNAL_BENCHMARKS
printf( "Forcing the SIMD width requires static linkage\n" );
exit( 1 );
#endif
}
else if ( strcmp( arg, "-l" ) == 0 || strcmp( arg, "--list" ) == 0 )
{
PrintBenchmarks( benchmarks, benchmarkCount );
exit( 0 );
}
else if ( strcmp( arg, "-h" ) == 0 || strcmp( arg, "--help" ) == 0 )
{
printf( "Usage\n"
"-t=<integer>: the maximum number of threads to use\n"
"-b=<integer>: run a single benchmark\n"
"-w=<integer>: run a single worker count\n"
"-r=<integer>: number of repeats (default is 4)\n"
"-s: record step times\n" );
"-t, --threads=<integer>: the maximum number of threads to use\n"
"-b, --benchmark=<index|name>: run a single benchmark by index or name\n"
"-w, --workers=<integer>: run a single worker count\n"
"-r, --repeats=<integer>: number of repeats (default is 4)\n"
"-nc, --no-continuous: disable continuous collision\n"
"-s, --record-steps: record step times\n"
"-sat, --sat: compare GJK and SAT on hull pairs, then exit\n"
"-mesh, --mesh[=<case>]: time b3CreateMesh on several meshes, or one case, then exit\n"
"-simd, --simd-width=<4|8>: force the SIMD width (static Box3D only)\n"
"-l, --list: list the registered benchmarks\n"
"-h, --help: print this help\n" );
exit( 0 );
}
else
{
printf( "Unknown option \"%s\", use -h for help\n", arg );
}
}
if ( singleWorkerCount != -1 )
@ -186,8 +407,32 @@ int main( int argc, char** argv )
singleWorkerCount = b3ClampInt( singleWorkerCount, 1, maxThreadCount );
}
#ifdef BOX3D_INTERNAL_BENCHMARKS
if ( simdWidth != 0 )
{
SetSimdWidth( simdWidth );
}
if ( runSat )
{
RunSatBenchmarks( runCount );
free( profiles );
return 0;
}
#endif
if ( runMesh )
{
RunMeshBenchmarks( runCount, meshCase );
free( profiles );
return 0;
}
printf( "Starting benchmarks\n" );
printf( "======================================\n" );
#ifdef BOX3D_INTERNAL_BENCHMARKS
printf( "simd width = %d\n", GetSimdWidth() );
#endif
for ( int benchmarkIndex = 0; benchmarkIndex < benchmarkCount; ++benchmarkIndex )
{

233
benchmark/mesh_benchmark.c Normal file
View file

@ -0,0 +1,233 @@
// SPDX-FileCopyrightText: 2025 Erin Catto
// SPDX-License-Identifier: MIT
#include "mesh_benchmark.h"
#include "box3d/box3d.h"
#include "box3d/collision.h"
#include "box3d/math_functions.h"
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum MeshShape
{
meshShape_wave,
meshShape_torus,
meshShape_soup,
} MeshShape;
typedef struct MeshCase
{
const char* name;
MeshShape shape;
int countA;
int countB;
bool useMedianSplit;
bool identifyEdges;
bool weldVertices;
} MeshCase;
typedef struct MeshSource
{
b3Vec3* vertices;
int32_t* indices;
int vertexCount;
int triangleCount;
} MeshSource;
static float WaveHeight( int i, int j )
{
return 0.5f * sinf( 0.31f * (float)i ) * cosf( 0.23f * (float)j ) + 0.25f * sinf( 0.07f * (float)( i + 2 * j ) );
}
// Shared-vertex grid, or a triangle soup with three vertices per triangle when unshared is set
static MeshSource MakeWave( int xCount, int zCount, bool unshared )
{
float cellWidth = 0.5f;
MeshSource source = { 0 };
source.triangleCount = 2 * xCount * zCount;
source.indices = malloc( 3 * source.triangleCount * sizeof( int32_t ) );
if ( unshared == false )
{
source.vertexCount = ( xCount + 1 ) * ( zCount + 1 );
source.vertices = malloc( source.vertexCount * sizeof( b3Vec3 ) );
for ( int i = 0; i <= xCount; ++i )
{
for ( int j = 0; j <= zCount; ++j )
{
source.vertices[i * ( zCount + 1 ) + j] = (b3Vec3){ cellWidth * i, WaveHeight( i, j ), cellWidth * j };
}
}
int index = 0;
for ( int i = 0; i < xCount; ++i )
{
for ( int j = 0; j < zCount; ++j )
{
int a = i * ( zCount + 1 ) + j;
int b = a + 1;
int c = a + ( zCount + 1 ) + 1;
int d = a + ( zCount + 1 );
source.indices[index++] = a;
source.indices[index++] = b;
source.indices[index++] = c;
source.indices[index++] = a;
source.indices[index++] = c;
source.indices[index++] = d;
}
}
}
else
{
source.vertexCount = 3 * source.triangleCount;
source.vertices = malloc( source.vertexCount * sizeof( b3Vec3 ) );
int index = 0;
for ( int i = 0; i < xCount; ++i )
{
for ( int j = 0; j < zCount; ++j )
{
b3Vec3 a = { cellWidth * i, WaveHeight( i, j ), cellWidth * j };
b3Vec3 b = { cellWidth * i, WaveHeight( i, j + 1 ), cellWidth * ( j + 1 ) };
b3Vec3 c = { cellWidth * ( i + 1 ), WaveHeight( i + 1, j + 1 ), cellWidth * ( j + 1 ) };
b3Vec3 d = { cellWidth * ( i + 1 ), WaveHeight( i + 1, j ), cellWidth * j };
b3Vec3 tris[6] = { a, b, c, a, c, d };
for ( int k = 0; k < 6; ++k )
{
source.vertices[index] = tris[k];
source.indices[index] = index;
index += 1;
}
}
}
}
return source;
}
static MeshSource MakeTorus( int radialCount, int tubularCount )
{
float radius = 8.0f;
float thickness = 2.0f;
MeshSource source = { 0 };
source.vertexCount = radialCount * tubularCount;
source.triangleCount = 2 * radialCount * tubularCount;
source.vertices = malloc( source.vertexCount * sizeof( b3Vec3 ) );
source.indices = malloc( 3 * source.triangleCount * sizeof( int32_t ) );
for ( int i = 0; i < radialCount; ++i )
{
float u = 2.0f * B3_PI * i / radialCount;
for ( int j = 0; j < tubularCount; ++j )
{
float v = 2.0f * B3_PI * j / tubularCount;
float r = radius + thickness * cosf( v );
source.vertices[i * tubularCount + j] = (b3Vec3){ r * cosf( u ), thickness * sinf( v ), r * sinf( u ) };
}
}
int index = 0;
for ( int i = 0; i < radialCount; ++i )
{
int i2 = ( i + 1 ) % radialCount;
for ( int j = 0; j < tubularCount; ++j )
{
int j2 = ( j + 1 ) % tubularCount;
int a = i * tubularCount + j;
int b = i2 * tubularCount + j;
int c = i2 * tubularCount + j2;
int d = i * tubularCount + j2;
source.indices[index++] = a;
source.indices[index++] = c;
source.indices[index++] = b;
source.indices[index++] = a;
source.indices[index++] = d;
source.indices[index++] = c;
}
}
return source;
}
void RunMeshBenchmarks( int runCount, const char* caseName )
{
MeshCase cases[] = {
{ "wave_64", meshShape_wave, 64, 64, true, true, false },
{ "wave_128", meshShape_wave, 128, 128, true, true, false },
{ "wave_256", meshShape_wave, 256, 256, true, true, false },
{ "wave_128_no_edges", meshShape_wave, 128, 128, true, false, false },
{ "wave_128_sah", meshShape_wave, 128, 128, false, true, false },
{ "torus_128x64", meshShape_torus, 128, 64, false, true, false },
{ "soup_128_weld", meshShape_soup, 128, 128, true, true, true },
};
int caseCount = sizeof( cases ) / sizeof( cases[0] );
#ifdef NDEBUG
int targetTriangles = 1 << 20;
#else
int targetTriangles = 1 << 14;
#endif
printf( "benchmark: mesh creation, runs = %d\n", runCount );
printf( "%-20s %10s %8s %12s %12s\n", "case", "triangles", "builds", "ms / build", "ns / tri" );
for ( int caseIndex = 0; caseIndex < caseCount; ++caseIndex )
{
const MeshCase* mc = cases + caseIndex;
if ( caseName != NULL && strcmp( caseName, mc->name ) != 0 )
{
continue;
}
MeshSource source;
if ( mc->shape == meshShape_torus )
{
source = MakeTorus( mc->countA, mc->countB );
}
else
{
source = MakeWave( mc->countA, mc->countB, mc->shape == meshShape_soup );
}
b3MeshDef def = { 0 };
def.vertices = source.vertices;
def.vertexCount = source.vertexCount;
def.indices = source.indices;
def.triangleCount = source.triangleCount;
def.useMedianSplit = mc->useMedianSplit;
def.identifyEdges = mc->identifyEdges;
def.weldVertices = mc->weldVertices;
def.weldTolerance = mc->weldVertices ? 0.001f : 0.0f;
int buildCount = targetTriangles / source.triangleCount;
if ( buildCount < 1 )
{
buildCount = 1;
}
float bestMs = FLT_MAX;
for ( int runIndex = 0; runIndex < runCount; ++runIndex )
{
uint64_t ticks = b3GetTicks();
for ( int buildIndex = 0; buildIndex < buildCount; ++buildIndex )
{
b3MeshData* mesh = b3CreateMesh( &def, NULL, 0 );
b3DestroyMesh( mesh );
}
float ms = b3GetMilliseconds( ticks ) / buildCount;
bestMs = b3MinFloat( bestMs, ms );
}
float nsPerTriangle = 1.0e6f * bestMs / source.triangleCount;
printf( "%-20s %10d %8d %12.3f %12.1f\n", mc->name, source.triangleCount, buildCount, bestMs, nsPerTriangle );
free( source.vertices );
free( source.indices );
}
printf( "\n" );
}

View file

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2025 Erin Catto
// SPDX-License-Identifier: MIT
#pragma once
void RunMeshBenchmarks( int runCount, const char* caseName );

730
benchmark/mesh_soak.c Normal file
View file

@ -0,0 +1,730 @@
// SPDX-FileCopyrightText: 2026 Erin Catto
// SPDX-License-Identifier: MIT
// Headless soak of the Continuous / Mesh Drop sample. Each generation drops 1024 small bodies on a
// wave mesh and steps until every body sleeps. A generation fails if a body falls through the mesh
// or the pile is still awake at the step limit. Tunnels are rare, so the soak also counts bodies that
// sink into the wave past a few depth levels and can compare those counts against a baseline.
// Generations run in parallel, one single threaded world per thread. The printed seed reproduces a
// generation in the sample. The rough wave has bumps smaller than the bodies, so mesh contacts reach
// the manifold cap. It is far slower per generation, so run it with fewer of them.
#define _CRT_SECURE_NO_WARNINGS
#include "core.h"
#include "mesh_drop.h"
#include "box3d/box3d.h"
#include "box3d/collision.h"
#include "box3d/math_functions.h"
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_REPORTED_FAILURES 32
#define MAX_THREADS 64
typedef enum FailureKind
{
e_tunnel,
e_awake,
} FailureKind;
typedef struct Failure
{
FailureKind kind;
MeshDropShape shape;
int generation;
uint32_t seed;
int step;
int index;
b3Pos position;
} Failure;
typedef struct ShapeStats
{
int generationCount;
int tunnelCount;
int awakeCount;
int depthCounts[MESH_DROP_DEPTH_LEVEL_COUNT];
float maxDepth;
uint32_t maxSeed;
int maxGeneration;
int maxIndex;
int maxStep;
} ShapeStats;
typedef struct Soak
{
b3Mutex* mutex;
b3MeshData* groundMesh;
b3HullData* cylinder;
MeshDropSettings settings;
uint32_t baseSeed;
int generationCount;
int nextGeneration;
// -1 rotates through the shapes
int shapeFilter;
bool fixedSeed;
bool recycling;
int completedCount;
int failureCount;
int64_t totalSteps;
int maxSteps;
// Mesh contact updates by manifold count, rough wave only
int64_t manifoldCounts[B3_MAX_MANIFOLDS];
ShapeStats stats[e_meshDropShapeCount];
Failure failures[MAX_REPORTED_FAILURES];
} Soak;
static void RecordFailure( Soak* soak, const Failure* failure )
{
b3LockMutex( soak->mutex );
if ( soak->failureCount < MAX_REPORTED_FAILURES )
{
soak->failures[soak->failureCount] = *failure;
}
soak->failureCount += 1;
b3UnlockMutex( soak->mutex );
const char* kind = failure->kind == e_tunnel ? "TUNNEL" : "AWAKE";
printf( "%s: generation %d, %s, seed %u, step %d, body (%d, %d) at (%.2f, %.2f, %.2f)\n", kind, failure->generation,
g_meshDropShapeNames[failure->shape], failure->seed, failure->step, failure->index / MESH_DROP_GRID_COUNT,
failure->index % MESH_DROP_GRID_COUNT, (float)failure->position.x, (float)failure->position.y,
(float)failure->position.z );
}
// Mirrors MeshDrop::Generate and the auto generate step loop. Returns the step count.
static int RunGeneration( Soak* soak, int generation, uint32_t seed, MeshDropShape shape, b3BodyId* bodies,
MeshDropDepth* depth, int* failureKind, int64_t* manifoldCounts )
{
b3WorldDef worldDef = b3DefaultWorldDef();
worldDef.workerCount = 1;
// The world registry is global and not thread safe
b3LockMutex( soak->mutex );
b3WorldId worldId = b3CreateWorld( &worldDef );
b3UnlockMutex( soak->mutex );
if ( soak->recycling == false )
{
b3World_SetContactRecycleDistance( worldId, 0.0f );
}
CreateMeshDropGround( worldId, soak->groundMesh, soak->settings );
MeshDropSettings settings = soak->settings;
settings.shape = shape;
CreateMeshDropBodies( worldId, settings, seed, soak->cylinder, bodies );
ResetMeshDropDepth( depth, settings, soak->cylinder );
float timeStep = 1.0f / 60.0f;
int subStepCount = 4;
int maxSteps = GetMeshDropStepLimit( shape );
float tunnelHeight = GetMeshDropTunnelHeight();
int step = 0;
bool failed = false;
while ( failed == false )
{
b3World_Step( worldId, timeStep, subStepCount );
UpdateMeshDropDepth( worldId, depth );
step += 1;
// Counters walk the world, so only pay for them where the cap matters
if ( soak->settings.rough )
{
b3Counters counters = b3World_GetCounters( worldId );
for ( int i = 0; i < B3_MAX_MANIFOLDS; ++i )
{
manifoldCounts[i] += counters.manifoldCounts[i];
}
}
for ( int i = 0; i < MESH_DROP_BODY_COUNT; ++i )
{
b3Pos center = b3Body_GetWorldCenter( bodies[i] );
if ( center.y < tunnelHeight )
{
Failure failure = { e_tunnel, shape, generation, seed, step, i, center };
RecordFailure( soak, &failure );
*failureKind = e_tunnel;
failed = true;
break;
}
}
if ( b3World_GetBodyEvents( worldId ).moveCount == 0 )
{
break;
}
if ( failed == false && step > maxSteps )
{
int awakeIndex = 0;
for ( int i = 0; i < MESH_DROP_BODY_COUNT; ++i )
{
if ( b3Body_IsAwake( bodies[i] ) )
{
awakeIndex = i;
break;
}
}
b3Pos center = b3Body_GetWorldCenter( bodies[awakeIndex] );
Failure failure = { e_awake, shape, generation, seed, step, awakeIndex, center };
RecordFailure( soak, &failure );
*failureKind = e_awake;
failed = true;
}
}
b3LockMutex( soak->mutex );
b3DestroyWorld( worldId );
b3UnlockMutex( soak->mutex );
return step;
}
static void SoakWorker( void* context )
{
Soak* soak = context;
b3BodyId* bodies = malloc( MESH_DROP_BODY_COUNT * sizeof( b3BodyId ) );
MeshDropDepth* depth = malloc( sizeof( MeshDropDepth ) );
while ( true )
{
b3LockMutex( soak->mutex );
int generation = soak->nextGeneration;
soak->nextGeneration += 1;
b3UnlockMutex( soak->mutex );
if ( generation >= soak->generationCount )
{
break;
}
uint32_t seed = soak->fixedSeed ? soak->baseSeed : GetMeshDropSeed( soak->baseSeed, generation );
MeshDropShape shape =
soak->shapeFilter >= 0 ? (MeshDropShape)soak->shapeFilter : (MeshDropShape)( generation % e_meshDropShapeCount );
int failureKind = -1;
int64_t manifoldCounts[B3_MAX_MANIFOLDS] = { 0 };
int steps = RunGeneration( soak, generation, seed, shape, bodies, depth, &failureKind, manifoldCounts );
int depthCounts[MESH_DROP_DEPTH_LEVEL_COUNT];
GetMeshDropDepthCounts( depth, depthCounts );
b3LockMutex( soak->mutex );
soak->completedCount += 1;
soak->totalSteps += steps;
soak->maxSteps = b3MaxInt( soak->maxSteps, steps );
for ( int i = 0; i < B3_MAX_MANIFOLDS; ++i )
{
soak->manifoldCounts[i] += manifoldCounts[i];
}
ShapeStats* stats = soak->stats + shape;
stats->generationCount += 1;
stats->tunnelCount += failureKind == e_tunnel ? 1 : 0;
stats->awakeCount += failureKind == e_awake ? 1 : 0;
for ( int i = 0; i < MESH_DROP_DEPTH_LEVEL_COUNT; ++i )
{
stats->depthCounts[i] += depthCounts[i];
}
// Ties go to the earlier generation so the report does not depend on thread timing
if ( depth->maxDepth > stats->maxDepth ||
( depth->maxDepth == stats->maxDepth && generation < stats->maxGeneration ) )
{
stats->maxDepth = depth->maxDepth;
stats->maxSeed = seed;
stats->maxGeneration = generation;
stats->maxIndex = depth->maxIndex;
stats->maxStep = depth->maxStep;
}
int completed = soak->completedCount;
b3UnlockMutex( soak->mutex );
if ( completed % b3MaxInt( 100, soak->generationCount / 10 ) == 0 )
{
printf( "%d generations, %d bodies\n", completed, completed * MESH_DROP_BODY_COUNT );
fflush( stdout );
}
}
free( depth );
free( bodies );
}
// The rough wave gets its own names so its baseline rows never match a run on the broad wave
static const char* GetFilterName( int shapeFilter, bool rough )
{
static const char* roughNames[e_meshDropShapeCount] = { "rough_box", "rough_capsule", "rough_cylinder", "rough_sphere" };
if ( shapeFilter < 0 )
{
return rough ? "rough_all" : "all";
}
return rough ? roughNames[shapeFilter] : g_meshDropShapeNames[shapeFilter];
}
// A baseline row starts with the run that made it, so one file can hold several runs
static void GetBaselineKey( const Soak* soak, char* key, int size )
{
snprintf( key, size, "%s,%u,%d,", GetFilterName( soak->shapeFilter, soak->settings.rough ), soak->baseSeed,
soak->generationCount );
}
// Replaces the rows of this run and keeps the rest
static void WriteBaseline( const Soak* soak, const char* path )
{
char key[64];
GetBaselineKey( soak, key, sizeof( key ) );
size_t keyLength = strlen( key );
// Read the whole file so neither a row count nor a row length can drop a row
char* text = NULL;
FILE* file = fopen( path, "rb" );
if ( file != NULL )
{
fseek( file, 0, SEEK_END );
long textLength = ftell( file );
fseek( file, 0, SEEK_SET );
text = malloc( textLength + 1 );
textLength = (long)fread( text, 1, textLength, file );
text[textLength] = '\0';
fclose( file );
}
file = fopen( path, "w" );
if ( file == NULL )
{
printf( "cannot write %s\n", path );
free( text );
return;
}
fprintf( file, "filter,base,generations,shape,tunnels,awake" );
for ( int i = 0; i < MESH_DROP_DEPTH_LEVEL_COUNT; ++i )
{
fprintf( file, ",depth%g", g_meshDropDepthLevels[i] );
}
fprintf( file, "\n" );
if ( text != NULL )
{
bool header = true;
char* line = text;
while ( *line != '\0' )
{
char* next = strchr( line, '\n' );
size_t lineLength = next != NULL ? (size_t)( next - line ) : strlen( line );
if ( lineLength > 0 && line[lineLength - 1] == '\r' )
{
lineLength -= 1;
}
if ( header == false && lineLength > 0 && strncmp( line, key, keyLength ) != 0 )
{
fprintf( file, "%.*s\n", (int)lineLength, line );
}
header = false;
line = next != NULL ? next + 1 : line + strlen( line );
}
free( text );
}
for ( int shape = 0; shape < e_meshDropShapeCount; ++shape )
{
const ShapeStats* stats = soak->stats + shape;
if ( stats->generationCount == 0 )
{
continue;
}
fprintf( file, "%s,%u,%d,%s,%d,%d", GetFilterName( soak->shapeFilter, soak->settings.rough ), soak->baseSeed,
soak->generationCount, g_meshDropShapeNames[shape], stats->tunnelCount, stats->awakeCount );
for ( int i = 0; i < MESH_DROP_DEPTH_LEVEL_COUNT; ++i )
{
fprintf( file, ",%d", stats->depthCounts[i] );
}
fprintf( file, "\n" );
}
fclose( file );
printf( "wrote %s\n", path );
}
// Returns 0 when no count grew past its noise band, 1 when one did, 2 when the baseline has no rows for this run
static int CompareBaseline( const Soak* soak, const char* path )
{
FILE* file = fopen( path, "r" );
if ( file == NULL )
{
printf( "cannot read %s\n", path );
return 2;
}
char line[512];
if ( fgets( line, sizeof( line ), file ) == NULL )
{
fclose( file );
printf( "empty baseline %s\n", path );
return 2;
}
int result = 0;
int changedCount = 0;
int matchedCount = 0;
while ( fgets( line, sizeof( line ), file ) != NULL )
{
char filter[32];
char shapeName[32];
unsigned int base;
int generations;
int counts[2 + MESH_DROP_DEPTH_LEVEL_COUNT];
_Static_assert( MESH_DROP_DEPTH_LEVEL_COUNT == 4, "update the baseline row format" );
int fieldCount = sscanf( line, "%31[^,],%u,%d,%31[^,],%d,%d,%d,%d,%d,%d", filter, &base, &generations, shapeName,
counts + 0, counts + 1, counts + 2, counts + 3, counts + 4, counts + 5 );
if ( fieldCount != 10 )
{
continue;
}
if ( strcmp( filter, GetFilterName( soak->shapeFilter, soak->settings.rough ) ) != 0 || base != soak->baseSeed ||
generations != soak->generationCount )
{
continue;
}
int shape = -1;
for ( int i = 0; i < e_meshDropShapeCount; ++i )
{
if ( strcmp( shapeName, g_meshDropShapeNames[i] ) == 0 )
{
shape = i;
}
}
if ( shape < 0 )
{
continue;
}
matchedCount += 1;
const ShapeStats* stats = soak->stats + shape;
int current[2 + MESH_DROP_DEPTH_LEVEL_COUNT] = { stats->tunnelCount, stats->awakeCount };
for ( int i = 0; i < MESH_DROP_DEPTH_LEVEL_COUNT; ++i )
{
current[2 + i] = stats->depthCounts[i];
}
for ( int i = 0; i < 2 + MESH_DROP_DEPTH_LEVEL_COUNT; ++i )
{
if ( current[i] == counts[i] )
{
continue;
}
// Any collision change reshuffles the chaotic pile, so a count moves by about its square root
// even when nothing got worse. Flag growth past three of those. A count that was zero flags on any
// growth, since a good build never sinks that deep.
float band = 3.0f * sqrtf( (float)counts[i] );
bool regressed = i < 2 ? current[i] > counts[i] : current[i] > counts[i] + band;
char column[32];
if ( i < 2 )
{
snprintf( column, sizeof( column ), i == 0 ? "tunnels" : "awake" );
}
else
{
snprintf( column, sizeof( column ), "> %g slop", g_meshDropDepthLevels[i - 2] );
}
printf( " %-9s %-11s %d>%d%s\n", shapeName, column, counts[i], current[i], regressed ? " GREW" : "" );
changedCount += 1;
result = regressed ? 1 : result;
}
}
fclose( file );
if ( matchedCount == 0 )
{
printf( "%s has no rows for %s-s=%s -b=%u -g=%d\n", path, soak->settings.rough ? "--rough " : "",
GetFilterName( soak->shapeFilter, false ), soak->baseSeed, soak->generationCount );
return 2;
}
printf( "compared with %s: %d changed, %s\n", path, changedCount, result == 0 ? "none grew past noise" : "GREW" );
return result;
}
static const char* MatchValue( const char* arg, const char* shortName, const char* longName )
{
size_t shortLength = strlen( shortName );
if ( strncmp( arg, shortName, shortLength ) == 0 )
{
return arg + shortLength;
}
size_t longLength = strlen( longName );
if ( strncmp( arg, longName, longLength ) == 0 )
{
return arg + longLength;
}
return NULL;
}
int main( int argc, char** argv )
{
int generationCount = 1000;
int threadCount = 8;
int shapeFilter = e_meshDropBox;
uint32_t seed = (uint32_t)b3GetTicks();
bool fixedSeed = false;
bool recycling = true;
bool amplitudeSet = false;
const char* writePath = NULL;
const char* comparePath = NULL;
MeshDropSettings settings = GetDefaultMeshDropSettings();
for ( int i = 1; i < argc; ++i )
{
const char* arg = argv[i];
const char* value;
if ( ( value = MatchValue( arg, "-g=", "--generations=" ) ) != NULL )
{
generationCount = atoi( value );
}
else if ( ( value = MatchValue( arg, "-t=", "--threads=" ) ) != NULL )
{
threadCount = b3ClampInt( atoi( value ), 1, MAX_THREADS );
}
else if ( ( value = MatchValue( arg, "-s=", "--shape=" ) ) != NULL )
{
shapeFilter = -2;
for ( int k = 0; k < e_meshDropShapeCount; ++k )
{
if ( strcmp( value, g_meshDropShapeNames[k] ) == 0 )
{
shapeFilter = k;
}
}
if ( strcmp( value, "all" ) == 0 )
{
shapeFilter = -1;
}
if ( shapeFilter == -2 )
{
printf( "unknown shape: %s\n", value );
return 2;
}
}
else if ( ( value = MatchValue( arg, "-seed=", "--seed=" ) ) != NULL )
{
seed = (uint32_t)strtoul( value, NULL, 10 );
fixedSeed = true;
}
else if ( ( value = MatchValue( arg, "-b=", "--base-seed=" ) ) != NULL )
{
seed = (uint32_t)strtoul( value, NULL, 10 );
}
else if ( ( value = MatchValue( arg, "-a=", "--amplitude=" ) ) != NULL )
{
settings.amplitude = (float)atof( value );
amplitudeSet = true;
}
else if ( strcmp( arg, "--rough" ) == 0 )
{
settings.rough = true;
}
else if ( ( value = MatchValue( arg, "-w=", "--write=" ) ) != NULL )
{
writePath = value;
}
else if ( ( value = MatchValue( arg, "-c=", "--compare=" ) ) != NULL )
{
comparePath = value;
}
else if ( strcmp( arg, "--no-recycling" ) == 0 )
{
recycling = false;
}
else
{
printf( "Usage: mesh_soak [options]\n"
"Drops %d bodies per generation on the Mesh Drop wave mesh until they sleep.\n"
"Fails on a body below y = -2 (tunnel) or a pile awake past the step limit.\n"
"Counts bodies that sink into the wave deeper than each depth level.\n"
" -g, --generations=<int> generation count (default 1000)\n"
" -t, --threads=<int> worker threads, one world each (default 8)\n"
" -s, --shape=<name> box, capsule, cylinder, sphere or all (default box)\n"
" -b, --base-seed=<uint> base seed, each generation hashes its own seed from it (default random)\n"
" --seed=<uint> run every generation with this exact seed (replay)\n"
" -a, --amplitude=<float> wave amplitude (default 0.5, rough 0.015)\n"
" --rough fine bumps smaller than the bodies, reaches the manifold cap\n"
" -w, --write=<csv> write the counts as a baseline, replacing only the rows of this run\n"
" -c, --compare=<csv> compare the counts with the baseline rows from the same wave, -s, -b and -g\n"
" --no-recycling disable contact recycling\n"
"Exit code is 0 when every generation passes and no count grew past noise, 1 otherwise,\n"
"2 for bad arguments or a baseline from a different run.\n",
MESH_DROP_BODY_COUNT );
return 2;
}
}
if ( settings.rough && amplitudeSet == false )
{
settings.amplitude = GetMeshDropDefaultAmplitude( true );
}
if ( fixedSeed && ( writePath != NULL || comparePath != NULL ) )
{
printf( "a baseline needs a base seed, not --seed\n" );
return 2;
}
Soak soak = { 0 };
soak.mutex = b3CreateMutex();
soak.settings = settings;
soak.recycling = recycling;
soak.groundMesh = CreateMeshDropMesh( settings );
soak.cylinder = CreateMeshDropCylinder();
soak.baseSeed = seed;
soak.fixedSeed = fixedSeed;
soak.generationCount = generationCount;
soak.shapeFilter = shapeFilter;
for ( int i = 0; i < e_meshDropShapeCount; ++i )
{
soak.stats[i].maxDepth = -FLT_MAX;
soak.stats[i].maxGeneration = INT32_MAX;
}
printf( "mesh soak: %d generations, %d threads, %sshape %s, %s seed %u\n", generationCount, threadCount,
settings.rough ? "rough wave, " : "", GetFilterName( shapeFilter, false ), fixedSeed ? "fixed" : "base", seed );
fflush( stdout );
uint64_t ticks = b3GetTicks();
b3Thread* threads[MAX_THREADS];
for ( int i = 0; i < threadCount; ++i )
{
threads[i] = b3CreateThread( SoakWorker, &soak, "soak" );
}
for ( int i = 0; i < threadCount; ++i )
{
b3JoinThread( threads[i] );
}
float seconds = 0.001f * b3GetMilliseconds( ticks );
double averageSteps = soak.completedCount > 0 ? (double)soak.totalSteps / soak.completedCount : 0.0;
float slop = B3_LINEAR_SLOP;
printf( "\n%-9s %8s %8s %6s", "shape", "bodies", "tunnels", "awake" );
for ( int i = 0; i < MESH_DROP_DEPTH_LEVEL_COUNT; ++i )
{
char label[32];
snprintf( label, sizeof( label ), "> %g slop", g_meshDropDepthLevels[i] );
printf( " %10s", label );
}
printf( " deepest\n" );
for ( int shape = 0; shape < e_meshDropShapeCount; ++shape )
{
const ShapeStats* stats = soak.stats + shape;
if ( stats->generationCount == 0 )
{
continue;
}
printf( "%-9s %8d %8d %6d", g_meshDropShapeNames[shape], stats->generationCount * MESH_DROP_BODY_COUNT,
stats->tunnelCount, stats->awakeCount );
for ( int i = 0; i < MESH_DROP_DEPTH_LEVEL_COUNT; ++i )
{
printf( " %10d", stats->depthCounts[i] );
}
if ( stats->maxIndex >= 0 )
{
printf( " %.1f slop, seed %u body (%d, %d) step %d\n", stats->maxDepth / slop, stats->maxSeed,
stats->maxIndex / MESH_DROP_GRID_COUNT, stats->maxIndex % MESH_DROP_GRID_COUNT, stats->maxStep );
}
else
{
printf( "\n" );
}
}
printf( "\nsteps to sleep: average %.0f, max %d, time %.1f s\n", averageSteps, soak.maxSteps, seconds );
if ( settings.rough )
{
int64_t total = 0;
for ( int i = 0; i < B3_MAX_MANIFOLDS; ++i )
{
total += soak.manifoldCounts[i];
}
// The last bucket is the cap, so it holds every contact that was reduced
printf( "contact updates by manifold count:" );
for ( int i = 0; i < B3_MAX_MANIFOLDS; ++i )
{
printf( " %d: %.1f%%", i + 1, total > 0 ? 100.0 * soak.manifoldCounts[i] / total : 0.0 );
}
printf( "\n" );
}
int reported = b3MinInt( soak.failureCount, MAX_REPORTED_FAILURES );
for ( int i = 0; i < reported; ++i )
{
Failure* f = soak.failures + i;
printf( " %s %s seed %u body (%d, %d)\n", f->kind == e_tunnel ? "tunnel" : "awake", g_meshDropShapeNames[f->shape],
f->seed, f->index / MESH_DROP_GRID_COUNT, f->index % MESH_DROP_GRID_COUNT );
}
int exitCode = soak.failureCount == 0 ? 0 : 1;
if ( writePath != NULL )
{
WriteBaseline( &soak, writePath );
}
if ( comparePath != NULL )
{
int compareResult = CompareBaseline( &soak, comparePath );
exitCode = b3MaxInt( exitCode, compareResult );
}
printf( exitCode == 0 ? "PASS\n" : "FAIL\n" );
b3DestroyHull( soak.cylinder );
b3DestroyMesh( soak.groundMesh );
b3DestroyMutex( soak.mutex );
return exitCode;
}

View file

@ -0,0 +1,13 @@
filter,base,generations,shape,tunnels,awake,depth4,depth8,depth16,depth32
all,12345,16000,box,0,0,23676,3191,44,0
all,12345,16000,capsule,0,0,231496,54552,515,0
all,12345,16000,cylinder,0,0,178981,37441,480,0
all,12345,16000,sphere,0,0,987,0,0,0
all,12345,1000,box,0,0,1503,218,3,0
all,12345,1000,capsule,0,0,14507,3488,28,0
all,12345,1000,cylinder,0,0,10859,2193,36,0
all,12345,1000,sphere,0,0,56,0,0,0
rough_all,12345,1000,box,0,0,2107,535,6,0
rough_all,12345,1000,capsule,0,0,3603,177,1,0
rough_all,12345,1000,cylinder,0,0,3239,726,21,0
rough_all,12345,1000,sphere,0,0,0,0,0,0
1 filter base generations shape tunnels awake depth4 depth8 depth16 depth32
2 all 12345 16000 box 0 0 23676 3191 44 0
3 all 12345 16000 capsule 0 0 231496 54552 515 0
4 all 12345 16000 cylinder 0 0 178981 37441 480 0
5 all 12345 16000 sphere 0 0 987 0 0 0
6 all 12345 1000 box 0 0 1503 218 3 0
7 all 12345 1000 capsule 0 0 14507 3488 28 0
8 all 12345 1000 cylinder 0 0 10859 2193 36 0
9 all 12345 1000 sphere 0 0 56 0 0 0
10 rough_all 12345 1000 box 0 0 2107 535 6 0
11 rough_all 12345 1000 capsule 0 0 3603 177 1 0
12 rough_all 12345 1000 cylinder 0 0 3239 726 21 0
13 rough_all 12345 1000 sphere 0 0 0 0 0 0

24
build_vs2022.bat Normal file
View file

@ -0,0 +1,24 @@
@echo off
rem Use this batch file to generate Visual Studio 2022 project files for box3d.
rem
rem Usage:
rem build_vs2022.bat Configure or update project files in build\
rem build_vs2022.bat fresh Delete build\ first, then configure from scratch
rem
rem Re-running without "fresh" updates the existing project files in place.
rem CMake rewrites .vcxproj/.sln files atomically, so this works even while
rem Visual Studio has the solution open -- VS will detect the change and
rem prompt to reload.
if /i "%~1"=="fresh" (
if exist build (
echo Fresh build requested, removing build\ ...
rmdir /s /q build
if exist build (
echo ERROR: failed to remove build\ -- is something holding files open?
exit /b 1
)
)
)
cmake -S . -B build -G "Visual Studio 17 2022"

View file

@ -1,85 +0,0 @@
b3Vec3 gravity = {0, -10, 0};
b3World_SetGravity(m_worldId, gravity);
std::vector<b3BodyId> bodies;
std::vector<b3JointId> joints;
{
b3BodyDef bd = b3DefaultBodyDef();
bd.name = "cube";
bd.type = b3BodyType(2);
bd.position = {-7.98573353e-07, 0.499929696, -9.86034479e-07};
bd.rotation = {{-4.03613463e-08, 0.825855613, 4.68083634e-08}, 0.563881755};
bd.linearVelocity = {2.47239775e-08, -1.7695136e-08, 8.65693384e-09};
bd.angularVelocity = {1.73163173e-08, -4.2026933e-15, -4.94549042e-08};
bd.linearDamping = 0;
bd.angularDamping = 0;
bd.enableSleep = bool(1);
bd.isAwake = bool(1);
bd.gravityScale = 1;
b3BodyId bodyId = b3CreateBody(m_worldId, &bd);
bodies.push_back(bodyId);
{
b3ShapeDef sd = b3DefaultShapeDef();
sd.density = 1000;
sd.isSensor = bool(0);
sd.filter.categoryBits = 0x1;
sd.filter.maskBits = 0xffffffffffffffff;
sd.filter.groupIndex = 0;
sd.baseMaterial.friction = 0.600000024;
sd.baseMaterial.restitution = 0;
sd.baseMaterial.rollingResistance = 0;
b3Vec3 vs[8];
vs[0] = {0.5, 0.5, 0.5};
vs[1] = {-0.5, 0.5, 0.5};
vs[2] = {-0.5, -0.5, 0.5};
vs[3] = {0.5, -0.5, 0.5};
vs[4] = {0.5, 0.5, -0.5};
vs[5] = {-0.5, 0.5, -0.5};
vs[6] = {-0.5, -0.5, -0.5};
vs[7] = {0.5, -0.5, -0.5};
b3HullData* hullData = b3CreateHull(vs, 8, 8);
b3CreateHullShape(bodyId, &sd, hullData);
b3DestroyHull(hullData);
}
}
{
b3BodyDef bd = b3DefaultBodyDef();
bd.name = "ground";
bd.type = b3BodyType(0);
bd.position = {0, -1, 0};
bd.rotation = {{0, 0, 0}, 1};
bd.linearVelocity = {0, 0, 0};
bd.angularVelocity = {0, 0, 0};
bd.linearDamping = 0;
bd.angularDamping = 0;
bd.enableSleep = bool(1);
bd.isAwake = bool(0);
bd.gravityScale = 1;
b3BodyId bodyId = b3CreateBody(m_worldId, &bd);
bodies.push_back(bodyId);
{
b3ShapeDef sd = b3DefaultShapeDef();
sd.density = 1000;
sd.isSensor = bool(0);
sd.filter.categoryBits = 0x1;
sd.filter.maskBits = 0xffffffffffffffff;
sd.filter.groupIndex = 0;
sd.baseMaterial.friction = 0.600000024;
sd.baseMaterial.restitution = 0;
sd.baseMaterial.rollingResistance = 0;
b3Vec3 vs[8];
vs[0] = {15, 1, 15};
vs[1] = {-15, 1, 15};
vs[2] = {-15, -1, 15};
vs[3] = {15, -1, 15};
vs[4] = {15, 1, -15};
vs[5] = {-15, 1, -15};
vs[6] = {-15, -1, -15};
vs[7] = {15, -1, -15};
b3HullData* hullData = b3CreateHull(vs, 8, 8);
b3CreateHullShape(bodyId, &sd, hullData);
b3DestroyHull(hullData);
}
}

1
data/hulls/axe.txt Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Copies documentation to blog
cp -R build/docs/html/. ../box2d_blog/public/documentation3d/

View file

@ -1,4 +1,7 @@
find_package(Doxygen REQUIRED dot)
# https://www.doxygen.nl/manual/markdown.html#markdown_extra
# https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
find_package(Doxygen REQUIRED)
set(DOXYGEN_PROJECT_NAME "Box3D")
set(DOXYGEN_GENERATE_HTML YES)
@ -31,16 +34,25 @@ set(DOXYGEN_DISABLE_INDEX YES)
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_FULL_SIDEBAR NO)
# Only the ## sections in the tree, deeper headings made the manual pages expand into long lists
set(DOXYGEN_TOC_INCLUDE_HEADINGS 2)
# No per-page outline panel on the right
set(DOXYGEN_PAGE_OUTLINE_PANEL NO)
# Dark theme baked by doxygen, extra.css only adds the Box3D accent
# Dark theme baked by doxygen, extra.css restyles it in the Box2D grays and accent
set(DOXYGEN_HTML_COLORSTYLE DARK)
# this tells doxygen to label structs as structs instead of classes
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
set(DOXYGEN_WARN_IF_INCOMPLETE_DOC NO)
# Keep enum values out of the summary tables, b3HexColor alone has over a hundred
set(DOXYGEN_ENUM_VALUES_PER_LINE 0)
# No Graphviz diagrams, the struct collaboration graphs only repeat the field types
set(DOXYGEN_HAVE_DOT NO)
doxygen_add_docs(doc
"${CMAKE_SOURCE_DIR}/include/box3d"
"overview.md"
@ -57,4 +69,10 @@ doxygen_add_docs(doc
"reading.md"
ALL
COMMENT "Generate HTML documentation")
# Jump to anchors instead of doxygen's animated scroll
add_custom_command(TARGET doc POST_BUILD
COMMAND ${CMAKE_COMMAND} -DNAVTREE=${CMAKE_CURRENT_BINARY_DIR}/html/navtree.js
-P ${CMAKE_CURRENT_SOURCE_DIR}/instant_scroll.cmake
VERBATIM)

View file

@ -1,6 +1,7 @@
# Collision
Box3D provides geometric types and functions. These include:
- primitives: spheres, capsules, and convex hulls
- triangle meshes and height fields for static terrain
- convex hull construction from point clouds
@ -24,6 +25,7 @@ physics simulation. At a minimum, you should understand how to create primitives
that can later be attached to rigid bodies.
Box3D shape primitives support several operations:
- Test a point or proxy for overlap with the primitive
- Perform a ray cast against the primitive
- Compute the primitive's bounding box
@ -381,6 +383,7 @@ this for stable stacking.
Normally you do not compute manifolds directly — you use the contact data
returned by the simulation. The `b3Manifold` struct contains:
- `normal`: unit normal from shape A toward shape B
- `points[B3_MAX_MANIFOLD_POINTS]`: contact points with separation, impulses,
and feature ids
@ -401,15 +404,16 @@ b3CollideHulls(&manifold, B3_MAX_MANIFOLD_POINTS,
```
Available collide functions:
- `b3CollideSpheres`
- `b3CollideCapsuleAndSphere`
- `b3CollideCapsules`
- `b3CollideHullAndSphere`
- `b3CollideHullAndCapsule`
- `b3CollideHulls`
- `b3CollideCapsuleAndTriangle`
- `b3CollideHullAndTriangle`
- `b3CollideSphereAndTriangle`
- `b3CollideTriangleAndCapsule`
- `b3CollideTriangleAndHull`
- `b3CollideTriangleAndSphere`
The SAT cache in `b3CollideHulls` warm-starts the separating axis search between
frames, the same idea as the simplex cache for GJK distance.

View file

@ -13,10 +13,9 @@ not a runtime mutation primitive. The intended workflow is:
1. Author geometry offline (level mesh, terrain tile, building shell).
2. Bake the compound once with `b3CreateCompound`.
3. Serialize it to a byte buffer with `b3ConvertCompoundToBytes` and store it on
disk or in a streaming cache.
4. At runtime, load the bytes and reconstruct the compound with
`b3ConvertBytesToCompound`, then attach it to a static body.
3. Write the compound bytes to disk or a streaming cache.
4. At runtime, load the bytes and check them with `b3ValidateCompound`, then
attach the compound to a static body.
This makes compounds well-suited to open-world streaming: tiles are baked
offline, kept in memory as flat byte buffers (which the engine uses directly
@ -55,46 +54,48 @@ b3Compound* compound = b3CreateCompound(&def);
can be freed immediately after the call.
Mesh children share the mesh pointer rather than cloning triangle data — the
`b3MeshData` must remain valid for the lifetime of the compound. Triangle
materials are limited to `B3_MAX_COMPOUND_MESH_MATERIALS` (4) slots per mesh
child; if your mesh needs more materials, attach it as a standalone mesh shape
on the static body instead.
`b3MeshData` must remain valid for the lifetime of the compound. A compound's
shared material table holds at most 64K unique materials.
## The b3Compound Structure
```c
typedef struct b3Compound {
uint64_t version; // versioned against the tree/mesh/hull formats
uint64_t version; // versioned against the mesh/hull formats
int byteCount; // total size when serialized
// internal tree, child arrays, material table
// tree offsets and counts, child arrays, material table
// ... (treat as opaque)
} b3Compound;
```
`version` is a compile-time constant (`B3_COMPOUND_VERSION`) that incorporates
the dynamic tree, mesh, and hull format versions. A version mismatch at load
time means the bytes were baked with a different engine version and cannot be
used.
the mesh and hull format versions. A version mismatch at load time means the
bytes were baked with a different engine version and cannot be used.
## Serialization
Convert a live compound to a self-contained byte buffer:
A compound is a single flat blob that contains no pointers. Everything inside it
is addressed by byte offset from the start of the struct, so the bytes are
position independent. Write `compound->byteCount` bytes starting at the compound
address to disk. A plain `memcpy`, file read, or memory map of those bytes is a
valid compound, and no fixup step is needed.
Validate bytes at runtime before using them (zero-copy; bytes must remain in
scope and must not be modified while a shape uses them):
```c
uint8_t* bytes = b3ConvertCompoundToBytes(compound);
// compound is now in an unusable state; its pointers have been nullified.
// Write bytes[0 .. compound->byteCount - 1] to disk.
const b3CompoundData* compound = b3ValidateCompound(bytes, byteCount);
if (compound == NULL)
{
// wrong version, wrong size, or corrupt offsets
}
```
Reconstruct from bytes at runtime (zero-copy; bytes must remain in scope):
```c
b3Compound* compound = b3ConvertBytesToCompound(bytes, byteCount);
```
The bytes are mutated in place to fixup internal pointers. Multiple static
bodies can use the same byte buffer simultaneously (instancing), since the
compound itself holds no per-body state.
`b3ValidateCompound` never modifies the bytes. It returns `NULL` unless the
version matches, `byteCount` equals the size stored in the compound, and the tree
node array lies fully inside the buffer. On success it returns the
input address. Multiple static bodies can use the same byte buffer
simultaneously (instancing), since the compound itself holds no per-body state.
## Attaching to a Static Body
@ -153,5 +154,5 @@ you manage the buffer lifetime yourself):
b3DestroyCompound(compound);
```
Do not call `b3DestroyCompound` on a compound reconstructed from bytes with
`b3ConvertBytesToCompound` — free the byte buffer instead.
Do not call `b3DestroyCompound` on a compound validated from bytes with
`b3ValidateCompound` — free the byte buffer instead.

4
docs/deploy_docs.sh Normal file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
# Copies documentation to blog
cp -R build/docs/html/. ../blog/public/documentation3d/

View file

@ -1,61 +1,41 @@
/*
Box2D accents on top of doxygen's built-in dark theme (HTML_COLORSTYLE DARK).
Doxygen 1.17 bakes a complete dark palette, so this only restores the Box2D
cyan accent and backs the transparent SVG diagrams. Loaded after doxygen.css,
Box2D look on top of doxygen's built-in dark theme (HTML_COLORSTYLE DARK).
Restores the Box2D cyan accent and grays, backs the transparent SVG diagrams,
and styles screenshots, prose width, and callouts. Loaded after doxygen.css,
so plain overrides win by order.
*/
/* Box2D cyan for links, symbol cross references, and section headings */
a, a:link, a:visited,
.contents a:visited,
a.el, a.el:visited, a.code, a.code:visited, a.line, a.line:visited,
a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
color: #67d8ef;
/* Doxygen's DARK style bakes its colors, so these only feed the overrides below */
:root {
--b3-page: #292a2d;
--b3-panel: #32363d;
--b3-edge: #3c4048;
--b3-edge-hover: #5f6670;
--b3-text: #D8D8D8;
--b3-muted: #9aa0a6;
--b3-accent: #67d8ef;
--b3-warm: #e5b567;
--b3-plate: #CCCCCC;
}
h2.groupheader,
.memtitle {
color: #67d8ef;
}
/* Page */
h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow {
text-shadow: 0 0 15px #67d8ef;
}
/* SVG diagrams are transparent, so back them with a light plate to stay legible on a dark page */
.image {
background-color: #CCCCCC;
border: 10px solid #CCCCCC;
}
img.inline {
background-color: #CCCCCC;
border: 10px solid #CCCCCC;
margin: 0px;
}
/* Caption sits on the light plate */
.caption {
padding-top: 10px;
color: black;
}
/* Cap line length for readability */
div.contents {
max-width: 1000px;
}
/* Soften contrast. doxygen 1.17's dark is near black, restore the Box2D grays */
/* Soften contrast. Doxygen's dark is near black, restore the Box2D grays */
body {
background-color: #292a2d;
color: #D8D8D8;
background-color: var(--b3-page);
color: var(--b3-text);
}
#titlearea,
div.header,
#side-nav,
#nav-tree {
background-color: #292a2d;
background-color: var(--b3-page);
}
#titlearea,
div.header {
border-bottom-color: var(--b3-edge);
}
/* Panels and selection sit one step lighter than the page */
@ -69,17 +49,371 @@ table.doxtable th, .fieldtable th,
th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone,
table.doxtable tr:nth-child(even) td,
.directory tr.even {
background-color: #32363d;
background-color: var(--b3-panel);
}
.directory tr.odd {
background-color: #292a2d;
background-color: var(--b3-page);
}
/* Caution callouts, filled olive box with a full border and real padding */
blockquote.doxtable {
background-color: #456114;
border: 1px solid #000000;
padding: 12px 16px;
margin: 10px 24px 10px 4px;
/* Cap line length for readability */
div.contents {
max-width: 1000px;
}
/* Prose reads best near 75 characters, the reference tables keep the wider cap */
.textblock {
max-width: 820px;
}
/* Links and headings */
/* Box2D cyan for links, symbol cross references, and section headings */
a, a:link, a:visited,
.contents a:visited,
a.el, a.el:visited, a.code, a.code:visited, a.line, a.line:visited,
a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
color: var(--b3-accent);
}
/* Doxygen bolds internal links only, so prose would mix two link weights */
.textblock a.el {
font-weight: normal;
}
.contents a:hover {
text-decoration: underline;
}
h2.groupheader,
.memtitle {
color: var(--b3-accent);
}
h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow {
text-shadow: 0 0 15px var(--b3-accent);
}
/* A page's # heading is the title and its ## headings render as h1 at 200% bold,
so the title has to outrank them */
div.headertitle .title {
font-size: 240%;
font-weight: 600;
line-height: 1.2;
}
/* Doxygen draws the group underline with side shadows filled in its black page color */
h2.groupheader {
box-shadow: 12px 0 var(--b3-page), -12px 0 var(--b3-page), 12px 1px var(--b3-edge), -12px 1px var(--b3-edge);
}
td h2.groupheader {
box-shadow: 13px 0 var(--b3-page), -13px 0 var(--b3-page), 13px 1px var(--b3-edge), -13px 1px var(--b3-edge);
}
/* Reference members */
/* Typedef types left aligned and free to wrap, so a long opaque struct typedef doesn't widen the
column, push the short callback return types right and squeeze the signatures */
table.memberdecls:has(#header-typedef-members) td.memItemLeft {
text-align: left;
white-space: normal;
}
/* Member list and field table edges in the border gray instead of navy */
.mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplParams, td.ititle,
tr.heading + tr[class^='memitem'] td.memItemLeft,
tr.groupHeader + tr[class^='memitem'] td.memItemLeft,
tr.inherit_header + tr[class^='memitem'] td.memItemLeft,
tr.heading + tr[class^='memitem'] td.memItemRight,
tr.groupHeader + tr[class^='memitem'] td.memItemRight,
tr.inherit_header + tr[class^='memitem'] td.memItemRight,
tr.heading + tr[class^='memitem'] td.memTemplParams,
tr.heading + tr td.ititle,
tr.groupHeader + tr[class^='memitem'] td.memTemplParams,
tr.groupHeader + tr td.ititle,
tr.inherit_header + tr[class^='memitem'] td.memTemplParams,
table.fieldtable, table.memberdecls-inline,
.fieldtable td.fieldtype, .fieldtable td.fieldname, .fieldtable td.fieldinit, .fieldtable td.fielddoc,
.memberdecls-inline th, .fieldtable th {
border-color: var(--b3-edge);
}
/* The member tab joins its box with a shadow and a strip, both in doxygen's navy */
.memtitle {
box-shadow: 0 10px 0 -1px var(--b3-panel), 0 2px 8px 0 rgba(0, 0, 0, 0.075);
}
.memtitle:after {
background: var(--b3-panel);
}
.memtitle, .memproto, dl.reflist dt, .memdoc, dl.reflist dd {
border-color: var(--b3-edge);
}
.memberdecls-inline th, .fieldtable th {
background-color: var(--b3-panel);
color: var(--b3-text);
}
/* Images */
/* Doxygen embeds SVG with object. The diagrams are transparent, so back them with a light plate
to stay legible on a dark page */
.image:has(object) {
background-color: var(--b3-plate);
border: 10px solid var(--b3-plate);
}
/* Raster images are screenshots, already opaque, so no plate */
.image:has(img) img {
border: 1px solid var(--b3-edge);
border-radius: 6px;
}
/* Fit wide images to the page, a link around a screenshot opens it full size */
.image img,
.image object {
max-width: 100%;
height: auto;
}
/* Caption sits on the light plate */
.caption {
padding-top: 10px;
color: black;
}
.image:has(img) .caption {
color: var(--b3-muted);
font-weight: normal;
font-size: 90%;
}
/* Callouts */
/* Callouts share one panel with an accent edge.
@note and > [!NOTE] give dl.note, @warning and > [!WARNING] give dl.warning,
> [!CAUTION] gives dl.attention, a plain quote like > [!caution]: gives blockquote.doxtable */
dl.note, dl.remark, dl.warning, dl.attention, dl.important,
blockquote.doxtable {
background-color: var(--b3-panel);
color: var(--b3-text);
border: none;
border-left: 4px solid var(--b3-accent);
border-radius: 4px;
padding: 10px 16px;
margin: 12px 0;
}
dl.warning, dl.attention, dl.important,
blockquote.doxtable {
border-left-color: var(--b3-warm);
}
dl.note dt, dl.remark dt {
color: var(--b3-accent);
}
dl.warning dt, dl.attention dt, dl.important dt,
blockquote.doxtable b:first-child {
color: var(--b3-warm);
}
blockquote.doxtable p {
margin: 0;
}
/* Doxygen titles > [!CAUTION] as Attention, overlay the GitHub title in the same font */
dl.attention dt {
visibility: hidden;
position: relative;
}
dl.attention dt::after {
content: "Caution";
visibility: visible;
position: absolute;
left: 0;
top: 0;
}
/* Search */
/* Search box on the panel gray with the cyan accent on focus, in place of the black field and blue edge */
#MSearchBox {
background-color: var(--b3-panel);
border: 1px solid var(--b3-edge);
border-radius: 6px;
padding: 2px 6px 2px 2px;
transition: border-color 0.15s, box-shadow 0.15s;
}
#MSearchBox:hover {
border-color: var(--b3-edge-hover);
}
#MSearchBox.MSearchBoxActive,
#MSearchBox:focus-within {
border-color: var(--b3-accent);
box-shadow: 0 0 0 2px rgba(103, 216, 239, 0.2);
}
#MSearchField {
width: 12em;
background-color: transparent;
color: var(--b3-text);
font-family: inherit;
font-size: 14px;
}
#MSearchField::placeholder {
color: var(--b3-muted);
}
/* The lens circle is filled to hide the handle behind it, so it must match the box */
.search-icon::before {
background: var(--b3-panel);
border-color: var(--b3-muted);
}
.search-icon::after {
border-color: var(--b3-muted);
}
.search-icon-dropdown {
border-top-color: var(--b3-muted);
}
#MSearchSelectWindow,
#MSearchResultsWindow {
background-color: var(--b3-page);
border: 1px solid var(--b3-edge);
border-radius: 6px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
a.SelectItem {
color: var(--b3-text);
}
a.SelectItem:hover {
color: var(--b3-text);
background-color: var(--b3-panel);
}
/* Tree */
/* Plain text so the tree doesn't compete with the page's links, cyan only on hover.
Doxygen sets its own small font here */
#nav-tree .label {
font: 13px system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
line-height: 22px;
}
#nav-tree a {
color: var(--b3-text);
}
#nav-tree a:hover {
color: var(--b3-accent);
}
/* Doxygen dims the current page, mark it bright with an accent edge instead */
#nav-tree .selected {
box-shadow: inset 3px 0 var(--b3-accent);
}
#nav-tree .selected a {
color: white;
}
span.arrowhead {
border-right-color: var(--b3-muted);
border-bottom-color: var(--b3-muted);
}
.selected span.arrowhead {
border-right-color: var(--b3-text);
border-bottom-color: var(--b3-text);
}
/* Tree sync toggle in the panel grays with the cyan accent on hover */
div.nav-sync-icon {
background-color: var(--b3-panel);
border: 1px solid var(--b3-edge);
border-radius: 3px;
}
div.nav-sync-icon:hover {
background-color: var(--b3-edge);
}
div.nav-sync-icon.active:after {
background-color: var(--b3-panel);
border-top-color: var(--b3-muted);
}
div.nav-sync-icon.active:hover:after {
border-top-color: var(--b3-accent);
}
span.sync-icon-left {
border-left-color: var(--b3-muted);
border-top-color: var(--b3-muted);
}
span.sync-icon-right {
border-right-color: var(--b3-muted);
border-bottom-color: var(--b3-muted);
}
div.nav-sync-icon:hover span.sync-icon-left {
border-left-color: var(--b3-accent);
border-top-color: var(--b3-accent);
}
div.nav-sync-icon:hover span.sync-icon-right {
border-right-color: var(--b3-accent);
border-bottom-color: var(--b3-accent);
}
/* Tree resize handle, shown on hover */
.ui-resizable-e {
background-color: var(--b3-edge);
}
.ui-resizable-e:after {
border-left-color: var(--b3-muted);
border-right-color: var(--b3-muted);
}
/* Footer */
/* Footer bar on the page gray, doxygen fills it black. The directory pages put a breadcrumb in it */
#nav-path ul {
background: var(--b3-page);
border-top: 1px solid var(--b3-edge);
border-bottom: none;
color: var(--b3-muted);
}
.navpath li,
.navpath li.footer {
color: var(--b3-muted);
}
.navpath li.navelem a {
color: var(--b3-accent);
}
#nav-path li.navelem:after {
background: var(--b3-page);
box-shadow: 2px -2px 0 2px var(--b3-edge);
}
#nav-path li.navelem:hover,
#nav-path li.navelem:hover:after {
background-color: var(--b3-panel);
}

View file

@ -44,6 +44,24 @@ for orientation and 3x3 inertia tensors for rotational dynamics. If you come acr
understand, please read about it on Wikipedia. Visit this [page](https://box2d.org/publications/) if you want a deeper
knowledge of the algorithms used in Box3D.
### Working with Unreal
You can use Box3D in Unreal as a plug-in. Here is the module file I use:
[Box3D module](https://gist.github.com/erincatto/6f08df5f1e6e9a79fb4be6298a3e1125)
Unreal uses centimeters as units while Box3D has tolerances tuned for meters. You can either scale dimensions you send and recieve from Box3D or you can use this to set the length units:
```c
b3SetLengthUnitsPerMeter(100.0f);
```
This doesn't scale the units. Instead it scales the tolerances used internally in Box3D to be more appropriate for centimeters.
Another issue is that Box3D is right-handed while Unreal is left-handed. Box3D has way too much math for it to be reasonable to support a left-handed option. However, it doesn't matter. In practice you don't need to do any conversions. Box3D will run in a mirrored world and the outputs from Box3D are fully compatible with the Unreal coordinates.
I would just be careful about using Box3D math functions like `b3Cross` and expecting it to give the same result as the Unreal cross product.
## API
### What units does Box3D use?
@ -103,6 +121,41 @@ approximately solve the differential equations. Box3D also does not have exact c
moving shapes may have small overlap for a few time steps. In extreme stacking scenarios, shapes may have sustained
overlap.
## Shapes
### Why doesn't Box3D have a cylinder shape?
Cylinders look simple but they are one of the hardest shapes to make work well in a 3D physics engine. Other engines
that support cylinders tend to document them as their least stable shape. A cylinder combines three kinds of geometry
that each need different handling:
* flat caps, like a polytope
* a sharp circular rim, like an edge that is curved
* a curved side, like a capsule that has no rounded ends
These cause several problems:
**Collision algorithms don't fit.** The other shapes in Box3D fall into two families. Spheres and capsules are a point
or a segment with a radius, so their collision is closed form and exact. Convex hulls have a finite set of faces and
edges, so Box3D can find the separating axis directly and clip faces to build a contact manifold. A cylinder belongs to
neither family. Its side has infinitely many face normals, and the rim is a curved edge. Testing the rim against a box
edge means solving a quartic. So engines fall back on GJK with a support function, which converges slowly on smooth
shapes. They also need extra machinery such as EPA or shrunken cores with margins for overlapping shapes.
GJK only gives one contact point but a cylinder resting on the end cap needs at least 4 points. Some physics engines
just clip a predefined polygon. In this case it is not really a cylinder being simulated.
### What should I use instead of a cylinder?
It depends on what the cylinder is for:
* **Barrels, logs, and pipes that roll:** a capsule rolls perfectly smoothly on its side. The rounded ends are often not
noticeable. Box3D supports rolling resistance for capsules as well.
* **Wheels:** use a sphere for the wheel collision, together with a wheel joint or revolute joint. A sphere rolls
perfectly and is the cheapest shape to collide. Box3D can reject ghost collisions between spheres and internal mesh edges.
Many vehicle setups instead skip wheel collision entirely and use ray casts or shape casts to find the ground.
* **Pillars, coins, and anything that mostly rests on its cap:** use a hull from `b3CreateCylinder()`. It makes a
tessellated cylinder along the y-axis with between 3 and 32 sides. Use the fewest sides that looks acceptable.
## Making Games
### Tile / Voxel Based Environments

View file

@ -1,8 +1,10 @@
# Foundations
Box3D provides minimal base functionality for allocation hooks and vector math. The C interface
allows most runtime data and types to be defined internally in the `src` folder.
## Assertions
Box3D will assert on bad input. This includes things like sending in NaN or infinity for values.
It will assert if you use negative values for things that should only be positive, such as density.
@ -13,6 +15,7 @@ You may wish to capture assertions in your application. In that case use `b3SetA
lets you override the debugger break and/or perform your own error handling.
## Allocation
Box3D uses memory efficiently and minimizes per-frame allocations by pooling memory. The engine
quickly adapts to the simulation size. After the first step or two of simulation there should be
no further per-frame allocations.
@ -29,6 +32,7 @@ You can provide a custom allocator using `b3SetAllocator()` and query the total
allocated using `b3GetByteCount()`.
## Version
The `b3Version` structure holds the current version so you can query it at run-time using
`b3GetVersion()`.
@ -38,11 +42,13 @@ printf("Box3D version %d.%d.%d\n", version.major, version.minor, version.revisio
```
## Vector Math
Box3D includes a vector math library covering types `b3Vec3`, `b3Quat`, `b3Transform`,
`b3Matrix3`, and `b3AABB`. The library is designed to suit the internal needs of Box3D
and its interface. All members are exposed, so you can use them freely in your application.
### b3Vec3
Three-component float vector with fields `x`, `y`, `z`. Useful constants and operations:
```c
@ -60,6 +66,7 @@ b3Vec3 q = b3Lerp(a, b, 0.5f); // linear interpolation
```
### b3Quat
Unit quaternion representing orientation. Stored as a vector part `q.v` (x, y, z) and a
scalar part `q.s`. The identity quaternion is `b3Quat_identity`.
@ -99,6 +106,7 @@ Because orientation in 3D is three-dimensional, there is no single scalar angle
in 2D. Always work with the full quaternion or the derived matrix.
### b3Transform
A rigid transform: a position vector `t.p` (`b3Vec3`) combined with an orientation `t.q`
(`b3Quat`). The identity transform is `b3Transform_identity`.
@ -120,90 +128,111 @@ b3Transform inv = b3InvertTransform(t);
```
### b3Matrix3
3×3 matrix stored as three column vectors `cx`, `cy`, `cz`. Primarily used for inertia
tensors and rotation matrices. Useful operations include `b3MulMV` (matrix-vector multiply),
`b3MulMM` (matrix-matrix multiply), `b3Transpose`, `b3InvertMatrix`, and `b3MakeMatrixFromQuat`.
### b3AABB
Axis-aligned bounding box with `lowerBound` and `upperBound` as `b3Vec3`. Helpers include
`b3AABB_Overlaps`, `b3AABB_Contains`, `b3AABB_ContainsPoint`, `b3AABB_Union`,
`b3AABB_Center`, `b3AABB_Extents`, `b3AABB_Inflate`, and `b3AABB_Transform`.
## Multithreading {#multi}
Box3D has been highly optimized for multithreading. Multithreading is not required and by
default Box3D runs single-threaded. If performance matters, you should consider wiring up
the multithreading interface.
Box3D does **not** create threads itself. You supply your own thread pool and hook it up through
the world definition before calling `b3CreateWorld`. See `b3EnqueueTaskCallback`,
`b3FinishTaskCallback`, `b3WorldDef::workerCount`, `b3WorldDef::enqueueTask`, and
`b3WorldDef::finishTask`:
Box3D has been optimized for multithreading. Multithreading is not required and by default Box3D will run single-threaded. If performance is important for your application, you should consider using the multithreading features.
### Internal scheduler
Box3D has a built-in task scheduler that creates threads. You can use the built-in scheduler by setting the worker count in the world definition. This example shows how to use 4 workers. In this case Box3D will create 3 threads, and count the thread that calls `b3World_Step` as the fourth worker. I recommend to use the core count of the CPU as the worker count, not counting hyper-threads or efficiency cores.
```c
b3WorldDef worldDef = b3DefaultWorldDef();
worldDef.workerCount = myThreadCount;
worldDef.enqueueTask = MyEnqueueTask;
worldDef.finishTask = MyFinishTask;
worldDef.userTaskContext = myScheduler;
b3WorldId worldId = b3CreateWorld(&worldDef);
worldDef.workerCount = 4;
```
Your `MyEnqueueTask` callback receives a `b3TaskCallback*` function pointer plus a context
pointer that must be forwarded to the task exactly once on a worker thread. Return a non-null
`void*` handle representing your pending task object, or null if the work was executed
serially inside the callback (Box3D then skips the corresponding `b3FinishTaskCallback`).
### External scheduler
You can optionally connect your own task scheduler if you want more control. Multithreading is established for each Box3D world you create and must be hooked up to the world definition. See `b3TaskCallback()`, `b3EnqueueTaskCallback()`, and `b3FinishTaskCallback()` for more details. Also see `b3WorldDef::workerCount`, `b3WorldDef::enqueueTask`, and `b3WorldDef::finishTask`.
```c
// Enqueue callback signature
// Implement b3EnqueueTaskCallback
void* MyEnqueueTask(b3TaskCallback* task, void* taskContext,
void* userContext, const char* taskName)
void* userContext, b3TaskType taskType)
{
MyTask* t = AllocTask();
t->task = task;
t->taskContext = taskContext;
SubmitToThreadPool(t); // runs task(taskContext) on a worker
return t; // non-null => Box3D will call MyFinishTask(t, ...)
Scheduler* myScheduler = (Scheduler*)userContext;
SubmitToThreadPool(myScheduler, t);
return t;
}
// Finish callback signature
// Implement b3FinishTaskCallback
void MyFinishTask(void* userTask, void* userContext)
{
MyTask* t = (MyTask*)userTask;
WaitForCompletion(t);
FreeTask(t);
}
```
`MyFinishTask` must block until the task has completed. Because the step blocks here on the tasks it
spawned, `b3World_Step` holds its stack across every fork and join inside the step. This has a
consequence for how you drive it. Run `b3World_Step` from a thread you can dedicate to the step, or
from a fiber that `MyFinishTask` can park so the underlying thread is freed to run the queued tasks.
In a job system that cannot park a job's stack, do not call `b3World_Step` from inside a job: a job
that blocks on the sub-jobs it spawned without yielding its thread starves the workers it is waiting
on and can deadlock. The alternative is help-while-wait, where the waiting thread runs other pending
tasks itself. This is what the in-tree scheduler does, which is why it needs no fiber.
Box3D ships an in-tree scheduler (`src/scheduler.h`) used by the test suite and samples.
You can adapt it or use it directly:
```c
#include "scheduler.h"
b3Scheduler* scheduler = b3CreateScheduler(workerCount);
b3WorldDef worldDef = b3DefaultWorldDef();
worldDef.workerCount = workerCount;
worldDef.enqueueTask = b3SchedulerEnqueueTask;
worldDef.finishTask = b3SchedulerFinishTask;
worldDef.userTaskContext = scheduler;
b3WorldId worldId = b3CreateWorld(&worldDef);
// ... simulate ...
b3DestroyWorld(worldId);
b3DestroyScheduler(scheduler);
worldDef.enqueueTask = MyEnqueueTask;
worldDef.finishTask = MyFinishTask;
worldDef.userTaskContext = myScheduler;
worldDef.workerCount = GetMyWorkerCount();
```
The finish callback is optional. Without it `b3World_Step()` waits on an internal semaphore that
the last task of each phase signals. This suits task systems that can launch work but cannot wait
on a single task.
### Stepping without blocking
`b3World_Step()` holds the calling thread until the step is done. Some task systems cannot allow
this, for example a phased or wavefront scheduler where a thread that joins a parallel job cannot
leave it. For these you can drive the step yourself with `b3World_BeginStep()` and
`b3World_ContinueStep()`. Each call runs the serial work between two phases and returns the next
batch of tasks. An empty batch means the step is complete.
```c
b3TaskBatch batch = b3World_BeginStep( worldId, timeStep, subStepCount );
while ( batch.count > 0 )
{
// Run every task in the batch on any threads, in any order, then wait for them.
// MyRunTasks is a function you implement.
MyRunTasks( batch.tasks, batch.count );
batch = b3World_ContinueStep( worldId );
}
```
No callbacks are needed and the built-in scheduler is never created. The worker count still sets
the most tasks in a batch, `workerCount + 2`, and the size of the per-worker data. Each parallel
task claims blocks of work from a shared counter until none are left, so the tasks that run first
do most of the work and a task that starts late returns right away. Fewer threads than tasks costs
only the extra task launches, and you can adjust the worker count with `b3World_SetWorkerCount()` at
runtime.
The rules:
- Call each task function exactly once. Tasks in a batch may run concurrently on any threads.
- Begin and continue may be called from any thread, but never while a task of the current batch is
running.
- The world is locked until the step completes. Do not read or write it in between.
- The tasks of the constraint solver wait on each other. They work with any number of threads,
even when run one after another on a single thread, but a solver task that has started must not
be suspended indefinitely.
One task may be marked `b3Task::deferred`. This is the rebuild of the dynamic tree, which overlaps
the narrow phase and the solver. You may leave it running across continue calls. A later batch
lists it in `b3TaskBatch::joinTasks` and it must be complete before the continue that follows that
batch. If you ignore the flag and run it with the rest of its batch, the step is still correct, it
just loses the overlap.
### Threading model
The multithreading design for Box3D is focused on [data parallelism](https://en.wikipedia.org/wiki/Data_parallelism).
The goal is to use multiple cores to finish the world simulation as fast as possible.
Box3D multithreading is not designed for [task parallelism](https://en.wikipedia.org/wiki/Task_parallelism).
@ -213,26 +242,34 @@ main thread. Those are examples of task parallelism.
So when you design your game loop, you should let Box3D *go wide* and use multiple cores to
finish its work quickly, without other threads interacting with the Box3D world at the same time.
It is expected that the thread that calls `b3World_Step` participates in making progress. Do not call
`b3World_Step` and park that fiber. Tasks will only be enqueued on the thread that calls `b3World_Step`.
`MyFinishTask` must block until the task has completed. Ideally your scheduler is helping make progress
when `MyFinishTask` is called.
### Avoiding race conditions
In a multithreaded environment you must be careful to avoid [race conditions](https://en.wikipedia.org/wiki/Race_condition).
Modifying the world while it is simulating will lead to unpredictable behavior and is never safe.
It is also not safe to read data from a Box3D world while it is simulating; Box3D may move data
It is also not safe to read data from a Box3D world while it is simulating. Box3D may move data
structures to improve cache performance, so you could easily read garbage.
> **Caution**:
> Do not perform read or write operations on a Box3D world during `b3World_Step()`
> **Caution**:
> Do not write to the Box3D world from multiple threads
> Do not perform read or write operations on a Box3D world during `b3World_Step()`.
> Do not write to the Box3D world from multiple threads. Any operation that wakes
> a body is not thread-safe.
It *is safe* to do ray-casts, shape-casts, and overlap tests from multiple threads outside of
`b3World_Step()`. Generally any read-only operation is safe to do multithreaded outside of
`b3World_Step()`. This can be very useful if you have multithreaded game logic.
## Multithreading Multiple Worlds
Some applications may wish to create multiple Box3D worlds and simulate them on different threads.
This works fine because Box3D has very limited use of globals.
There are a few caveats:
- You will get a race condition if you create or destroy Box3D worlds from multiple threads. Use a mutex to guard those operations.
- If you simulate multiple Box3D worlds simultaneously, they should probably not share a task system. Otherwise you risk preemption between worlds competing for the same workers.
- Any callbacks you hook up to Box3D must be thread-safe, including memory allocators.

64
docs/images/build.sh Normal file
View file

@ -0,0 +1,64 @@
#!/bin/bash
# Usage: ./build.sh [--force] [name.asy ...]
# https://asymptote.sourceforge.io/doc/colors.png
asy="/c/Program Files/Asymptote/asy.exe"
if [ ! -x "$asy" ]; then
echo "missing $asy"
exit 1
fi
cd "$(dirname "$0")" || exit 1
force=0
sources=()
for arg in "$@"; do
case "$arg" in
--force) force=1 ;;
*) sources+=("$arg") ;;
esac
done
if [ ${#sources[@]} -eq 0 ]; then
sources=(*.asy)
fi
# asy can exit 0 after a failed TeX run, so judge success by a fresh svg
marker=$(mktemp)
trap 'rm -f "$marker"' EXIT
status=0
failed=0
for src in "${sources[@]}"; do
name=$(basename "$src" .asy)
svg="$name.svg"
# Never clobber a hand drawn svg of the same name, delete it first to replace it
if [ -f "$svg" ] && ! head -c 300 "$svg" | grep -q dvisvgm; then
echo "skip $src: $svg was not made by asy"
status=1
continue
fi
if [ $force -eq 0 ] && [ "$svg" -nt "$src" ]; then
echo "fresh $svg"
continue
fi
touch "$marker"
"$asy" -noV -o "$name" "$src"
if [ "$svg" -nt "$marker" ]; then
echo "built $svg"
else
echo "failed $src"
status=1
failed=1
fi
done
# Leftovers from asy's TeX pipe. Keep the log after a failure, it has the TeX error.
rm -f texput.aux
if [ $failed -eq 0 ]; then
rm -f texput.log
fi
exit $status

View file

@ -2,22 +2,23 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="278.64941"
height="199.68138"
width="285"
height="205"
id="svg2"
version="1.1"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
inkscape:version="1.4.3 (0d15f75, 2025-12-25)"
sodipodi:docname="manifolds.svg"
inkscape:export-filename="D:\Development\Box2D\Box2D\Documentation\images\manifolds.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
inkscape:export-ydpi="90"
viewBox="-4 -4 285 205"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs4">
<marker
@ -50,38 +51,38 @@
</marker>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_x="0 : 531.49971 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
inkscape:vp_z="744.09448 : 531.49971 : 1"
inkscape:persp3d-origin="372.04724 : 356.10601 : 1"
id="perspective10" />
<inkscape:perspective
id="perspective2830"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:persp3d-origin="0.5 : 5.6519521 : 1"
inkscape:vp_z="1 : 5.8186188 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
inkscape:vp_x="0 : 5.8186188 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2852"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:persp3d-origin="0.5 : 5.6519521 : 1"
inkscape:vp_z="1 : 5.8186188 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
inkscape:vp_x="0 : 5.8186188 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3648"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:persp3d-origin="0.5 : 5.6519521 : 1"
inkscape:vp_z="1 : 5.8186188 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
inkscape:vp_x="0 : 5.8186188 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4310"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:persp3d-origin="0.5 : 5.6519521 : 1"
inkscape:vp_z="1 : 5.8186188 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
inkscape:vp_x="0 : 5.8186188 : 1"
sodipodi:type="inkscape:persp3d" />
<marker
inkscape:stockid="Arrow2Mend"
@ -99,10 +100,10 @@
</marker>
<inkscape:perspective
id="perspective4342"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:persp3d-origin="0.5 : 5.6519521 : 1"
inkscape:vp_z="1 : 5.8186188 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
inkscape:vp_x="0 : 5.8186188 : 1"
sodipodi:type="inkscape:persp3d" />
</defs>
<sodipodi:namedview
@ -112,21 +113,24 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2"
inkscape:cx="107.80664"
inkscape:cy="78.632812"
inkscape:zoom="2.8284271"
inkscape:cx="113.13709"
inkscape:cy="65.760931"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1097"
inkscape:window-height="1068"
inkscape:window-width="2079"
inkscape:window-height="1458"
inkscape:window-x="214"
inkscape:window-y="23"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
fit-margin-bottom="0"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" />
<metadata
id="metadata7">
<rdf:RDF>
@ -135,7 +139,6 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

View file

@ -0,0 +1,267 @@
settings.outformat = "svg";
settings.render = 0;
settings.prc = false;
import three;
real px = 0.75bp;
pen ink = rgb("231f20");
pen meshPen = ink + 0.6px;
pen regionFill = rgb("f2d4d0");
pen regionPen = rgb("a8322a") + 1.0px;
pen ridgeColor = rgb("c26a17");
pen gullyColor = rgb("1f5c99");
pen sliceFill = gray(0.93) + opacity(0.75);
pen guidePen = gray(0.55) + 0.5px + linetype(new real[] {4, 3});
pen hullPen = ink + 0.7px + linetype(new real[] {5, 3});
real arrowSize = 5px;
triple lightDirection = unit((1, 4, 2));
// The Saddle Vertex sample hub, spokes alternate 8 degree ridges and 32 degree gullies
int spokeCount = 6;
real fanRadius = 1.5;
real[] drops = {8, 32, 8, 32, 8, 32};
// The slice plane sits this far above the hub. Planes through the hub cut it in lines.
real sliceHeight = 1.6;
real sliceRadius = sliceHeight * Tan(40);
triple[] spokes;
for (int i = 0; i < spokeCount; ++i)
{
real angle = 60 * i;
spokes.push(fanRadius * (Cos(angle), -Tan(drops[i]), Sin(angle)));
}
bool IsRidge(int i)
{
return i % 2 == 0;
}
pen SpokePen(int i)
{
return IsRidge(i) ? ridgeColor : gullyColor;
}
// Gnomonic coordinates: a normal n maps to (n.x, n.z) / n.y on the slice, so every plane through
// the hub maps to a line and n . e <= 0 maps to a half plane
pair Gnomonic(triple n)
{
return (n.x / n.y, n.z / n.y);
}
// Half plane of spoke i on the unit slice: dot(p, u) <= offset
pair SpokeDirection(int i)
{
return (Cos(60 * i), Sin(60 * i));
}
real SpokeOffset(int i)
{
return Tan(drops[i]);
}
// Sutherland Hodgman clip of a convex polygon against dot(p, u) <= offset
pair[] ClipPolygon(pair[] poly, pair u, real offset)
{
pair[] result;
int n = poly.length;
for (int k = 0; k < n; ++k)
{
pair a = poly[k];
pair b = poly[(k + 1) % n];
real da = dot(a, u) - offset;
real db = dot(b, u) - offset;
if (da <= 0)
result.push(a);
if (da * db < 0)
result.push(a + da / (da - db) * (b - a));
}
return result;
}
pair[] region = { (-10, -10), (10, -10), (10, 10), (-10, 10) };
for (int i = 0; i < spokeCount; ++i)
region = ClipPolygon(region, SpokeDirection(i), SpokeOffset(i));
// Each face normal is perpendicular to its two spokes, so it lies on both of their lines
pair[] faceNormals;
for (int i = 0; i < spokeCount; ++i)
{
triple n = cross(spokes[(i + 1) % spokeCount], spokes[i]);
if (n.y < 0)
n = -n;
faceNormals.push(Gnomonic(n));
}
// A face normal leans past the gully it borders, so sort by angle before drawing the hull
pair[] hullPoints = sort(faceNormals, new bool(pair a, pair b) { return degrees(a, false) < degrees(b, false); });
// End points of the line of spoke i, clipped to a disk of the given radius on the unit slice
pair[] SpokeLine(int i, real radius)
{
pair u = SpokeDirection(i);
pair t = (-u.y, u.x);
real c = SpokeOffset(i);
real half = sqrt(radius * radius - c * c);
return new pair[] { c * u - half * t, c * u + half * t };
}
pen Shade(path3 face)
{
triple n = unit(cross(point(face, 1) - point(face, 0), point(face, 2) - point(face, 0)));
real k = 0.74 + 0.26 * abs(dot(n, lightDirection));
return rgb(k * 0.843, k * 0.890, k * 0.957);
}
triple Lift(pair p)
{
return sliceHeight * (p.x, 1, p.y);
}
frame[] panels;
string[] titles;
// 3D view: the fan, the slice above it and the cone of the region
{
currentprojection = orthographic((3.4, 3.0, 2.6), up = Y);
picture pic;
size(pic, 250px, 250px);
triple hub = (0, 0, 0);
for (int i = 0; i < spokeCount; ++i)
{
path3 t = hub -- spokes[i] -- spokes[(i + 1) % spokeCount] -- cycle;
draw(pic, surface(t), Shade(t), nolight);
draw(pic, t, meshPen);
}
triple offset[] = {(0.1, 0, 0.1), (0.3, 0, 0.3), (0, 0, 0), (-0.1, 0, 0), (0, 0, -0.3), (0, 0, 0)};
for (int i = 0; i < spokeCount; ++i)
{
draw(pic, hub -- spokes[i], SpokePen(i) + 1.4px);
label(pic, "$e_" + string(i) + "$", spokes[i] + offset[i], unit(Gnomonic((spokes[i].x, 1, 4 * spokes[i].z))), SpokePen(i));
}
// The boundary plane of one ridge spoke, it holds the hub and its line on the slice
pair[] line0 = SpokeLine(0, Tan(40));
path3 wall = hub -- Lift(line0[0]) -- Lift(line0[1]) -- cycle;
draw(pic, surface(wall), ridgeColor + opacity(0.18), nolight);
draw(pic, hub -- Lift(line0[0]), ridgeColor + 0.5px + linetype(new real[] {4, 3}));
draw(pic, hub -- Lift(line0[1]), ridgeColor + 0.5px + linetype(new real[] {4, 3}));
path3 slice = shift((0, sliceHeight, 0)) * rotate(90, X) * scale3(sliceRadius) * unitcircle3;
draw(pic, surface(slice), sliceFill, nolight);
draw(pic, slice, gray(0.6) + 0.5px);
for (int i = 0; i < spokeCount; ++i)
{
pair[] ends = SpokeLine(i, Tan(40));
draw(pic, Lift(ends[0]) -- Lift(ends[1]), SpokePen(i) + 0.8px);
}
path3 top = Lift(region[0]);
for (int k = 1; k < region.length; ++k)
top = top -- Lift(region[k]);
top = top -- cycle;
draw(pic, surface(top), regionFill, nolight);
draw(pic, top, regionPen);
for (pair p : region)
draw(pic, hub -- Lift(p), regionPen);
dot(pic, hub, ink + 3px);
label(pic, "slice", Lift((0, -Tan(40))) + (0, 0.1, 0), N, gray(0.35));
panels.push(pic.fit());
titles.push("Saddle Vertex Voronoi");
}
// Top view of the slice, in units of tan(tilt)
{
picture pic;
unitsize(pic, 190px);
real radius = Tan(40);
// Looking down on the slice: x to the right, z down the page
pair View(pair p)
{
return (p.x, -p.y);
}
path hull = View(hullPoints[0]);
for (int i = 1; i < spokeCount; ++i)
hull = hull -- View(hullPoints[i]);
hull = hull -- cycle;
fill(pic, hull, gray(0.92));
// Excluded side of each line, a band inside the disk
real band = 0.035;
for (int i = 0; i < spokeCount; ++i)
{
pair u = SpokeDirection(i);
pair[] ends = SpokeLine(i, radius - band);
path strip = View(ends[0]) -- View(ends[1]) -- View(ends[1] + band * u) -- View(ends[0] + band * u) -- cycle;
fill(pic, strip, SpokePen(i) + opacity(0.25));
}
for (int i = 0; i < spokeCount; ++i)
{
pair[] ends = SpokeLine(i, radius);
draw(pic, View(ends[0]) -- View(ends[1]), SpokePen(i) + 1.0px);
pair u = SpokeDirection(i);
label(pic, "$e_" + string(i) + "$", View((SpokeOffset(i) + (IsRidge(i) ? 0.11 : 0.075)) * u), SpokePen(i));
}
draw(pic, hull, hullPen);
path area = View(region[0]);
for (int k = 1; k < region.length; ++k)
area = area -- View(region[k]);
area = area -- cycle;
filldraw(pic, area, regionFill, regionPen);
// Tilt from up, drawn over the fills so they read through the region
for (real tilt : new real[] {10, 20, 30, 40})
{
draw(pic, scale(Tan(tilt)) * unitcircle, tilt == 40 ? gray(0.6) + 0.5px : guidePen);
label(pic, string(tilt) + "$^\circ$", Tan(tilt) * dir(90), N, gray(0.45) + fontsize(7pt));
}
for (pair n : faceNormals)
dot(pic, View(n), ink + 3.5px);
label(pic, "face normals", View(faceNormals[1]), NE, ink + fontsize(8pt));
dot(pic, (0, 0), ink + 2.5px);
label(pic, "up", (0, 0), SW, ink + fontsize(8pt));
frame f = pic.fit();
panels.push(f);
titles.push("Top View");
}
real gap = 36px;
real x = 0;
real bottom = 0;
for (int i = 0; i < panels.length; ++i)
{
frame f = panels[i];
pair lo = min(f);
pair hi = max(f);
add(shift(x - lo.x, -lo.y) * f);
label(titles[i], (x + 0.5 * (hi.x - lo.x), -8px), S, ink);
x += hi.x - lo.x + gap;
}
// Legend
pair legend = (0, -40px);
draw((legend.x, legend.y) -- (legend.x + 18px, legend.y), ridgeColor + 1.4px);
label("ridge spoke, 8$^\circ$ drop", (legend.x + 22px, legend.y), E, ink + fontsize(8pt));
draw((legend.x + 150px, legend.y) -- (legend.x + 168px, legend.y), gullyColor + 1.4px);
label("gully spoke, 32$^\circ$ drop", (legend.x + 172px, legend.y), E, ink + fontsize(8pt));
filldraw(shift(legend.x + 300px, legend.y - 5px) * scale(10px) * unitsquare, regionFill, regionPen);
label("vertex region", (legend.x + 314px, legend.y), E, ink + fontsize(8pt));
draw((legend.x + 410px, legend.y) -- (legend.x + 428px, legend.y), hullPen);
label("cone of face normals", (legend.x + 432px, legend.y), E, ink + fontsize(8pt));

View file

@ -0,0 +1,442 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This file was generated by dvisvgm 3.6 -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='421.026268pt' height='282.69703pt' viewBox='56.934449 301.85182 421.026268 282.69703'>
<defs>
<path id='g0-14' d='M3.257783-1.494396C3.257783-2.253549 2.64807-2.851308 1.906849-2.851308S.555915-2.247572 .555915-1.494396C.555915-.735243 1.165629-.137484 1.906849-.137484S3.257783-.74122 3.257783-1.494396ZM1.906849-.448319C1.333001-.448319 .86675-.908593 .86675-1.494396S1.333001-2.540473 1.906849-2.540473S2.946949-2.080199 2.946949-1.494396S2.480697-.448319 1.906849-.448319Z'/>
<path id='g1-101' d='M2.139975-2.773599C2.462765-2.773599 3.275716-2.797509 3.849564-3.012702C4.758157-3.359402 4.841843-4.052802 4.841843-4.267995C4.841843-4.794022 4.387547-5.272229 3.598506-5.272229C2.343213-5.272229 .537983-4.136488 .537983-2.008468C.537983-.753176 1.255293 .119552 2.343213 .119552C3.969116 .119552 4.99726-1.147696 4.99726-1.303113C4.99726-1.374844 4.925529-1.43462 4.877709-1.43462C4.841843-1.43462 4.829888-1.422665 4.722291-1.315068C3.957161-.298879 2.82142-.119552 2.367123-.119552C1.685679-.119552 1.327024-.657534 1.327024-1.542217C1.327024-1.709589 1.327024-2.008468 1.506351-2.773599H2.139975ZM1.566127-3.012702C2.080199-4.853798 3.21594-5.033126 3.598506-5.033126C4.124533-5.033126 4.483188-4.722291 4.483188-4.267995C4.483188-3.012702 2.570361-3.012702 2.068244-3.012702H1.566127Z'/>
<path id='g2-44' d='M1.490411-.119552C1.490411 .119552 1.490411 .773101 .884682 1.338979C.860772 1.362889 .836862 1.378829 .836862 1.42665C.836862 1.498381 .908593 1.546202 .948443 1.546202C1.052055 1.546202 1.713574 .924533 1.713574-.03188C1.713574-.470237 1.554172-.884682 1.171606-.884682C.908593-.884682 .73325-.67746 .73325-.446326C.73325-.207223 .900623 0 1.179577 0C1.354919 0 1.466501-.095641 1.490411-.119552Z'/>
<path id='g2-48' d='M3.897385-2.542466C3.897385-3.395268 3.809714-3.913325 3.5467-4.423412C3.196015-5.124782 2.550436-5.300125 2.11208-5.300125C1.107846-5.300125 .74122-4.550934 .629639-4.327771C.342715-3.745953 .326775-2.956912 .326775-2.542466C.326775-2.016438 .350685-1.211457 .73325-.573848C1.099875 .01594 1.689664 .167372 2.11208 .167372C2.494645 .167372 3.180075 .047821 3.57858-.74122C3.873474-1.315068 3.897385-2.024408 3.897385-2.542466ZM2.11208-.055791C1.841096-.055791 1.291158-.183313 1.123786-1.020174C1.036115-1.474471 1.036115-2.223661 1.036115-2.638107C1.036115-3.188045 1.036115-3.745953 1.123786-4.184309C1.291158-4.99726 1.912827-5.076961 2.11208-5.076961C2.383064-5.076961 2.933001-4.941469 3.092403-4.216189C3.188045-3.777833 3.188045-3.180075 3.188045-2.638107C3.188045-2.16787 3.188045-1.45056 3.092403-1.004234C2.925031-.167372 2.375093-.055791 2.11208-.055791Z'/>
<path id='g2-49' d='M2.502615-5.076961C2.502615-5.292154 2.486675-5.300125 2.271482-5.300125C1.944707-4.98132 1.522291-4.790037 .765131-4.790037V-4.527024C.980324-4.527024 1.41071-4.527024 1.872976-4.742217V-.653549C1.872976-.358655 1.849066-.263014 1.091905-.263014H.812951V0C1.139726-.02391 1.825156-.02391 2.183811-.02391S3.235866-.02391 3.56264 0V-.263014H3.283686C2.526526-.263014 2.502615-.358655 2.502615-.653549V-5.076961Z'/>
<path id='g2-50' d='M2.247572-1.625903C2.375093-1.745455 2.709838-2.008468 2.83736-2.12005C3.331507-2.574346 3.801743-3.012702 3.801743-3.737983C3.801743-4.686426 3.004732-5.300125 2.008468-5.300125C1.052055-5.300125 .422416-4.574844 .422416-3.865504C.422416-3.474969 .73325-3.419178 .844832-3.419178C1.012204-3.419178 1.259278-3.53873 1.259278-3.841594C1.259278-4.25604 .860772-4.25604 .765131-4.25604C.996264-4.837858 1.530262-5.037111 1.920797-5.037111C2.662017-5.037111 3.044583-4.407472 3.044583-3.737983C3.044583-2.909091 2.462765-2.303362 1.522291-1.338979L.518057-.302864C.422416-.215193 .422416-.199253 .422416 0H3.57061L3.801743-1.42665H3.55467C3.53076-1.267248 3.466999-.868742 3.371357-.71731C3.323537-.653549 2.717808-.653549 2.590286-.653549H1.171606L2.247572-1.625903Z'/>
<path id='g2-51' d='M2.016438-2.662017C2.646077-2.662017 3.044583-2.199751 3.044583-1.362889C3.044583-.366625 2.478705-.071731 2.056289-.071731C1.617933-.071731 1.020174-.231133 .74122-.653549C1.028144-.653549 1.227397-.836862 1.227397-1.099875C1.227397-1.354919 1.044085-1.538232 .789041-1.538232C.573848-1.538232 .350685-1.40274 .350685-1.083935C.350685-.326775 1.163636 .167372 2.072229 .167372C3.132254 .167372 3.873474-.565878 3.873474-1.362889C3.873474-2.024408 3.347447-2.630137 2.534496-2.805479C3.164134-3.028643 3.634371-3.57061 3.634371-4.208219S2.917061-5.300125 2.088169-5.300125C1.235367-5.300125 .589788-4.837858 .589788-4.23213C.589788-3.937235 .789041-3.809714 .996264-3.809714C1.243337-3.809714 1.40274-3.985056 1.40274-4.216189C1.40274-4.511083 1.147696-4.622665 .972354-4.630635C1.307098-5.068991 1.920797-5.092902 2.064259-5.092902C2.271482-5.092902 2.87721-5.029141 2.87721-4.208219C2.87721-3.650311 2.646077-3.315567 2.534496-3.188045C2.295392-2.940971 2.11208-2.925031 1.625903-2.893151C1.474471-2.885181 1.41071-2.87721 1.41071-2.773599C1.41071-2.662017 1.482441-2.662017 1.617933-2.662017H2.016438Z'/>
<path id='g2-52' d='M3.140224-5.156663C3.140224-5.316065 3.140224-5.379826 2.972852-5.379826C2.86924-5.379826 2.86127-5.371856 2.781569-5.260274L.239103-1.570112V-1.307098H2.486675V-.645579C2.486675-.350685 2.462765-.263014 1.849066-.263014H1.665753V0C2.343213-.02391 2.359153-.02391 2.81345-.02391S3.283686-.02391 3.961146 0V-.263014H3.777833C3.164134-.263014 3.140224-.350685 3.140224-.645579V-1.307098H3.985056V-1.570112H3.140224V-5.156663ZM2.542466-4.511083V-1.570112H.518057L2.542466-4.511083Z'/>
<path id='g2-53' d='M1.115816-4.479203C1.219427-4.447323 1.538232-4.367621 1.872976-4.367621C2.86924-4.367621 3.474969-5.068991 3.474969-5.188543C3.474969-5.276214 3.419178-5.300125 3.379328-5.300125C3.363387-5.300125 3.347447-5.300125 3.275716-5.260274C2.964882-5.140722 2.598257-5.045081 2.16787-5.045081C1.697634-5.045081 1.307098-5.164633 1.060025-5.260274C.980324-5.300125 .964384-5.300125 .956413-5.300125C.852802-5.300125 .852802-5.212453 .852802-5.068991V-2.733748C.852802-2.590286 .852802-2.494645 .980324-2.494645C1.044085-2.494645 1.067995-2.526526 1.107846-2.590286C1.203487-2.709838 1.506351-3.116314 2.183811-3.116314C2.630137-3.116314 2.84533-2.749689 2.917061-2.598257C3.052553-2.311333 3.068493-1.944707 3.068493-1.633873C3.068493-1.338979 3.060523-.908593 2.83736-.557908C2.685928-.318804 2.367123-.071731 1.944707-.071731C1.42665-.071731 .916563-.398506 .73325-.916563C.757161-.908593 .804981-.908593 .812951-.908593C1.036115-.908593 1.211457-1.052055 1.211457-1.299128C1.211457-1.594022 .980324-1.697634 .820922-1.697634C.67746-1.697634 .422416-1.617933 .422416-1.275218C.422416-.557908 1.044085 .167372 1.960648 .167372C2.956912 .167372 3.801743-.605729 3.801743-1.594022C3.801743-2.518555 3.132254-3.339477 2.191781-3.339477C1.793275-3.339477 1.41868-3.211955 1.115816-2.940971V-4.479203Z'/>
<path id='g2-56' d='M2.646077-2.87721C3.092403-3.092403 3.634371-3.490909 3.634371-4.112578C3.634371-4.869738 2.86127-5.300125 2.12005-5.300125C1.275218-5.300125 .589788-4.718306 .589788-3.969116C.589788-3.674222 .6934-3.403238 .892653-3.172105C1.028144-3.004732 1.060025-2.988792 1.554172-2.677958C.565878-2.239601 .350685-1.657783 .350685-1.211457C.350685-.334745 1.235367 .167372 2.10411 .167372C3.084433 .167372 3.873474-.494147 3.873474-1.338979C3.873474-1.841096 3.602491-2.175841 3.474969-2.311333C3.339477-2.438854 3.331507-2.446824 2.646077-2.87721ZM1.41071-3.626401C1.179577-3.761893 .988294-3.993026 .988294-4.27198C.988294-4.774097 1.538232-5.092902 2.10411-5.092902C2.725778-5.092902 3.235866-4.670486 3.235866-4.112578C3.235866-3.650311 2.87721-3.259776 2.406974-3.028643L1.41071-3.626401ZM1.801245-2.534496C1.833126-2.518555 2.741719-1.960648 2.87721-1.872976C3.004732-1.801245 3.419178-1.546202 3.419178-1.067995C3.419178-.454296 2.773599-.071731 2.12005-.071731C1.41071-.071731 .804981-.557908 .804981-1.211457C.804981-1.809215 1.251308-2.279452 1.801245-2.534496Z'/>
<path id='g2-97' d='M3.347447-2.375093C3.347447-3.156164 2.590286-3.55467 1.865006-3.55467C1.203487-3.55467 .613699-3.299626 .613699-2.773599C.613699-2.534496 .781071-2.391034 .988294-2.391034C1.211457-2.391034 1.362889-2.550436 1.362889-2.765629C1.362889-2.956912 1.243337-3.092403 1.067995-3.132254C1.362889-3.331507 1.793275-3.331507 1.849066-3.331507C2.295392-3.331507 2.741719-3.020672 2.741719-2.367123V-2.12005C2.279452-2.096139 1.745455-2.072229 1.187547-1.841096C.486177-1.538232 .350685-1.075965 .350685-.812951C.350685-.127522 1.155666 .079701 1.705604 .079701C2.287422 .079701 2.646077-.247073 2.82142-.565878C2.86127-.263014 3.068493 .039851 3.419178 .039851C3.498879 .039851 4.176339 .00797 4.176339-.71731V-1.155666H3.929265V-.71731C3.929265-.390535 3.809714-.263014 3.642341-.263014C3.347447-.263014 3.347447-.629639 3.347447-.71731V-2.375093ZM2.741719-1.123786C2.741719-.350685 2.088169-.143462 1.769365-.143462C1.354919-.143462 1.004234-.422416 1.004234-.804981C1.004234-1.331009 1.498381-1.872976 2.741719-1.912827V-1.123786Z'/>
<path id='g2-99' d='M2.933001-3.164134C2.709838-3.092403 2.677958-2.909091 2.677958-2.81345C2.677958-2.598257 2.82939-2.438854 3.052553-2.438854C3.259776-2.438854 3.427148-2.582316 3.427148-2.82142C3.427148-3.315567 2.885181-3.55467 2.13599-3.55467C1.028144-3.55467 .278954-2.669988 .278954-1.721544C.278954-.70934 1.107846 .079701 2.11208 .079701C3.235866 .079701 3.514819-.860772 3.514819-.956413S3.411208-1.052055 3.387298-1.052055C3.331507-1.052055 3.291656-1.044085 3.267746-.964384C3.211955-.797011 2.988792-.167372 2.191781-.167372C1.697634-.167372 .988294-.549938 .988294-1.729514C.988294-2.87721 1.578082-3.307597 2.1599-3.307597C2.231631-3.307597 2.654047-3.307597 2.933001-3.164134Z'/>
<path id='g2-100' d='M2.622167-5.443587V-5.180573C3.164134-5.180573 3.227895-5.124782 3.227895-4.734247V-3.052553C2.948941-3.355417 2.574346-3.514819 2.1599-3.514819C1.163636-3.514819 .278954-2.741719 .278954-1.713574C.278954-.73325 1.075965 .079701 2.080199 .079701C2.550436 .079701 2.940971-.143462 3.203985-.422416V.079701L4.415442 0V-.263014C3.873474-.263014 3.809714-.318804 3.809714-.70934V-5.531258L2.622167-5.443587ZM3.203985-.988294C3.203985-.844832 3.203985-.812951 3.084433-.653549C2.86127-.334745 2.494645-.143462 2.12005-.143462C1.753425-.143462 1.43462-.334745 1.243337-.629639C1.028144-.940473 .988294-1.331009 .988294-1.705604C.988294-2.16787 1.060025-2.494645 1.243337-2.773599C1.43462-3.068493 1.793275-3.291656 2.199751-3.291656C2.582316-3.291656 2.964882-3.100374 3.203985-2.685928V-.988294Z'/>
<path id='g2-101' d='M3.291656-1.817186C3.466999-1.817186 3.514819-1.817186 3.514819-2.000498C3.514819-2.709838 3.124284-3.55467 2.000498-3.55467C1.012204-3.55467 .239103-2.733748 .239103-1.745455C.239103-.71731 1.099875 .079701 2.10411 .079701C3.116314 .079701 3.514819-.773101 3.514819-.956413C3.514819-.988294 3.490909-1.067995 3.387298-1.067995C3.299626-1.067995 3.283686-1.012204 3.267746-.964384C2.980822-.191283 2.295392-.167372 2.15193-.167372C1.793275-.167372 1.42665-.334745 1.187547-.70137S.948443-1.578082 .948443-1.817186H3.291656ZM.956413-2.024408C1.028144-3.140224 1.705604-3.331507 2.000498-3.331507C2.933001-3.331507 2.964882-2.207721 2.972852-2.024408H.956413Z'/>
<path id='g2-102' d='M1.522291-3.172105H2.478705V-3.435118H1.498381V-4.335741C1.498381-5.029141 1.888917-5.387796 2.239601-5.387796C2.367123-5.387796 2.438854-5.355915 2.470735-5.347945C2.327273-5.276214 2.287422-5.140722 2.287422-5.037111C2.287422-4.829888 2.438854-4.678456 2.646077-4.678456C2.86127-4.678456 3.004732-4.829888 3.004732-5.037111C3.004732-5.379826 2.669988-5.610959 2.247572-5.610959C1.649813-5.610959 .940473-5.180573 .940473-4.327771V-3.435118H.286924V-3.172105H.940473V-.621669C.940473-.263014 .844832-.263014 .334745-.263014V0C.645579-.02391 1.083935-.02391 1.275218-.02391C1.745455-.02391 1.761395-.02391 2.279452 0V-.263014H2.12005C1.538232-.263014 1.522291-.350685 1.522291-.637609V-3.172105Z'/>
<path id='g2-103' d='M1.378829-.549938C1.131756-.573848 .932503-.789041 .932503-1.075965C.932503-1.267248 .980324-1.338979 1.036115-1.41071C1.370859-1.211457 1.681694-1.171606 1.872976-1.171606C2.662017-1.171606 3.243836-1.721544 3.243836-2.343213C3.243836-2.646077 3.108344-2.901121 2.917061-3.108344C3.028643-3.203985 3.291656-3.371357 3.682192-3.379328C3.650311-3.355417 3.610461-3.315567 3.610461-3.188045C3.610461-3.044583 3.714072-2.940971 3.857534-2.940971C3.969116-2.940971 4.104608-3.012702 4.104608-3.196015C4.104608-3.331507 4.000996-3.602491 3.650311-3.602491C3.514819-3.602491 3.132254-3.57061 2.765629-3.235866C2.566376-3.379328 2.255542-3.514819 1.880946-3.514819C1.091905-3.514819 .510087-2.964882 .510087-2.343213C.510087-1.968618 .71731-1.689664 .884682-1.530262C.70934-1.331009 .645579-1.075965 .645579-.884682C.645579-.557908 .804981-.310834 .980324-.175342C.565878-.063761 .239103 .247073 .239103 .613699C.239103 1.187547 1.060025 1.633873 2.11208 1.633873C3.108344 1.633873 3.985056 1.227397 3.985056 .597758C3.985056 .167372 3.730012-.167372 3.466999-.302864C2.996762-.549938 2.606227-.549938 1.825156-.549938H1.378829ZM1.880946-1.40274C1.139726-1.40274 1.139726-2.16787 1.139726-2.343213C1.139726-2.638107 1.179577-2.84533 1.299128-3.004732C1.43462-3.188045 1.657783-3.283686 1.872976-3.283686C2.614197-3.283686 2.614197-2.518555 2.614197-2.343213C2.614197-2.048319 2.574346-1.841096 2.454795-1.681694C2.279452-1.458531 2.024408-1.40274 1.880946-1.40274ZM2.255542-.03188C2.470735-.03188 3.514819-.03188 3.514819 .605729C3.514819 1.036115 2.901121 1.40274 2.11208 1.40274C1.315068 1.40274 .70934 1.036115 .70934 .605729C.70934 .438356 .836862-.03188 1.490411-.03188H2.255542Z'/>
<path id='g2-105' d='M1.554172-4.909589C1.554172-5.140722 1.370859-5.355915 1.107846-5.355915C.876712-5.355915 .669489-5.172603 .669489-4.917559C.669489-4.638605 .900623-4.471233 1.107846-4.471233C1.3868-4.471233 1.554172-4.702366 1.554172-4.909589ZM.358655-3.427148V-3.164134C.868742-3.164134 .940473-3.116314 .940473-2.725778V-.621669C.940473-.263014 .844832-.263014 .334745-.263014V0C.645579-.02391 1.091905-.02391 1.211457-.02391C1.315068-.02391 1.793275-.02391 2.072229 0V-.263014C1.554172-.263014 1.522291-.302864 1.522291-.613699V-3.514819L.358655-3.427148Z'/>
<path id='g2-107' d='M2.399004-2.16787L3.076463-2.709838C3.602491-3.124284 3.937235-3.164134 4.136488-3.172105V-3.435118C3.945205-3.411208 3.833624-3.411208 3.506849-3.411208C3.116314-3.411208 3.004732-3.419178 2.654047-3.435118V-3.172105C2.805479-3.164134 2.83736-3.060523 2.83736-3.012702C2.83736-2.84533 2.677958-2.709838 2.614197-2.662017L1.466501-1.737484V-5.531258L.278954-5.443587V-5.180573C.820922-5.180573 .884682-5.124782 .884682-4.734247V-.621669C.884682-.263014 .789041-.263014 .278954-.263014V0C.589788-.02391 1.020174-.02391 1.155666-.02391C1.315068-.02391 1.729514-.02391 2.040349 0V-.263014C1.530262-.263014 1.43462-.263014 1.43462-.621669V-1.39477L1.976588-1.825156C2.000498-1.825156 2.207721-1.546202 2.335243-1.39477C2.454795-1.227397 2.582316-1.067995 2.709838-.908593C2.82142-.749191 2.988792-.541968 2.988792-.422416C2.988792-.286924 2.83736-.263014 2.741719-.263014V0C3.084433-.02391 3.443088-.02391 3.57858-.02391C3.881445-.02391 4.040847-.02391 4.319801 0V-.263014C3.985056-.263014 3.841594-.294894 3.55467-.669489L2.399004-2.16787Z'/>
<path id='g2-108' d='M1.522291-5.531258L.334745-5.443587V-5.180573C.876712-5.180573 .940473-5.124782 .940473-4.734247V-.621669C.940473-.263014 .844832-.263014 .334745-.263014V0C.645579-.02391 1.091905-.02391 1.227397-.02391C1.3868-.02391 1.817186-.02391 2.12802 0V-.263014C1.617933-.263014 1.522291-.263014 1.522291-.621669V-5.531258Z'/>
<path id='g2-109' d='M6.224658-2.414944C6.224658-3.060523 5.945704-3.514819 5.076961-3.514819C4.343711-3.514819 3.977086-3.012702 3.849564-2.781569C3.706102-3.355417 3.251806-3.514819 2.733748-3.514819C1.960648-3.514819 1.594022-2.964882 1.490411-2.749689H1.482441V-3.514819L.326775-3.427148V-3.164134C.868742-3.164134 .932503-3.108344 .932503-2.717808V-.621669C.932503-.263014 .836862-.263014 .326775-.263014V0C.669489-.02391 1.020174-.02391 1.235367-.02391C1.466501-.02391 1.801245-.02391 2.14396 0V-.263014C1.633873-.263014 1.538232-.263014 1.538232-.621669V-2.064259C1.538232-2.901121 2.16787-3.291656 2.669988-3.291656C3.188045-3.291656 3.275716-2.885181 3.275716-2.446824V-.621669C3.275716-.263014 3.180075-.263014 2.669988-.263014V0C3.012702-.02391 3.363387-.02391 3.57858-.02391C3.809714-.02391 4.144458-.02391 4.487173 0V-.263014C3.977086-.263014 3.881445-.263014 3.881445-.621669V-2.064259C3.881445-2.901121 4.511083-3.291656 5.0132-3.291656C5.531258-3.291656 5.618929-2.885181 5.618929-2.446824V-.621669C5.618929-.263014 5.523288-.263014 5.0132-.263014V0C5.355915-.02391 5.7066-.02391 5.921793-.02391C6.152927-.02391 6.487671-.02391 6.830386 0V-.263014C6.320299-.263014 6.224658-.263014 6.224658-.621669V-2.414944Z'/>
<path id='g2-110' d='M3.873474-2.414944C3.873474-3.084433 3.57061-3.514819 2.733748-3.514819C1.944707-3.514819 1.586052-2.940971 1.490411-2.749689H1.482441V-3.514819L.326775-3.427148V-3.164134C.868742-3.164134 .932503-3.108344 .932503-2.717808V-.621669C.932503-.263014 .836862-.263014 .326775-.263014V0C.669489-.02391 1.020174-.02391 1.235367-.02391C1.466501-.02391 1.801245-.02391 2.14396 0V-.263014C1.633873-.263014 1.538232-.263014 1.538232-.621669V-2.064259C1.538232-2.901121 2.175841-3.291656 2.662017-3.291656S3.267746-2.948941 3.267746-2.446824V-.621669C3.267746-.263014 3.172105-.263014 2.662017-.263014V0C3.004732-.02391 3.355417-.02391 3.57061-.02391C3.801743-.02391 4.136488-.02391 4.479203 0V-.263014C3.969116-.263014 3.873474-.263014 3.873474-.621669V-2.414944Z'/>
<path id='g2-111' d='M3.985056-1.697634C3.985056-2.693898 3.164134-3.55467 2.11208-3.55467S.239103-2.693898 .239103-1.697634S1.091905 .079701 2.11208 .079701C3.140224 .079701 3.985056-.70137 3.985056-1.697634ZM2.11208-.167372C1.681694-.167372 1.346949-.374595 1.171606-.653549C.972354-.980324 .948443-1.370859 .948443-1.769365C.948443-2.072229 .948443-2.550436 1.195517-2.893151C1.40274-3.172105 1.737484-3.331507 2.11208-3.331507C2.526526-3.331507 2.86924-3.132254 3.052553-2.8533C3.267746-2.518555 3.275716-2.088169 3.275716-1.769365C3.275716-1.40274 3.259776-.964384 3.036613-.629639C2.82142-.310834 2.462765-.167372 2.11208-.167372Z'/>
<path id='g2-112' d='M2.096139 1.283188C1.586052 1.283188 1.490411 1.283188 1.490411 .924533V-.390535C1.865006 .01594 2.271482 .079701 2.526526 .079701C3.53873 .079701 4.415442-.70137 4.415442-1.721544C4.415442-2.717808 3.610461-3.514819 2.646077-3.514819C2.335243-3.514819 1.872976-3.435118 1.466501-3.020672V-3.514819L.278954-3.427148V-3.164134C.844832-3.164134 .884682-3.116314 .884682-2.781569V.924533C.884682 1.283188 .789041 1.283188 .278954 1.283188V1.546202C.621669 1.522291 .972354 1.522291 1.187547 1.522291C1.41868 1.522291 1.753425 1.522291 2.096139 1.546202V1.283188ZM1.490411-2.654047C1.673724-2.972852 2.072229-3.267746 2.574346-3.267746C3.188045-3.267746 3.706102-2.590286 3.706102-1.721544C3.706102-.804981 3.132254-.143462 2.486675-.143462C2.207721-.143462 1.841096-.263014 1.586052-.661519C1.490411-.797011 1.490411-.804981 1.490411-.956413V-2.654047Z'/>
<path id='g2-114' d='M1.466501-1.817186C1.466501-2.414944 1.713574-3.275716 2.478705-3.291656C2.430884-3.259776 2.351183-3.196015 2.351183-3.012702C2.351183-2.765629 2.542466-2.654047 2.701868-2.654047C2.893151-2.654047 3.060523-2.781569 3.060523-3.012702C3.060523-3.291656 2.805479-3.514819 2.454795-3.514819C1.936737-3.514819 1.586052-3.124284 1.41868-2.677958H1.41071V-3.514819L.278954-3.427148V-3.164134C.820922-3.164134 .884682-3.108344 .884682-2.717808V-.621669C.884682-.263014 .789041-.263014 .278954-.263014V0C.589788-.02391 1.028144-.02391 1.219427-.02391C1.689664-.02391 1.705604-.02391 2.223661 0V-.263014H2.064259C1.482441-.263014 1.466501-.350685 1.466501-.637609V-1.817186Z'/>
<path id='g2-115' d='M2.83736-3.347447C2.83736-3.474969 2.83736-3.55467 2.733748-3.55467C2.693898-3.55467 2.669988-3.55467 2.542466-3.427148C2.526526-3.419178 2.454795-3.347447 2.430884-3.347447C2.422914-3.347447 2.406974-3.347447 2.359153-3.379328C2.231631-3.466999 2.000498-3.55467 1.641843-3.55467C.526027-3.55467 .278954-2.948941 .278954-2.566376C.278954-2.16787 .573848-1.936737 .597758-1.912827C.916563-1.673724 1.099875-1.641843 1.633873-1.546202C2.008468-1.474471 2.622167-1.362889 2.622167-.820922C2.622167-.510087 2.414944-.143462 1.681694-.143462C.876712-.143462 .645579-.765131 .541968-1.187547C.510087-1.291158 .502117-1.331009 .406476-1.331009C.278954-1.331009 .278954-1.267248 .278954-1.115816V-.127522C.278954 0 .278954 .079701 .382565 .079701C.430386 .079701 .438356 .071731 .581818-.079701C.621669-.119552 .70934-.223163 .749191-.263014C1.107846 .063761 1.482441 .079701 1.689664 .079701C2.701868 .079701 3.052553-.502117 3.052553-1.028144C3.052553-1.41071 2.82142-1.968618 1.872976-2.14396C1.809215-2.1599 1.362889-2.239601 1.331009-2.239601C1.083935-2.295392 .70934-2.462765 .70934-2.781569C.70934-3.020672 .884682-3.355417 1.641843-3.355417C2.534496-3.355417 2.574346-2.701868 2.590286-2.478705C2.598257-2.414944 2.654047-2.391034 2.709838-2.391034C2.83736-2.391034 2.83736-2.446824 2.83736-2.598257V-3.347447Z'/>
<path id='g2-116' d='M1.482441-3.172105H2.669988V-3.435118H1.482441V-4.901619H1.235367C1.227397-4.176339 .900623-3.419178 .159402-3.395268V-3.172105H.876712V-.996264C.876712-.063761 1.594022 .079701 1.960648 .079701C2.494645 .079701 2.81345-.398506 2.81345-.996264V-1.44259H2.566376V-1.012204C2.566376-.462267 2.319303-.167372 2.016438-.167372C1.482441-.167372 1.482441-.852802 1.482441-.980324V-3.172105Z'/>
<path id='g2-117' d='M2.662017-3.427148V-3.164134C3.203985-3.164134 3.267746-3.108344 3.267746-2.717808V-1.331009C3.267746-.645579 2.8533-.143462 2.255542-.143462C1.570112-.143462 1.538232-.486177 1.538232-.884682V-3.514819L.326775-3.427148V-3.164134C.932503-3.164134 .932503-3.140224 .932503-2.430884V-1.235367C.932503-.661519 .932503 .079701 2.207721 .079701C2.956912 .079701 3.243836-.494147 3.283686-.565878H3.291656V.079701L4.479203 0V-.263014C3.937235-.263014 3.873474-.318804 3.873474-.70934V-3.514819L2.662017-3.427148Z'/>
<path id='g2-118' d='M3.53076-2.614197C3.722042-3.060523 3.993026-3.164134 4.28792-3.172105V-3.435118C4.008966-3.411208 3.993026-3.411208 3.666252-3.411208C3.594521-3.411208 3.219925-3.411208 2.972852-3.435118V-3.172105C3.251806-3.156164 3.323537-2.980822 3.323537-2.84533C3.323537-2.765629 3.307597-2.725778 3.275716-2.654047L2.414944-.645579L1.474471-2.805479C1.42665-2.909091 1.42665-2.956912 1.42665-2.972852C1.42665-3.172105 1.713574-3.172105 1.849066-3.172105V-3.435118C1.506351-3.411208 1.131756-3.411208 .980324-3.411208C.812951-3.411208 .430386-3.411208 .175342-3.435118V-3.172105C.661519-3.172105 .70137-3.124284 .820922-2.8533L2.016438-.095641C2.072229 .02391 2.12005 .079701 2.231631 .079701S2.399004 .01594 2.438854-.079701L3.53076-2.614197Z'/>
<path id='g2-120' d='M2.454795-1.865006C2.677958-2.14396 2.909091-2.414944 3.148194-2.677958C3.411208-2.956912 3.690162-3.164134 4.192279-3.172105V-3.435118C3.881445-3.411208 3.865504-3.411208 3.506849-3.411208C3.466999-3.411208 2.996762-3.411208 2.749689-3.435118V-3.172105C2.901121-3.156164 2.933001-3.060523 2.933001-2.956912S2.893151-2.757659 2.797509-2.646077L2.295392-2.056289L1.665753-2.805479C1.570112-2.917061 1.570112-2.972852 1.570112-2.988792C1.570112-3.044583 1.617933-3.164134 1.817186-3.172105V-3.435118C1.498381-3.411208 1.052055-3.411208 .964384-3.411208C.820922-3.411208 .414446-3.411208 .175342-3.435118V-3.172105C.71731-3.172105 .72528-3.164134 1.139726-2.677958L1.960648-1.681694L1.235367-.828892C1.036115-.605729 .74122-.278954 .135492-.263014V0C.430386-.02391 .486177-.02391 .820922-.02391C.836862-.02391 1.323039-.02391 1.578082 0V-.263014C1.474471-.278954 1.3868-.334745 1.3868-.478207S1.482441-.73325 1.506351-.773101C1.705604-1.012204 1.920797-1.251308 2.12802-1.482441L2.781569-.70137C2.940971-.518057 2.940971-.502117 2.940971-.446326C2.940971-.382565 2.885181-.270984 2.693898-.263014V0C3.036613-.02391 3.395268-.02391 3.5467-.02391C3.690162-.02391 4.096638-.02391 4.335741 0V-.263014C3.841594-.263014 3.761893-.302864 3.55467-.549938L2.454795-1.865006Z'/>
<path id='g2-121' d='M3.53076-2.630137C3.730012-3.084433 4.024907-3.164134 4.28792-3.172105V-3.435118C4.008966-3.411208 3.993026-3.411208 3.658281-3.411208C3.626401-3.411208 3.203985-3.411208 2.972852-3.435118V-3.172105C3.203985-3.156164 3.315567-3.028643 3.315567-2.84533C3.315567-2.797509 3.307597-2.741719 3.267746-2.646077L2.414944-.71731L1.490411-2.805479C1.43462-2.925031 1.43462-2.940971 1.43462-2.972852C1.43462-3.164134 1.681694-3.172105 1.857036-3.172105V-3.435118C1.498381-3.411208 1.155666-3.411208 .980324-3.411208C.812951-3.411208 .430386-3.411208 .175342-3.435118V-3.172105C.589788-3.172105 .70137-3.156164 .836862-2.8533L2.096139 0C1.737484 .844832 1.498381 1.40274 .940473 1.40274C.74122 1.40274 .613699 1.307098 .613699 1.307098C.669489 1.291158 .852802 1.203487 .852802 .972354C.852802 .749191 .68543 .629639 .510087 .629639C.350685 .629639 .167372 .73325 .167372 .980324C.167372 1.331009 .510087 1.625903 .940473 1.625903C1.649813 1.625903 2.032379 .773101 2.064259 .6934L3.53076-2.630137Z'/>
<path id='g3-83' d='M2.486675-4.985305C1.876961-5.140722 1.338979-5.738481 1.338979-6.503611C1.338979-7.340473 2.008468-8.093649 2.940971-8.093649C4.901619-8.093649 5.164633-6.156912 5.236364-5.642839C5.260274-5.499377 5.260274-5.451557 5.379826-5.451557C5.511333-5.451557 5.511333-5.511333 5.511333-5.726526V-8.141469C5.511333-8.356663 5.511333-8.416438 5.391781-8.416438C5.355915-8.416438 5.308095-8.416438 5.224408-8.261021L4.829888-7.531756C4.25604-8.272976 3.466999-8.416438 2.940971-8.416438C1.613948-8.416438 .645579-7.352428 .645579-6.133001C.645579-5.559153 .848817-5.033126 1.291158-4.554919C1.709589-4.088667 2.12802-3.981071 2.976837-3.765878C3.395268-3.670237 4.052802-3.502864 4.220174-3.431133C4.782067-3.156164 5.152677-2.510585 5.152677-1.841096C5.152677-.944458 4.519054-.095641 3.526775-.095641C2.988792-.095641 2.247572-.227148 1.661768-.74122C.968369-1.362889 .920548-2.223661 .908593-2.618182C.896638-2.713823 .800996-2.713823 .777086-2.713823C.645579-2.713823 .645579-2.654047 .645579-2.438854V-.02391C.645579 .191283 .645579 .251059 .765131 .251059C.836862 .251059 .848817 .227148 .932503 .083686C.980324-.011955 1.231382-.454296 1.327024-.633624C1.75741-.155417 2.510585 .251059 3.53873 .251059C4.877709 .251059 5.846077-.884682 5.846077-2.199751C5.846077-2.929016 5.571108-3.466999 5.248319-3.861519C4.805978-4.399502 4.267995-4.531009 3.801743-4.65056L2.486675-4.985305Z'/>
<path id='g3-84' d='M7.806725-8.105604H.633624L.418431-5.439601H.681445C.848817-7.328518 .956413-7.758904 2.84533-7.758904C3.060523-7.758904 3.395268-7.758904 3.490909-7.734994C3.730012-7.699128 3.741968-7.555666 3.741968-7.280697V-.920548C3.741968-.514072 3.741968-.3467 2.570361-.3467H2.139975V0C2.52254-.02391 3.753923-.02391 4.220174-.02391S5.929763-.02391 6.312329 0V-.3467H5.881943C4.710336-.3467 4.710336-.514072 4.710336-.920548V-7.280697C4.710336-7.579577 4.734247-7.687173 4.925529-7.734994C5.021171-7.758904 5.36787-7.758904 5.595019-7.758904C7.483935-7.758904 7.591532-7.328518 7.758904-5.439601H8.021918L7.806725-8.105604Z'/>
<path id='g3-86' d='M7.304608-6.981818C7.412204-7.280697 7.615442-7.806725 8.547945-7.81868V-8.16538C7.938232-8.141469 7.914321-8.141469 7.44807-8.141469C7.12528-8.141469 6.527522-8.141469 6.228643-8.16538V-7.81868C6.838356-7.806725 7.017684-7.47198 7.017684-7.232877C7.017684-7.161146 7.017684-7.137235 6.945953-6.969863L4.710336-1.075965L2.355168-7.292653C2.295392-7.424159 2.295392-7.44807 2.295392-7.47198C2.295392-7.81868 2.893151-7.81868 3.19203-7.81868V-8.16538C2.905106-8.141469 1.996513-8.141469 1.649813-8.141469C1.315068-8.141469 .502117-8.141469 .215193-8.16538V-7.81868C.956413-7.81868 1.147696-7.81868 1.327024-7.340473L4.124533 .02391C4.184309 .191283 4.208219 .251059 4.375592 .251059S4.554919 .215193 4.638605 .011955L7.304608-6.981818Z'/>
<path id='g3-97' d='M4.614695-3.19203C4.614695-3.837609 4.614695-4.315816 4.088667-4.782067C3.670237-5.164633 3.132254-5.332005 2.606227-5.332005C1.625903-5.332005 .872727-4.686426 .872727-3.90934C.872727-3.56264 1.099875-3.395268 1.374844-3.395268C1.661768-3.395268 1.865006-3.598506 1.865006-3.88543C1.865006-4.375592 1.43462-4.375592 1.255293-4.375592C1.530262-4.877709 2.10411-5.092902 2.582316-5.092902C3.132254-5.092902 3.837609-4.638605 3.837609-3.56264V-3.084433C1.43462-3.048568 .526027-2.044334 .526027-1.123786C.526027-.179328 1.625903 .119552 2.355168 .119552C3.144209 .119552 3.682192-.358655 3.90934-.932503C3.957161-.37061 4.327771 .059776 4.841843 .059776C5.092902 .059776 5.786301-.107597 5.786301-1.06401V-1.733499H5.523288V-1.06401C5.523288-.382565 5.236364-.286924 5.068991-.286924C4.614695-.286924 4.614695-.920548 4.614695-1.099875V-3.19203ZM3.837609-1.685679C3.837609-.514072 2.964882-.119552 2.450809-.119552C1.865006-.119552 1.374844-.549938 1.374844-1.123786C1.374844-2.701868 3.407223-2.84533 3.837609-2.86924V-1.685679Z'/>
<path id='g3-100' d='M3.58655-8.16538V-7.81868C4.399502-7.81868 4.495143-7.734994 4.495143-7.149191V-4.507098C4.244085-4.853798 3.730012-5.272229 3.000747-5.272229C1.613948-5.272229 .418431-4.100623 .418431-2.570361C.418431-1.052055 1.554172 .119552 2.86924 .119552C3.777833 .119552 4.303861-.478207 4.471233-.705355V.119552L6.156912 0V-.3467C5.34396-.3467 5.248319-.430386 5.248319-1.016189V-8.296887L3.58655-8.16538ZM4.471233-1.398755C4.471233-1.183562 4.471233-1.147696 4.303861-.884682C4.016936-.466252 3.526775-.119552 2.929016-.119552C2.618182-.119552 1.327024-.239103 1.327024-2.558406C1.327024-3.419178 1.470486-3.897385 1.733499-4.291905C1.972603-4.662516 2.450809-5.033126 3.048568-5.033126C3.789788-5.033126 4.208219-4.495143 4.327771-4.303861C4.471233-4.100623 4.471233-4.076712 4.471233-3.861519V-1.398755Z'/>
<path id='g3-101' d='M4.578829-2.773599C4.841843-2.773599 4.865753-2.773599 4.865753-3.000747C4.865753-4.208219 4.220174-5.332005 2.773599-5.332005C1.41071-5.332005 .358655-4.100623 .358655-2.618182C.358655-1.0401 1.578082 .119552 2.905106 .119552C4.327771 .119552 4.865753-1.171606 4.865753-1.422665C4.865753-1.494396 4.805978-1.542217 4.734247-1.542217C4.638605-1.542217 4.614695-1.482441 4.590785-1.422665C4.27995-.418431 3.478954-.143462 2.976837-.143462S1.267248-.478207 1.267248-2.546451V-2.773599H4.578829ZM1.279203-3.000747C1.374844-4.877709 2.426899-5.092902 2.761644-5.092902C4.040847-5.092902 4.112578-3.407223 4.124533-3.000747H1.279203Z'/>
<path id='g3-105' d='M2.080199-7.364384C2.080199-7.675218 1.829141-7.950187 1.494396-7.950187C1.183562-7.950187 .920548-7.699128 .920548-7.376339C.920548-7.017684 1.207472-6.790535 1.494396-6.790535C1.865006-6.790535 2.080199-7.10137 2.080199-7.364384ZM.430386-5.140722V-4.794022C1.195517-4.794022 1.303113-4.722291 1.303113-4.136488V-.884682C1.303113-.3467 1.171606-.3467 .394521-.3467V0C.729265-.02391 1.303113-.02391 1.649813-.02391C1.78132-.02391 2.47472-.02391 2.881196 0V-.3467C2.10411-.3467 2.056289-.406476 2.056289-.872727V-5.272229L.430386-5.140722Z'/>
<path id='g3-108' d='M2.056289-8.296887L.394521-8.16538V-7.81868C1.207472-7.81868 1.303113-7.734994 1.303113-7.149191V-.884682C1.303113-.3467 1.171606-.3467 .394521-.3467V0C.729265-.02391 1.315068-.02391 1.673724-.02391S2.630137-.02391 2.964882 0V-.3467C2.199751-.3467 2.056289-.3467 2.056289-.884682V-8.296887Z'/>
<path id='g3-110' d='M5.32005-2.905106C5.32005-4.016936 5.32005-4.351681 5.045081-4.734247C4.698381-5.200498 4.136488-5.272229 3.730012-5.272229C2.570361-5.272229 2.116065-4.27995 2.020423-4.040847H2.008468V-5.272229L.382565-5.140722V-4.794022C1.195517-4.794022 1.291158-4.710336 1.291158-4.124533V-.884682C1.291158-.3467 1.159651-.3467 .382565-.3467V0C.6934-.02391 1.338979-.02391 1.673724-.02391C2.020423-.02391 2.666002-.02391 2.976837 0V-.3467C2.211706-.3467 2.068244-.3467 2.068244-.884682V-3.108344C2.068244-4.363636 2.893151-5.033126 3.634371-5.033126S4.542964-4.423412 4.542964-3.694147V-.884682C4.542964-.3467 4.411457-.3467 3.634371-.3467V0C3.945205-.02391 4.590785-.02391 4.925529-.02391C5.272229-.02391 5.917808-.02391 6.228643 0V-.3467C5.630884-.3467 5.332005-.3467 5.32005-.705355V-2.905106Z'/>
<path id='g3-111' d='M5.487422-2.558406C5.487422-4.100623 4.315816-5.332005 2.929016-5.332005C1.494396-5.332005 .358655-4.064757 .358655-2.558406C.358655-1.028144 1.554172 .119552 2.917061 .119552C4.327771 .119552 5.487422-1.052055 5.487422-2.558406ZM2.929016-.143462C2.486675-.143462 1.948692-.334745 1.601993-.920548C1.279203-1.458531 1.267248-2.163885 1.267248-2.666002C1.267248-3.120299 1.267248-3.849564 1.637858-4.387547C1.972603-4.901619 2.49863-5.092902 2.917061-5.092902C3.383313-5.092902 3.88543-4.877709 4.208219-4.411457C4.578829-3.861519 4.578829-3.108344 4.578829-2.666002C4.578829-2.247572 4.578829-1.506351 4.267995-.944458C3.93325-.37061 3.383313-.143462 2.929016-.143462Z'/>
<path id='g3-112' d='M2.929016 1.972603C2.163885 1.972603 2.020423 1.972603 2.020423 1.43462V-.645579C2.235616-.3467 2.725778 .119552 3.490909 .119552C4.865753 .119552 6.073225-1.0401 6.073225-2.582316C6.073225-4.100623 4.94944-5.272229 3.646326-5.272229C2.594271-5.272229 2.032379-4.519054 1.996513-4.471233V-5.272229L.334745-5.140722V-4.794022C1.171606-4.794022 1.243337-4.710336 1.243337-4.184309V1.43462C1.243337 1.972603 1.111831 1.972603 .334745 1.972603V2.319303C.645579 2.295392 1.291158 2.295392 1.625903 2.295392C1.972603 2.295392 2.618182 2.295392 2.929016 2.319303V1.972603ZM2.020423-3.813699C2.020423-4.040847 2.020423-4.052802 2.15193-4.244085C2.510585-4.782067 3.096389-5.009215 3.550685-5.009215C4.447323-5.009215 5.164633-3.921295 5.164633-2.582316C5.164633-1.159651 4.351681-.119552 3.431133-.119552C3.060523-.119552 2.713823-.274969 2.47472-.502117C2.199751-.777086 2.020423-1.016189 2.020423-1.350934V-3.813699Z'/>
<path id='g3-114' d='M1.996513-2.785554C1.996513-3.945205 2.47472-5.033126 3.395268-5.033126C3.490909-5.033126 3.514819-5.033126 3.56264-5.021171C3.466999-4.97335 3.275716-4.901619 3.275716-4.578829C3.275716-4.23213 3.550685-4.100623 3.741968-4.100623C3.981071-4.100623 4.220174-4.25604 4.220174-4.578829C4.220174-4.937484 3.897385-5.272229 3.383313-5.272229C2.367123-5.272229 2.020423-4.172354 1.948692-3.945205H1.936737V-5.272229L.334745-5.140722V-4.794022C1.147696-4.794022 1.243337-4.710336 1.243337-4.124533V-.884682C1.243337-.3467 1.111831-.3467 .334745-.3467V0C.669489-.02391 1.327024-.02391 1.685679-.02391C2.008468-.02391 2.857285-.02391 3.132254 0V-.3467H2.893151C2.020423-.3467 1.996513-.478207 1.996513-.908593V-2.785554Z'/>
<path id='g3-116' d='M2.008468-4.805978H3.694147V-5.152677H2.008468V-7.352428H1.745455C1.733499-6.228643 1.303113-5.080946 .215193-5.045081V-4.805978H1.231382V-1.482441C1.231382-.155417 2.116065 .119552 2.749689 .119552C3.502864 .119552 3.897385-.621669 3.897385-1.482441V-2.163885H3.634371V-1.506351C3.634371-.645579 3.287671-.143462 2.82142-.143462C2.008468-.143462 2.008468-1.255293 2.008468-1.458531V-4.805978Z'/>
<path id='g3-119' d='M7.232877-4.016936C7.49589-4.770112 8.021918-4.794022 8.225156-4.805978V-5.152677C7.926276-5.128767 7.711083-5.128767 7.340473-5.128767C6.993773-5.128767 6.969863-5.128767 6.324284-5.152677V-4.805978C6.862267-4.782067 7.005729-4.459278 7.005729-4.23213C7.005729-4.220174 7.005729-4.136488 6.957908-4.016936L5.858032-.884682L4.662516-4.267995C4.60274-4.411457 4.60274-4.435367 4.60274-4.471233C4.60274-4.805978 5.045081-4.805978 5.296139-4.805978V-5.152677C4.961395-5.128767 4.471233-5.128767 4.124533-5.128767C3.741968-5.128767 3.718057-5.128767 3.048568-5.152677V-4.805978C3.502864-4.805978 3.658281-4.782067 3.789788-4.62665C3.849564-4.554919 3.993026-4.160399 4.076712-3.921295L3.060523-1.004234L1.912827-4.25604C1.853051-4.411457 1.853051-4.435367 1.853051-4.483188C1.853051-4.805978 2.319303-4.805978 2.546451-4.805978V-5.152677C2.247572-5.128767 1.649813-5.128767 1.327024-5.128767C.992279-5.128767 .968369-5.128767 .215193-5.152677V-4.805978C.824907-4.805978 .944458-4.758157 1.075965-4.375592L2.582316-.095641C2.630137 .035866 2.666002 .119552 2.797509 .119552C2.905106 .119552 2.964882 .083686 3.024658-.107597L4.220174-3.514819L5.415691-.107597C5.475467 .083686 5.535243 .119552 5.642839 .119552C5.774346 .119552 5.810212 .035866 5.858032-.095641L7.232877-4.016936Z'/>
<path id='g3-120' d='M3.347447-2.82142C3.694147-3.275716 4.196264-3.921295 4.423412-4.172354C4.913574-4.722291 5.475467-4.805978 5.858032-4.805978V-5.152677C5.34396-5.128767 5.32005-5.128767 4.853798-5.128767C4.399502-5.128767 4.375592-5.128767 3.777833-5.152677V-4.805978C3.93325-4.782067 4.124533-4.710336 4.124533-4.435367C4.124533-4.23213 4.016936-4.100623 3.945205-4.004981L3.180075-3.036613L2.247572-4.267995C2.211706-4.315816 2.139975-4.423412 2.139975-4.507098C2.139975-4.578829 2.199751-4.794022 2.558406-4.805978V-5.152677C2.259527-5.128767 1.649813-5.128767 1.327024-5.128767C.932503-5.128767 .908593-5.128767 .179328-5.152677V-4.805978C.789041-4.805978 1.016189-4.782067 1.267248-4.459278L2.666002-2.630137C2.689913-2.606227 2.737733-2.534496 2.737733-2.49863S1.80523-1.291158 1.685679-1.135741C1.159651-.490162 .633624-.358655 .119552-.3467V0C.573848-.02391 .597758-.02391 1.111831-.02391C1.566127-.02391 1.590037-.02391 2.187796 0V-.3467C1.900872-.382565 1.853051-.561893 1.853051-.729265C1.853051-.920548 1.936737-1.016189 2.056289-1.171606C2.235616-1.422665 2.630137-1.912827 2.917061-2.283437L3.897385-1.004234C4.100623-.74122 4.100623-.71731 4.100623-.645579C4.100623-.549938 4.004981-.358655 3.682192-.3467V0C3.993026-.02391 4.578829-.02391 4.913574-.02391C5.308095-.02391 5.332005-.02391 6.049315 0V-.3467C5.415691-.3467 5.200498-.37061 4.913574-.753176L3.347447-2.82142Z'/>
<path id='g4-14' d='M3.043587-1.24533C3.043587-1.912827 2.500623-2.455791 1.833126-2.455791S.622665-1.912827 .622665-1.24533S1.165629-.034869 1.833126-.034869S3.043587-.577833 3.043587-1.24533ZM1.833126-.313823C1.32005-.313823 .901619-.732254 .901619-1.24533S1.32005-2.176837 1.833126-2.176837S2.764633-1.758406 2.764633-1.24533S2.346202-.313823 1.833126-.313823Z'/>
<path id='g5-48' d='M3.598506-2.224658C3.598506-2.991781 3.507846-3.542715 3.187049-4.030884C2.970859-4.351681 2.538481-4.630635 1.980573-4.630635C.36264-4.630635 .36264-2.726775 .36264-2.224658S.36264 .139477 1.980573 .139477S3.598506-1.72254 3.598506-2.224658ZM1.980573-.055791C1.659776-.055791 1.234371-.244085 1.094894-.81594C.99726-1.227397 .99726-1.799253 .99726-2.315318C.99726-2.824408 .99726-3.354421 1.101868-3.737983C1.248319-4.288917 1.694645-4.435367 1.980573-4.435367C2.357161-4.435367 2.719801-4.20523 2.84533-3.800747C2.956912-3.424159 2.963885-2.922042 2.963885-2.315318C2.963885-1.799253 2.963885-1.283188 2.873225-.843836C2.733748-.209215 2.259527-.055791 1.980573-.055791Z'/>
<path id='g5-49' d='M2.336239-4.435367C2.336239-4.623661 2.322291-4.630635 2.127024-4.630635C1.680697-4.191283 1.046077-4.184309 .760149-4.184309V-3.93325C.927522-3.93325 1.387796-3.93325 1.771357-4.128518V-.571856C1.771357-.341719 1.771357-.251059 1.073973-.251059H.808966V0C.934496-.006974 1.792279-.027895 2.050311-.027895C2.266501-.027895 3.145205-.006974 3.29863 0V-.251059H3.033624C2.336239-.251059 2.336239-.341719 2.336239-.571856V-4.435367Z'/>
<path id='g5-50' d='M3.521793-1.26924H3.284682C3.263761-1.115816 3.194022-.704359 3.103362-.63462C3.047572-.592777 2.510585-.592777 2.412951-.592777H1.129763C1.862017-1.241345 2.106102-1.436613 2.524533-1.764384C3.040598-2.175841 3.521793-2.608219 3.521793-3.270735C3.521793-4.11457 2.782565-4.630635 1.889913-4.630635C1.025156-4.630635 .439352-4.02391 .439352-3.382316C.439352-3.02665 .739228-2.991781 .808966-2.991781C.976339-2.991781 1.17858-3.110336 1.17858-3.361395C1.17858-3.486924 1.129763-3.731009 .767123-3.731009C.983313-4.226152 1.457534-4.379577 1.785305-4.379577C2.48269-4.379577 2.84533-3.835616 2.84533-3.270735C2.84533-2.66401 2.412951-2.182814 2.189788-1.931756L.509091-.27198C.439352-.209215 .439352-.195268 .439352 0H3.312578L3.521793-1.26924Z'/>
<path id='g5-51' d='M1.903861-2.329265C2.447821-2.329265 2.838356-1.952677 2.838356-1.206476C2.838356-.341719 2.336239-.083686 1.931756-.083686C1.652802-.083686 1.039103-.160399 .746202-.571856C1.073973-.585803 1.150685-.81594 1.150685-.962391C1.150685-1.185554 .983313-1.345953 .767123-1.345953C.571856-1.345953 .376588-1.227397 .376588-.941469C.376588-.285928 1.101868 .139477 1.945704 .139477C2.915068 .139477 3.584558-.509091 3.584558-1.206476C3.584558-1.750436 3.138232-2.294396 2.371108-2.454795C3.103362-2.719801 3.368369-3.242839 3.368369-3.668244C3.368369-4.219178 2.733748-4.630635 1.959651-4.630635S.592777-4.254047 .592777-3.696139C.592777-3.459029 .746202-3.326526 .955417-3.326526C1.171606-3.326526 1.311083-3.486924 1.311083-3.682192C1.311083-3.884433 1.171606-4.030884 .955417-4.044832C1.199502-4.351681 1.680697-4.428394 1.93873-4.428394C2.252553-4.428394 2.691905-4.274969 2.691905-3.668244C2.691905-3.375342 2.594271-3.054545 2.412951-2.838356C2.182814-2.57335 1.987547-2.559402 1.638854-2.538481C1.464508-2.524533 1.45056-2.524533 1.415691-2.517559C1.401743-2.517559 1.345953-2.503611 1.345953-2.426899C1.345953-2.329265 1.408717-2.329265 1.527273-2.329265H1.903861Z'/>
<path id='g5-52' d='M3.689166-1.143711V-1.39477H2.915068V-4.505106C2.915068-4.651557 2.915068-4.700374 2.761644-4.700374C2.677958-4.700374 2.650062-4.700374 2.580324-4.60274L.27198-1.39477V-1.143711H2.322291V-.571856C2.322291-.334745 2.322291-.251059 1.75741-.251059H1.569116V0C1.917808-.013948 2.364134-.027895 2.615193-.027895C2.873225-.027895 3.319552-.013948 3.668244 0V-.251059H3.47995C2.915068-.251059 2.915068-.334745 2.915068-.571856V-1.143711H3.689166ZM2.371108-3.947198V-1.39477H.530012L2.371108-3.947198Z'/>
</defs>
<g id='page1'>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L121.782 206.781L49.993 240.848L77.8071 165.443Z' fill='#d7e3f4'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L121.782 206.781L49.993 240.848L77.8071 165.443Z' fill='none' stroke='#231f20' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.451687'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L49.993 240.848L6.01782 179.13L77.8071 165.443Z' fill='#d6e2f3'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L49.993 240.848L6.01782 179.13L77.8071 165.443Z' fill='none' stroke='#231f20' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.451687'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L6.01782 179.13L33.8319 169.481L77.8071 165.443Z' fill='#bec8d7'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L6.01782 179.13L33.8319 169.481L77.8071 165.443Z' fill='none' stroke='#231f20' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.451687'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L33.8319 169.481L105.621 135.413L77.8071 165.443Z' fill='#c6d1e1'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L33.8319 169.481L105.621 135.413L77.8071 165.443Z' fill='none' stroke='#231f20' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.451687'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L105.621 135.413L149.596 197.131L77.8071 165.443Z' fill='#c4cfdf'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L105.621 135.413L149.596 197.131L77.8071 165.443Z' fill='none' stroke='#231f20' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.451687'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L149.596 197.131L121.782 206.781L77.8071 165.443Z' fill='#bcc7d6'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L149.596 197.131L121.782 206.781L77.8071 165.443Z' fill='none' stroke='#231f20' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.451687'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L121.782 206.781' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='1.05394'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M126.099 209.539C126.422 209.539 127.237 209.515 127.813 209.299C128.724 208.951 128.809 208.256 128.809 208.039C128.809 207.513 128.353 207.033 127.562 207.033C126.303 207.033 124.491 208.171 124.491 210.306C124.491 211.565 125.211 212.44 126.303 212.44C127.934 212.44 128.964 211.17 128.964 211.013C128.964 210.943 128.894 210.881 128.845 210.881C128.809 210.881 128.796 210.894 128.69 211.002C127.921 212.022 126.783 212.202 126.326 212.202C125.642 212.202 125.283 211.661 125.283 210.775C125.283 210.605 125.283 210.306 125.464 209.539H126.099ZM125.523 209.299C126.039 207.451 127.178 207.273 127.562 207.273C128.089 207.273 128.45 207.583 128.45 208.039C128.45 209.299 126.53 209.299 126.027 209.299H125.523ZM133.282 211.578C133.282 210.721 133.194 210.202 132.931 209.691C132.578 208.987 131.93 208.811 131.491 208.811C130.484 208.811 130.115 209.562 130.004 209.787C129.715 210.37 129.7 211.162 129.7 211.578C129.7 212.105 129.723 212.912 130.108 213.552C130.476 214.144 131.067 214.296 131.491 214.296C131.875 214.296 132.562 214.176 132.962 213.384C133.258 212.809 133.282 212.097 133.282 211.578ZM131.491 214.071C131.219 214.071 130.667 213.944 130.5 213.104C130.412 212.649 130.412 211.898 130.412 211.482C130.412 210.93 130.412 210.37 130.5 209.931C130.667 209.115 131.292 209.035 131.491 209.035C131.762 209.035 132.314 209.17 132.474 209.898C132.57 210.339 132.57 210.938 132.57 211.482C132.57 211.953 132.57 212.672 132.474 213.121C132.306 213.96 131.754 214.071 131.491 214.071Z' fill='#c26a17'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L49.993 240.848' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='1.05394'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M45.793 244.335C46.116 244.335 46.9316 244.311 47.5072 244.095C48.4184 243.746 48.5031 243.052 48.5031 242.835C48.5031 242.308 48.0467 241.828 47.2562 241.828C45.9968 241.828 44.1854 242.967 44.1854 245.101C44.1854 246.361 44.9053 247.236 45.9968 247.236C47.6279 247.236 48.6584 245.966 48.6584 245.809C48.6584 245.738 48.5878 245.677 48.5392 245.677C48.5031 245.677 48.4905 245.69 48.3839 245.798C47.6154 246.817 46.4768 246.998 46.0204 246.998C45.3366 246.998 44.9774 246.457 44.9774 245.57C44.9774 245.401 44.9774 245.101 45.1578 244.335H45.793ZM45.2174 244.095C45.7334 242.247 46.872 242.068 47.2562 242.068C47.7832 242.068 48.1439 242.379 48.1439 242.835C48.1439 244.095 46.2243 244.095 45.7208 244.095H45.2174ZM51.5771 243.831C51.5771 243.615 51.5614 243.607 51.345 243.607C51.0172 243.927 50.5937 244.118 49.8331 244.118V244.382C50.0495 244.382 50.4808 244.382 50.945 244.167V248.268C50.945 248.564 50.9215 248.66 50.1608 248.66H49.8817V248.924C50.2095 248.9 50.8964 248.9 51.2571 248.9C51.6163 248.9 52.3126 248.9 52.6404 248.924V248.66H52.3597C51.6006 248.66 51.5771 248.564 51.5771 248.268V243.831Z' fill='#1f5c99'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L6.01782 179.13' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='1.05394'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M2.13454 170.967C2.45762 170.967 3.27317 170.944 3.84876 170.727C4.75997 170.379 4.84466 169.684 4.84466 169.468C4.84466 168.941 4.38828 168.461 3.59782 168.461C2.33842 168.461 .526969 169.6 .526969 171.734C.526969 172.994 1.24684 173.869 2.33842 173.869C3.96952 173.869 4.99993 172.599 4.99993 172.442C4.99993 172.371 4.92936 172.31 4.88074 172.31C4.84466 172.31 4.83211 172.322 4.72546 172.431C3.95697 173.45 2.81834 173.63 2.36195 173.63C1.67815 173.63 1.31899 173.089 1.31899 172.203C1.31899 172.034 1.31899 171.734 1.49935 170.967H2.13454ZM1.55895 170.727C2.07494 168.88 3.21356 168.701 3.59782 168.701C4.12479 168.701 4.48551 169.012 4.48551 169.468C4.48551 170.727 2.56584 170.727 2.0624 170.727H1.55895ZM7.66301 173.925C7.79005 173.806 8.12567 173.541 8.25427 173.43C8.74988 172.973 9.22196 172.534 9.22196 171.806C9.22196 170.855 8.42209 170.24 7.42305 170.24C6.46321 170.24 5.83117 170.967 5.83117 171.678C5.83117 172.07 6.14327 172.126 6.25462 172.126C6.42243 172.126 6.67024 172.007 6.67024 171.703C6.67024 171.287 6.27187 171.287 6.17463 171.287C6.40675 170.704 6.94313 170.503 7.33522 170.503C8.07862 170.503 8.4613 171.135 8.4613 171.806C8.4613 172.638 7.87787 173.246 6.93529 174.214L5.92683 175.252C5.83117 175.34 5.83117 175.357 5.83117 175.556H8.98984L9.22196 174.125H8.97416C8.94905 174.285 8.88632 174.684 8.78908 174.837C8.74204 174.901 8.13351 174.901 8.00647 174.901H6.5824L7.66301 173.925Z' fill='#c26a17'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L33.8319 169.481' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='1.05394'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M20.1297 166.155C20.4528 166.155 21.2684 166.131 21.8439 165.915C22.7552 165.567 22.8398 164.872 22.8398 164.656C22.8398 164.129 22.3835 163.649 21.593 163.649C20.3336 163.649 18.5222 164.787 18.5222 166.922C18.5222 168.181 19.242 169.056 20.3336 169.056C21.9647 169.056 22.9951 167.786 22.9951 167.629C22.9951 167.559 22.9245 167.497 22.8759 167.497C22.8398 167.497 22.8273 167.51 22.7206 167.618C21.9522 168.638 20.8135 168.818 20.3571 168.818C19.6733 168.818 19.3142 168.277 19.3142 167.391C19.3142 167.221 19.3142 166.922 19.4945 166.155H20.1297ZM19.5541 165.915C20.0701 164.067 21.2087 163.889 21.593 163.889C22.12 163.889 22.4807 164.199 22.4807 164.656C22.4807 165.915 20.561 165.915 20.0576 165.915H19.5541ZM25.4261 168.073C26.0581 168.073 26.4565 168.537 26.4565 169.376C26.4565 170.375 25.8887 170.672 25.4653 170.672C25.0261 170.672 24.427 170.512 24.1463 170.088C24.4349 170.088 24.634 169.905 24.634 169.64C24.634 169.384 24.4506 169.201 24.1949 169.201C23.9785 169.201 23.7542 169.337 23.7542 169.657C23.7542 170.416 24.5697 170.912 25.481 170.912C26.5443 170.912 27.2893 170.176 27.2893 169.376C27.2893 168.713 26.7607 168.106 25.9452 167.93C26.5773 167.706 27.0493 167.162 27.0493 166.522S26.3294 165.427 25.4982 165.427C24.6419 165.427 23.9942 165.891 23.9942 166.498C23.9942 166.795 24.1949 166.922 24.4019 166.922C24.6497 166.922 24.8097 166.746 24.8097 166.514C24.8097 166.219 24.5541 166.106 24.3784 166.098C24.714 165.659 25.3304 165.634 25.4731 165.634C25.6817 165.634 26.2887 165.698 26.2887 166.522C26.2887 167.082 26.0581 167.417 25.9452 167.546C25.7052 167.794 25.5217 167.809 25.034 167.841C24.8819 167.85 24.8175 167.858 24.8175 167.962C24.8175 168.073 24.8897 168.073 25.0261 168.073H25.4261Z' fill='#1f5c99'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L105.621 135.413' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='1.05394'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M113.134 136.446C113.457 136.446 114.273 136.422 114.848 136.206C115.76 135.857 115.844 135.163 115.844 134.946C115.844 134.419 115.388 133.939 114.597 133.939C113.338 133.939 111.527 135.078 111.527 137.213C111.527 138.472 112.246 139.347 113.338 139.347C114.969 139.347 116 138.077 116 137.92C116 137.849 115.929 137.788 115.88 137.788C115.844 137.788 115.832 137.801 115.725 137.909C114.957 138.928 113.818 139.109 113.362 139.109C112.678 139.109 112.319 138.568 112.319 137.681C112.319 137.512 112.319 137.213 112.499 136.446H113.134ZM112.559 136.206C113.075 134.358 114.213 134.179 114.597 134.179C115.124 134.179 115.485 134.49 115.485 134.946C115.485 136.206 113.565 136.206 113.062 136.206H112.559ZM119.558 135.862C119.558 135.702 119.558 135.638 119.39 135.638C119.285 135.638 119.277 135.646 119.197 135.757L116.647 139.46V139.723H118.903V140.387C118.903 140.683 118.877 140.771 118.263 140.771H118.078V141.035C118.758 141.011 118.774 141.011 119.23 141.011C119.685 141.011 119.701 141.011 120.382 141.035V140.771H120.196C119.582 140.771 119.558 140.683 119.558 140.387V139.723H120.405V139.46H119.558V135.862ZM118.957 136.51V139.46H116.926L118.957 136.51Z' fill='#c26a17'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L149.596 197.131' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='1.05394'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M148 203.211C148.323 203.211 149.138 203.188 149.714 202.971C150.625 202.623 150.71 201.929 150.71 201.712C150.71 201.185 150.254 200.705 149.463 200.705C148.204 200.705 146.392 201.844 146.392 203.978C146.392 205.238 147.112 206.113 148.204 206.113C149.835 206.113 150.865 204.843 150.865 204.686C150.865 204.615 150.795 204.554 150.746 204.554C150.71 204.554 150.697 204.567 150.591 204.675C149.822 205.694 148.684 205.875 148.227 205.875C147.543 205.875 147.184 205.333 147.184 204.447C147.184 204.278 147.184 203.978 147.365 203.211H148ZM147.424 202.971C147.94 201.124 149.079 200.945 149.463 200.945C149.99 200.945 150.351 201.256 150.351 201.712C150.351 202.971 148.431 202.971 147.928 202.971H147.424ZM152.393 203.307C152.496 203.338 152.816 203.418 153.152 203.418C154.151 203.418 154.759 202.716 154.759 202.595C154.759 202.507 154.703 202.484 154.664 202.484C154.647 202.484 154.631 202.484 154.559 202.523C154.247 202.644 153.88 202.739 153.448 202.739C152.976 202.739 152.584 202.62 152.336 202.523C152.256 202.484 152.241 202.484 152.233 202.484C152.128 202.484 152.128 202.572 152.128 202.716V205.057C152.128 205.202 152.128 205.297 152.256 205.297C152.321 205.297 152.344 205.266 152.385 205.202C152.481 205.082 152.785 204.675 153.464 204.675C153.911 204.675 154.127 205.042 154.2 205.194C154.336 205.482 154.352 205.849 154.352 206.162C154.352 206.458 154.344 206.889 154.12 207.241C153.967 207.481 153.648 207.728 153.224 207.728C152.705 207.728 152.192 207.401 152.009 206.881C152.032 206.889 152.081 206.889 152.089 206.889C152.313 206.889 152.489 206.745 152.489 206.497C152.489 206.201 152.256 206.097 152.096 206.097C151.952 206.097 151.696 206.177 151.696 206.521C151.696 207.241 152.321 207.968 153.24 207.968C154.239 207.968 155.087 207.193 155.087 206.201C155.087 205.274 154.414 204.45 153.472 204.45C153.072 204.45 152.696 204.579 152.393 204.85V203.307Z' fill='#1f5c99'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L135.143 84.8861L33.6563 129.429L77.8071 165.443Z' fill='#c26a17' opacity='0.18'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L135.143 84.8861' fill='none' stroke='#c26a17' stroke-dasharray='1.50385,1.12789' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.376406'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L33.6563 129.429' fill='none' stroke='#c26a17' stroke-dasharray='1.50931,1.13198' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.376406'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M117.167 131.752C88.7405 144.228 48.0746 141.116 26.3369 124.801C4.59925 108.485 10.0214 85.1445 38.4476 72.668S107.54 63.3035 129.277 79.619C151.015 95.9345 145.593 119.275 117.167 131.752Z' fill='#eeeeee' opacity='0.75'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M117.167 131.752C88.7405 144.228 48.0746 141.116 26.3369 124.801C4.59925 108.485 10.0214 85.1445 38.4476 72.668S107.54 63.3035 129.277 79.619C151.015 95.9345 145.593 119.275 117.167 131.752Z' fill='none' stroke='#999999' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.376406'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M135.143 84.8861L33.6563 129.429' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.60225'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M99.1937 137.315L19.3428 118.242' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.60225'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M75.2785 139.371L58.8119 66.6543' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.60225'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M14.1447 95.2876L82.8482 65.133' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.60225'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M23.0003 82.3723L140.953 110.546' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.60225'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M120.083 74.0266L131.23 123.254' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.60225'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M99.331 100.604L69.4679 113.711L64.6225 92.3139L99.331 100.604Z' fill='#f2d4d0'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M99.331 100.604L69.4679 113.711L64.6225 92.3139L99.331 100.604Z' fill='none' stroke='#a8322a' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L99.331 100.604' fill='none' stroke='#a8322a' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L69.4679 113.711' fill='none' stroke='#a8322a' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M77.8071 165.443L64.6225 92.3139' fill='none' stroke='#a8322a' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<circle cx='77.8071' cy='165.443' fill='#231f20' r='1.12922'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M122.443 66.8631C122.443 66.6483 122.443 66.5871 122.324 66.5871C122.228 66.5871 121.999 66.8522 121.916 66.9604C121.544 66.6592 121.172 66.5871 120.788 66.5871C119.337 66.5871 118.905 67.3791 118.905 68.0394C118.905 68.1711 118.905 68.5915 119.361 69.0102C119.745 69.3458 120.153 69.4305 120.704 69.5387C121.364 69.6705 121.519 69.7066 121.82 69.9465C122.035 70.1253 122.192 70.3904 122.192 70.726C122.192 71.2404 121.891 71.8176 120.837 71.8176C120.045 71.8176 119.469 71.3612 119.206 70.1614C119.157 69.9465 119.157 69.934 119.145 69.9214C119.121 69.8744 119.072 69.8744 119.036 69.8744C118.905 69.8744 118.905 69.934 118.905 70.1504V71.7815C118.905 71.9964 118.905 72.056 119.025 72.056C119.085 72.056 119.098 72.045 119.301 71.7925C119.361 71.7094 119.361 71.6843 119.541 71.4929C119.996 72.056 120.644 72.056 120.848 72.056C122.107 72.056 122.731 71.3612 122.731 70.4139C122.731 69.7662 122.335 69.3819 122.228 69.2737C121.795 68.902 121.472 68.8299 120.68 68.6871C120.321 68.615 119.444 68.4472 119.444 67.7273C119.444 67.3556 119.697 66.8035 120.776 66.8035C122.084 66.8035 122.156 67.9186 122.179 68.2903C122.192 68.3876 122.275 68.3876 122.311 68.3876C122.443 68.3876 122.443 68.3264 122.443 68.1115V66.8631ZM125.149 63.6135L123.481 63.7452V64.0934C124.297 64.0934 124.394 64.1765 124.394 64.7647V71.0491C124.394 71.5886 124.261 71.5886 123.481 71.5886V71.9368C123.817 71.9132 124.405 71.9132 124.766 71.9132C125.125 71.9132 125.724 71.9132 126.06 71.9368V71.5886C125.293 71.5886 125.149 71.5886 125.149 71.0491V63.6135ZM128.426 64.5482C128.426 64.2377 128.173 63.9617 127.838 63.9617C127.525 63.9617 127.262 64.2126 127.262 64.5372C127.262 64.8964 127.549 65.1254 127.838 65.1254C128.209 65.1254 128.426 64.8133 128.426 64.5482ZM126.77 66.78V67.1282C127.538 67.1282 127.646 67.1988 127.646 67.7869V71.0491C127.646 71.5886 127.513 71.5886 126.733 71.5886V71.9368C127.069 71.9132 127.646 71.9132 127.993 71.9132C128.125 71.9132 128.821 71.9132 129.229 71.9368V71.5886C128.449 71.5886 128.401 71.529 128.401 71.0616V66.6483L126.77 66.78ZM133.931 67.4999C133.787 67.4999 133.343 67.4999 133.343 67.9908C133.343 68.2794 133.547 68.4832 133.836 68.4832C134.112 68.4832 134.339 68.3154 134.339 67.9673C134.339 67.1642 133.5 66.5871 132.529 66.5871C131.126 66.5871 130.011 67.8355 130.011 69.3458C130.011 70.8813 131.162 72.056 132.517 72.056C134.099 72.056 134.46 70.6178 134.46 70.5096C134.46 70.4013 134.375 70.4013 134.339 70.4013C134.231 70.4013 134.22 70.4374 134.184 70.5817C133.92 71.4333 133.273 71.7925 132.625 71.7925C131.893 71.7925 130.922 71.1573 130.922 69.3349C130.922 67.343 131.941 66.8522 132.54 66.8522C132.997 66.8522 133.655 67.0309 133.931 67.4999ZM139.363 69.1545C139.627 69.1545 139.65 69.1545 139.65 68.9271C139.65 67.7148 139.002 66.5871 137.552 66.5871C136.184 66.5871 135.128 67.823 135.128 69.3098C135.128 70.8938 136.352 72.056 137.683 72.056C139.111 72.056 139.65 70.7621 139.65 70.5096C139.65 70.4374 139.591 70.3904 139.518 70.3904C139.423 70.3904 139.399 70.45 139.374 70.5096C139.064 71.5165 138.259 71.7925 137.755 71.7925C137.252 71.7925 136.041 71.4569 136.041 69.3819V69.1545H139.363ZM136.052 68.9271C136.148 67.0435 137.203 66.827 137.539 66.827C138.824 66.827 138.896 68.5193 138.907 68.9271H136.052Z' fill='#595959'/>
</g>
<g fill='#231f20'>
<use x='77.067032' y='567.684994' xlink:href='#g3-83'/>
<use x='83.570354' y='567.684994' xlink:href='#g3-97'/>
<use x='89.423345' y='567.684994' xlink:href='#g3-100'/>
<use x='95.926667' y='567.684994' xlink:href='#g3-100'/>
<use x='102.42999' y='567.684994' xlink:href='#g3-108'/>
<use x='105.681651' y='567.684994' xlink:href='#g3-101'/>
<use x='114.786302' y='567.684994' xlink:href='#g3-86'/>
<use x='122.586151' y='567.684994' xlink:href='#g3-101'/>
<use x='127.788809' y='567.684994' xlink:href='#g3-114'/>
<use x='132.341135' y='567.684994' xlink:href='#g3-116'/>
<use x='136.89346' y='567.684994' xlink:href='#g3-101'/>
<use x='142.096118' y='567.684994' xlink:href='#g3-120'/>
<use x='152.176268' y='567.684994' xlink:href='#g3-86'/>
<use x='159.976116' y='567.684994' xlink:href='#g3-111'/>
<use x='165.829107' y='567.684994' xlink:href='#g3-114'/>
<use x='170.381432' y='567.684994' xlink:href='#g3-111'/>
<use x='176.234423' y='567.684994' xlink:href='#g3-110'/>
<use x='182.737745' y='567.684994' xlink:href='#g3-111'/>
<use x='188.590735' y='567.684994' xlink:href='#g3-105'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M371.672 191.924L322.499 220.314L213.019 157.106V100.325L322.499 37.1166L371.672 65.5069V191.924Z' fill='#ebebeb'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M322.499 15.4717V241.959H327.505V15.4717H322.499Z' fill='#c26a17' opacity='0.25'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M409.774 169.925L284.397 242.312L286.9 246.647L412.277 174.261L409.774 169.925Z' fill='#1f5c99' opacity='0.25'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M390.418 202.746L194.274 89.5025L191.771 93.838L387.914 207.081L390.418 202.746Z' fill='#c26a17' opacity='0.25'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M213.019 201.102V56.3287H208.013V201.102H213.019Z' fill='#1f5c99' opacity='0.25'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M194.274 167.928L390.418 54.6845L387.914 50.349L191.771 163.593L194.274 167.928Z' fill='#c26a17' opacity='0.25'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M284.397 15.1185L409.774 87.505L412.277 83.1695L286.9 10.783L284.397 15.1185Z' fill='#1f5c99' opacity='0.25'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M322.499 10.3906V247.04' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g fill='#c16a17'>
<use x='388.828529' y='431.70318' xlink:href='#g1-101'/>
<use x='394.253969' y='433.496443' xlink:href='#g2-48'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M416.457 166.067L277.715 246.17' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g fill='#1f5c98'>
<use x='402.992152' y='518.073095' xlink:href='#g1-101'/>
<use x='408.417592' y='519.866358' xlink:href='#g2-49'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M394.818 205.287L189.874 86.9619' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g fill='#c16a17'>
<use x='335.275432' y='462.62207' xlink:href='#g1-101'/>
<use x='340.700872' y='464.415333' xlink:href='#g2-50'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M213.019 208.818V48.6126' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g fill='#1f5c98'>
<use x='253.39509' y='431.70318' xlink:href='#g1-101'/>
<use x='258.82053' y='433.496443' xlink:href='#g2-51'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M189.874 170.469L394.818 52.1439' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g fill='#c16a17'>
<use x='335.275432' y='400.784275' xlink:href='#g1-101'/>
<use x='340.700872' y='402.577538' xlink:href='#g2-52'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M277.715 11.2605L416.457 91.3631' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g fill='#1f5c98'>
<use x='402.992152' y='345.333266' xlink:href='#g1-101'/>
<use x='408.417592' y='347.126529' xlink:href='#g2-53'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M371.672 191.924L322.499 220.314L213.019 157.106V100.325L322.499 37.1166L371.672 65.5069V191.924Z' fill='none' stroke='#231f20' stroke-dasharray='2.64227,1.58536' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.526969'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M322.499 93.8973V163.533L262.192 128.715L322.499 93.8973Z' fill='#f2d4d0'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M322.499 93.8973V163.533L262.192 128.715L322.499 93.8973Z' fill='none' stroke='#a8322a' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M327.618 128.715C327.618 114.786 316.326 103.494 302.397 103.494S277.176 114.786 277.176 128.715S288.468 153.936 302.397 153.936S327.618 142.644 327.618 128.715Z' fill='none' stroke='#8c8c8c' stroke-dasharray='1.50942,1.13207' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.376406'/>
</g>
<g fill='#737373'>
<use x='352.15163' y='402.696887' xlink:href='#g5-49'/>
<use x='356.12287' y='402.696887' xlink:href='#g5-48'/>
<use x='360.094111' y='399.69037' xlink:href='#g4-14'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M354.457 128.715C354.457 99.9631 331.149 76.655 302.397 76.655S250.337 99.9631 250.337 128.715C250.337 157.467 273.645 180.775 302.397 180.775S354.457 157.467 354.457 128.715Z' fill='none' stroke='#8c8c8c' stroke-dasharray='1.5076,1.1307' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.376406'/>
</g>
<g fill='#737373'>
<use x='352.15163' y='375.957727' xlink:href='#g5-50'/>
<use x='356.12287' y='375.957727' xlink:href='#g5-48'/>
<use x='360.094111' y='372.95121' xlink:href='#g4-14'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M384.978 128.715C384.978 83.107 348.005 46.1343 302.397 46.1343S219.816 83.107 219.816 128.715S256.789 211.296 302.397 211.296S384.978 174.323 384.978 128.715Z' fill='none' stroke='#8c8c8c' stroke-dasharray='1.50528,1.12896' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.376406'/>
</g>
<g fill='#737373'>
<use x='352.15163' y='345.551077' xlink:href='#g5-51'/>
<use x='356.12287' y='345.551077' xlink:href='#g5-48'/>
<use x='360.094111' y='342.544559' xlink:href='#g4-14'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M422.417 128.715C422.417 62.43 368.682 8.69514 302.397 8.69514S182.377 62.43 182.377 128.715S236.112 248.735 302.397 248.735S422.417 195 422.417 128.715Z' fill='none' stroke='#999999' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.376406'/>
</g>
<g fill='#737373'>
<use x='352.15163' y='308.251786' xlink:href='#g5-52'/>
<use x='356.12287' y='308.251786' xlink:href='#g5-48'/>
<use x='360.094111' y='305.245269' xlink:href='#g4-14'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<circle cx='322.499' cy='220.314' fill='#231f20' r='1.31742'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<circle cx='371.672' cy='191.924' fill='#231f20' r='1.31742'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<circle cx='213.019' cy='100.325' fill='#231f20' r='1.31742'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<circle cx='213.019' cy='157.106' fill='#231f20' r='1.31742'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<circle cx='371.672' cy='65.5069' fill='#231f20' r='1.31742'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<circle cx='322.499' cy='37.1166' fill='#231f20' r='1.31742'/>
</g>
<g fill='#231f20'>
<use x='428.976923' y='491.24353' xlink:href='#g2-102'/>
<use x='431.564479' y='491.24353' xlink:href='#g2-97'/>
<use x='435.798662' y='491.24353' xlink:href='#g2-99'/>
<use x='439.56238' y='491.24353' xlink:href='#g2-101'/>
<use x='446.148887' y='491.24353' xlink:href='#g2-110'/>
<use x='450.853534' y='491.24353' xlink:href='#g2-111'/>
<use x='455.087717' y='491.24353' xlink:href='#g2-114'/>
<use x='458.387887' y='491.24353' xlink:href='#g2-109'/>
<use x='465.444859' y='491.24353' xlink:href='#g2-97'/>
<use x='469.679042' y='491.24353' xlink:href='#g2-108'/>
<use x='472.031366' y='491.24353' xlink:href='#g2-115'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<circle cx='302.397' cy='128.715' fill='#231f20' r='0.941016'/>
</g>
<g fill='#231f20'>
<use x='347.041262' y='435.212512' xlink:href='#g2-117'/>
<use x='351.74591' y='435.212512' xlink:href='#g2-112'/>
<use x='333.494802' y='567.552221' xlink:href='#g3-84'/>
<use x='340.973622' y='567.552221' xlink:href='#g3-111'/>
<use x='346.826613' y='567.552221' xlink:href='#g3-112'/>
<use x='357.231929' y='567.552221' xlink:href='#g3-86'/>
<use x='366.007275' y='567.552221' xlink:href='#g3-105'/>
<use x='369.258937' y='567.552221' xlink:href='#g3-101'/>
<use x='374.461595' y='567.552221' xlink:href='#g3-119'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M.526969 279.036H14.0776' fill='none' stroke='#c26a17' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='1.05394'/>
</g>
<g fill='#231f20'>
<use x='76.444899' y='581.842049' xlink:href='#g2-114'/>
<use x='79.745069' y='581.842049' xlink:href='#g2-105'/>
<use x='82.097393' y='581.842049' xlink:href='#g2-100'/>
<use x='86.802041' y='581.842049' xlink:href='#g2-103'/>
<use x='91.036223' y='581.842049' xlink:href='#g2-101'/>
<use x='97.62273' y='581.842049' xlink:href='#g2-115'/>
<use x='100.963033' y='581.842049' xlink:href='#g2-112'/>
<use x='105.902913' y='581.842049' xlink:href='#g2-111'/>
<use x='110.137096' y='581.842049' xlink:href='#g2-107'/>
<use x='114.371279' y='581.842049' xlink:href='#g2-101'/>
<use x='118.134997' y='581.842049' xlink:href='#g2-44'/>
<use x='123.310109' y='581.842049' xlink:href='#g2-56'/>
<use x='127.544292' y='579.029263' xlink:href='#g0-14'/>
<use x='134.684204' y='581.842049' xlink:href='#g2-100'/>
<use x='139.388852' y='581.842049' xlink:href='#g2-114'/>
<use x='142.689022' y='581.842049' xlink:href='#g2-111'/>
<use x='146.923205' y='581.842049' xlink:href='#g2-112'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M113.449 279.036H126.999' fill='none' stroke='#1f5c99' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='1.05394'/>
</g>
<g fill='#231f20'>
<use x='188.944899' y='581.842049' xlink:href='#g2-103'/>
<use x='193.179082' y='581.842049' xlink:href='#g2-117'/>
<use x='197.883729' y='581.842049' xlink:href='#g2-108'/>
<use x='200.236053' y='581.842049' xlink:href='#g2-108'/>
<use x='202.588377' y='581.842049' xlink:href='#g2-121'/>
<use x='209.880581' y='581.842049' xlink:href='#g2-115'/>
<use x='213.220884' y='581.842049' xlink:href='#g2-112'/>
<use x='218.160764' y='581.842049' xlink:href='#g2-111'/>
<use x='222.394947' y='581.842049' xlink:href='#g2-107'/>
<use x='226.629129' y='581.842049' xlink:href='#g2-101'/>
<use x='230.392848' y='581.842049' xlink:href='#g2-44'/>
<use x='235.56796' y='581.842049' xlink:href='#g2-51'/>
<use x='239.802143' y='581.842049' xlink:href='#g2-50'/>
<use x='244.036326' y='579.029263' xlink:href='#g0-14'/>
<use x='251.176238' y='581.842049' xlink:href='#g2-100'/>
<use x='255.880886' y='581.842049' xlink:href='#g2-114'/>
<use x='259.181056' y='581.842049' xlink:href='#g2-111'/>
<use x='263.415239' y='581.842049' xlink:href='#g2-112'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M226.371 282.8H233.899V275.272H226.371V282.8Z' fill='#f2d4d0'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M226.371 282.8H233.899V275.272H226.371V282.8Z' fill='none' stroke='#a8322a' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.752812'/>
</g>
<g fill='#231f20'>
<use x='295.444892' y='581.682947' xlink:href='#g2-118'/>
<use x='299.679075' y='581.682947' xlink:href='#g2-101'/>
<use x='303.442793' y='581.682947' xlink:href='#g2-114'/>
<use x='306.742963' y='581.682947' xlink:href='#g2-116'/>
<use x='310.036217' y='581.682947' xlink:href='#g2-101'/>
<use x='313.799935' y='581.682947' xlink:href='#g2-120'/>
<use x='321.092139' y='581.682947' xlink:href='#g2-114'/>
<use x='324.392309' y='581.682947' xlink:href='#g2-101'/>
<use x='328.156027' y='581.682947' xlink:href='#g2-103'/>
<use x='332.39021' y='581.682947' xlink:href='#g2-105'/>
<use x='334.742533' y='581.682947' xlink:href='#g2-111'/>
<use x='338.976716' y='581.682947' xlink:href='#g2-110'/>
</g>
<g transform='translate(56.9344 301.852)scale(.996264)'>
<path d='M309.18 279.036H322.731' fill='none' stroke='#231f20' stroke-dasharray='2.33631,1.40179' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10.0375' stroke-width='0.526969'/>
</g>
<g fill='#231f20'>
<use x='383.944896' y='582.552747' xlink:href='#g2-99'/>
<use x='387.708614' y='582.552747' xlink:href='#g2-111'/>
<use x='391.942797' y='582.552747' xlink:href='#g2-110'/>
<use x='396.647445' y='582.552747' xlink:href='#g2-101'/>
<use x='403.233951' y='582.552747' xlink:href='#g2-111'/>
<use x='407.468134' y='582.552747' xlink:href='#g2-102'/>
<use x='412.878479' y='582.552747' xlink:href='#g2-102'/>
<use x='415.466035' y='582.552747' xlink:href='#g2-97'/>
<use x='419.700218' y='582.552747' xlink:href='#g2-99'/>
<use x='423.463936' y='582.552747' xlink:href='#g2-101'/>
<use x='430.050443' y='582.552747' xlink:href='#g2-110'/>
<use x='434.75509' y='582.552747' xlink:href='#g2-111'/>
<use x='438.989273' y='582.552747' xlink:href='#g2-114'/>
<use x='442.289443' y='582.552747' xlink:href='#g2-109'/>
<use x='449.346415' y='582.552747' xlink:href='#g2-97'/>
<use x='453.580597' y='582.552747' xlink:href='#g2-108'/>
<use x='455.932921' y='582.552747' xlink:href='#g2-115'/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 75 KiB

View file

@ -0,0 +1,323 @@
settings.outformat = "svg";
settings.render = 0;
settings.prc = false;
import three;
real px = 0.75bp;
pen ink = rgb("231f20");
pen meshPen = ink + 0.6px;
// Half opacity over white matches the opaque f2d4d0 of the other figures
pen regionFill = rgb("e5a9a1") + opacity(0.5);
pen regionShade = rgb("7a1f18");
pen regionPen = rgb("a8322a") + 0.9px;
pen rayPen = rgb("a8322a") + 0.6px;
pen spokePen = rgb("1f5c99") + 1.0px;
pen cliffFill = gray(0.88) + opacity(0.6);
pen guidePen = gray(0.45) + 0.6px + linetype(new real[] {4, 3});
real panelSize = 170px;
real capRadius = 0.55;
real arrowSize = 5px;
triple lightDirection = unit((1, 4, 2));
// Extreme rays of the cone of normals n with n . d <= 0 for every direction d
triple[] RegionRays(triple[] d)
{
triple[] rays;
for (int i = 0; i < d.length; ++i)
{
for (int j = i + 1; j < d.length; ++j)
{
triple c = cross(d[i], d[j]);
if (abs(c) < 1e-6)
continue;
for (real s : new real[] {1, -1})
{
triple r = s * unit(c);
bool inside = true;
for (triple e : d)
inside = inside && dot(r, unit(e)) <= 1e-6;
bool duplicate = false;
for (triple q : rays)
duplicate = duplicate || dot(r, q) > 1 - 1e-6;
if (inside && !duplicate)
rays.push(r);
}
}
}
triple axis = (0, 0, 0);
for (triple r : rays)
axis += r;
axis = unit(axis);
triple t1 = unit(cross(axis, abs(axis.x) < 0.9 ? X : Y));
triple t2 = cross(axis, t1);
real[] angles;
for (triple r : rays)
angles.push(atan2(dot(r, t2), dot(r, t1)));
int[] order = sequence(rays.length);
order = sort(order, new bool(int a, int b) { return angles[a] < angles[b]; });
triple[] sorted;
for (int k : order)
sorted.push(rays[k]);
return sorted;
}
triple Arc(triple a, triple b, real t)
{
return unit((1 - t) * a + t * b);
}
// Extreme rays of the region, drawn as arrows leaving the rim
void DrawRayTips(picture pic, triple v, triple[] rays, real radius)
{
for (triple r : rays)
draw(pic, (v + radius * r) -- (v + (radius + 0.3) * r), regionPen, Arrow3(arrowSize));
}
// Convex hull by monotone chain
pair[] ConvexHull(pair[] points)
{
pair[] p = sort(points, new bool(pair a, pair b) { return a.x < b.x || (a.x == b.x && a.y < b.y); });
pair[] hull;
for (int pass = 0; pass < 2; ++pass)
{
int base = hull.length;
for (pair q : p)
{
while (hull.length >= base + 2 && cross(hull[hull.length - 1] - hull[hull.length - 2], q - hull[hull.length - 2]) <= 0)
hull.pop();
hull.push(q);
}
hull.pop();
p = reverse(p);
}
return hull;
}
// The region is convex, so its outline is the hull of its projected points. Filling that once
// avoids the seams that overlapping translucent patches would show.
void FillProjected(picture pic, triple v, triple[] points)
{
triple view = unit(currentprojection.camera - currentprojection.target);
triple u1 = unit(cross(currentprojection.up, view));
triple u2 = cross(view, u1);
pair[] flat;
for (triple q : points)
flat.push((dot(q - v, u1), dot(q - v, u2)));
pair[] hull = ConvexHull(flat);
path3 outline = v + hull[0].x * u1 + hull[0].y * u2;
for (int k = 1; k < hull.length; ++k)
outline = outline -- (v + hull[k].x * u1 + hull[k].y * u2);
draw(pic, surface(outline -- cycle, planar = true), regionFill, nolight);
}
void DrawRegion(picture pic, triple v, triple[] rays, real radius)
{
int arcSteps = 12;
int n = rays.length;
triple axis = (0, 0, 0);
for (triple r : rays)
axis += r;
axis = unit(axis);
triple[] points = { v };
path3 rim;
for (int i = 0; i < n; ++i)
{
if (n == 2 && i == 1)
break;
triple a = rays[i];
triple b = rays[(i + 1) % n];
for (int k = 0; k <= arcSteps; ++k)
{
triple p = v + radius * Arc(a, b, k / arcSteps);
rim = i == 0 && k == 0 ? p : rim -- p;
points.push(p);
// Interior points for the silhouette of the spherical cap
for (int j = 1; j < 6 && n > 2; ++j)
points.push(v + radius * Arc(axis, Arc(a, b, k / arcSteps), j / 6));
}
}
FillProjected(pic, v, points);
// Darken the flat sides with the same light as the mesh. Sides on the near half of the cone never
// overlap each other in projection, nor do sides on the far half, so each adds one layer.
for (int i = 0; i < n; ++i)
{
if (n == 2 && i == 1)
break;
triple a = rays[i];
triple b = rays[(i + 1) % n];
triple side = unit(cross(a, b));
path3 sector = v + radius * a;
for (int k = 1; k <= arcSteps; ++k)
sector = sector -- (v + radius * Arc(a, b, k / arcSteps));
sector = v -- sector -- cycle;
real shade = 1 - abs(dot(side, lightDirection));
draw(pic, surface(sector, planar = true), regionShade + opacity(0.35 * shade), nolight);
}
draw(pic, n == 2 ? rim : rim -- cycle, regionPen);
for (triple r : rays)
draw(pic, v -- (v + radius * r), rayPen);
DrawRayTips(pic, v, rays, radius);
}
// Flat shading in world space, so every panel is lit the same way
pen Shade(path3 face)
{
triple n = unit(cross(point(face, 1) - point(face, 0), point(face, 2) - point(face, 0)));
real k = 0.74 + 0.26 * abs(dot(n, lightDirection));
return rgb(k * 0.843, k * 0.890, k * 0.957);
}
void DrawFan(picture pic, triple v, triple[] rim, bool closed)
{
int count = closed ? rim.length : rim.length - 1;
for (int i = 0; i < count; ++i)
{
path3 t = v -- rim[i] -- rim[(i + 1) % rim.length] -- cycle;
draw(pic, surface(t), Shade(t), nolight);
draw(pic, t, meshPen);
}
}
void DrawSpokes(picture pic, triple v, triple[] ends)
{
for (triple e : ends)
draw(pic, v -- (v + 0.45 * (e - v)), spokePen, Arrow3(arrowSize));
}
frame[] panels;
string[] titles;
// Box corner, three faces meet at a convex vertex
{
currentprojection = orthographic((3.5, 2.6, 2.8), up = Y);
picture pic;
size(pic, panelSize, panelSize);
triple v = (0, 0, 0);
path3[] faces = {
(0, 0, 0) -- (0, -1, 0) -- (0, -1, -1) -- (0, 0, -1) -- cycle,
(0, 0, 0) -- (0, 0, -1) -- (-1, 0, -1) -- (-1, 0, 0) -- cycle,
(0, 0, 0) -- (-1, 0, 0) -- (-1, -1, 0) -- (0, -1, 0) -- cycle,
};
for (path3 f : faces)
{
draw(pic, surface(f), Shade(f), nolight);
draw(pic, f, meshPen);
}
triple[] ends = { (-1, 0, 0), (0, -1, 0), (0, 0, -1) };
DrawSpokes(pic, v, ends);
DrawRegion(pic, v, RegionRays(ends), capRadius);
dot(pic, v, ink + 3px);
panels.push(pic.fit());
titles.push("convex corner");
}
// A vertex on a ridge, the region collapses to a flat wedge
{
currentprojection = orthographic((3.0, 2.4, 2.2), up = Y);
picture pic;
size(pic, panelSize, panelSize);
triple v = (0, 0, 0);
real h = tan(30 * pi / 180);
triple[] rim = { (1, 0, 0), (1, -h, 1), (-1, -h, 1), (-1, 0, 0), (-1, -h, -1), (1, -h, -1) };
DrawFan(pic, v, rim, true);
DrawSpokes(pic, v, rim);
DrawRegion(pic, v, RegionRays(rim), capRadius);
dot(pic, v, ink + 3px);
panels.push(pic.fit());
titles.push("ridge");
}
// Saddle hub, spokes alternate 8 degree ridges and 32 degree gullies
{
currentprojection = orthographic((2.0, 4.0, 3.0), up = Y);
picture pic;
size(pic, panelSize, panelSize);
triple v = (0, 0, 0);
triple[] rim;
for (int i = 0; i < 6; ++i)
{
real angle = i * 60;
real drop = i % 2 == 1 ? 32 : 8;
rim.push((Cos(angle), -Tan(drop), Sin(angle)));
}
DrawFan(pic, v, rim, true);
DrawSpokes(pic, v, rim);
DrawRegion(pic, v, RegionRays(rim), 1.2);
dot(pic, v, ink + 3px);
panels.push(pic.fit());
titles.push("saddle hub");
}
// Corner of an open sheet, the cliffs below the boundary edges close the region
{
currentprojection = orthographic((3.5, 2.6, 2.8), up = Y);
picture pic;
size(pic, panelSize, panelSize);
triple v = (0, 0, 0);
real depth = 0.6;
path3[] cliffs = {
(0, 0, 0) -- (0, 0, -1) -- (0, -depth, -1) -- (0, -depth, 0) -- cycle,
(0, 0, 0) -- (-1, 0, 0) -- (-1, -depth, 0) -- (0, -depth, 0) -- cycle,
};
for (path3 c : cliffs)
{
draw(pic, surface(c), cliffFill, nolight);
draw(pic, c, guidePen);
}
triple[] rim = { (-1, 0, 0), (-1, 0, -1), (0, 0, -1) };
DrawFan(pic, v, rim, false);
DrawSpokes(pic, v, rim);
triple[] directions = copy(rim);
directions.push((0, -1, 0));
DrawRegion(pic, v, RegionRays(directions), capRadius);
dot(pic, v, ink + 3px);
label(pic, "cliff", (0, -depth, -0.5), S, gray(0.35));
panels.push(pic.fit());
titles.push("open corner");
}
real gap = 24px;
real x = 0;
for (int i = 0; i < panels.length; ++i)
{
frame f = panels[i];
pair lo = min(f);
pair hi = max(f);
add(shift(x - lo.x, -lo.y) * f);
label(titles[i], (x + 0.5 * (hi.x - lo.x), -8px), S, ink);
x += hi.x - lo.x + gap;
}

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 104 KiB

19
docs/instant_scroll.cmake Normal file
View file

@ -0,0 +1,19 @@
# Doxygen's navtree.js slides to an anchor for up to 500 ms and has no option to turn it off.
# Rewrite the call to jump, keeping the callback that runs the highlight glow.
# Run with -DNAVTREE=<path to html/navtree.js>
file(READ "${NAVTREE}" text)
set(animated "animateScrolling(docContent, pos+dcScrTop-dcOffset, Math.max(50,Math.min(500,dist)), function() {")
set(instant "docContent.scrollTop = pos+dcScrTop-dcOffset; requestAnimationFrame(function() {")
string(FIND "${text}" "${animated}" found)
if(found GREATER_EQUAL 0)
string(REPLACE "${animated}" "${instant}" text "${text}")
file(WRITE "${NAVTREE}" "${text}")
else()
string(FIND "${text}" "${instant}" patched)
if(patched LESS 0)
message(FATAL_ERROR "instant_scroll.cmake: anchor scroll code not found in ${NAVTREE}, doxygen changed it")
endif()
endif()

View file

@ -46,7 +46,7 @@ quaternions in both modes, so the trig and the cross-platform determinism proper
The public API uses these types wherever it accepts or returns a world position: `b3BodyDef.position`,
`b3Body_GetPosition` / `b3Body_GetTransform`, `b3Body_SetTransform`, `b3Body_GetWorldPoint` /
`b3Body_GetLocalPoint`, `b3Body_GetWorldCenterOfMass`, the explosion and ray-cast origins, contact
`b3Body_GetLocalPoint`, `b3Body_GetWorldCenter`, the explosion and ray-cast origins, contact
and ray-cast result points, and the body move event. With double precision off these are all the
float types they have always been, so existing code compiles unchanged.

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.10.0 -->
<doxygenlayout version="2.0">
<!-- Generated by doxygen 1.17.0 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="topics" visible="yes" title="Reference" intro=""/>
<tab type="topics" visible="yes" title="" intro=""/>
<tab type="modules" visible="yes" title="" intro="">
<tab type="modulelist" visible="yes" title="" intro=""/>
<tab type="modulemembers" visible="yes" title="" intro=""/>
@ -51,51 +51,51 @@
<collaborationgraph visible="yes"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<services title=""/>
<interfaces title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<publictypes visible="yes" title=""/>
<services visible="yes" title=""/>
<interfaces visible="yes" title=""/>
<publicslots visible="yes" title=""/>
<signals visible="yes" title=""/>
<publicmethods visible="yes" title=""/>
<publicstaticmethods visible="yes" title=""/>
<publicattributes visible="yes" title=""/>
<publicstaticattributes visible="yes" title=""/>
<protectedtypes visible="yes" title=""/>
<protectedslots visible="yes" title=""/>
<protectedmethods visible="yes" title=""/>
<protectedstaticmethods visible="yes" title=""/>
<protectedattributes visible="yes" title=""/>
<protectedstaticattributes visible="yes" title=""/>
<packagetypes visible="yes" title=""/>
<packagemethods visible="yes" title=""/>
<packagestaticmethods visible="yes" title=""/>
<packageattributes visible="yes" title=""/>
<packagestaticattributes visible="yes" title=""/>
<properties visible="yes" title=""/>
<events visible="yes" title=""/>
<privatetypes visible="yes" title=""/>
<privateslots visible="yes" title=""/>
<privatemethods visible="yes" title=""/>
<privatestaticmethods visible="yes" title=""/>
<privateattributes visible="yes" title=""/>
<privatestaticattributes visible="yes" title=""/>
<friends visible="yes" title=""/>
<related visible="yes" title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<detaileddescription visible="yes" title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<services title=""/>
<interfaces title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
<inlineclasses visible="yes" title=""/>
<typedefs visible="yes" title=""/>
<enums visible="yes" title=""/>
<services visible="yes" title=""/>
<interfaces visible="yes" title=""/>
<constructors visible="yes" title=""/>
<functions visible="yes" title=""/>
<related visible="yes" title=""/>
<variables visible="yes" title=""/>
<properties visible="yes" title=""/>
<events visible="yes" title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
@ -113,25 +113,25 @@
<concepts visible="yes" title=""/>
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<properties title=""/>
<typedefs visible="yes" title=""/>
<sequences visible="yes" title=""/>
<dictionaries visible="yes" title=""/>
<enums visible="yes" title=""/>
<functions visible="yes" title=""/>
<variables visible="yes" title=""/>
<properties visible="yes" title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<detaileddescription visible="yes" title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<properties title=""/>
<inlineclasses visible="yes" title=""/>
<typedefs visible="yes" title=""/>
<sequences visible="yes" title=""/>
<dictionaries visible="yes" title=""/>
<enums visible="yes" title=""/>
<functions visible="yes" title=""/>
<variables visible="yes" title=""/>
<properties visible="yes" title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
@ -141,7 +141,7 @@
<briefdescription visible="yes"/>
<includes visible="$SHOW_HEADERFILE"/>
<definition visible="yes" title=""/>
<detaileddescription title=""/>
<detaileddescription visible="yes" title=""/>
<authorsection visible="yes"/>
</concept>
@ -160,27 +160,27 @@
<namespaces visible="yes" title=""/>
<concepts visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<properties title=""/>
<defines visible="yes" title=""/>
<typedefs visible="yes" title=""/>
<sequences visible="yes" title=""/>
<dictionaries visible="yes" title=""/>
<enums visible="yes" title=""/>
<functions visible="yes" title=""/>
<variables visible="yes" title=""/>
<properties visible="yes" title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<detaileddescription visible="yes" title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<properties title=""/>
<inlineclasses visible="yes" title=""/>
<defines visible="yes" title=""/>
<typedefs visible="yes" title=""/>
<sequences visible="yes" title=""/>
<dictionaries visible="yes" title=""/>
<enums visible="yes" title=""/>
<functions visible="yes" title=""/>
<variables visible="yes" title=""/>
<properties visible="yes" title=""/>
</memberdef>
<authorsection/>
</file>
@ -197,42 +197,42 @@
<namespaces visible="yes" title=""/>
<concepts visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<defines visible="yes" title=""/>
<typedefs visible="yes" title=""/>
<sequences visible="yes" title=""/>
<dictionaries visible="yes" title=""/>
<enums visible="yes" title=""/>
<enumvalues visible="yes" title=""/>
<functions visible="yes" title=""/>
<variables visible="yes" title=""/>
<signals visible="yes" title=""/>
<publicslots visible="yes" title=""/>
<protectedslots visible="yes" title=""/>
<privateslots visible="yes" title=""/>
<events visible="yes" title=""/>
<properties visible="yes" title=""/>
<friends visible="yes" title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<detaileddescription visible="yes" title=""/>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<inlineclasses visible="yes" title=""/>
<defines visible="yes" title=""/>
<typedefs visible="yes" title=""/>
<sequences visible="yes" title=""/>
<dictionaries visible="yes" title=""/>
<enums visible="yes" title=""/>
<enumvalues visible="yes" title=""/>
<functions visible="yes" title=""/>
<variables visible="yes" title=""/>
<signals visible="yes" title=""/>
<publicslots visible="yes" title=""/>
<protectedslots visible="yes" title=""/>
<privateslots visible="yes" title=""/>
<events visible="yes" title=""/>
<properties visible="yes" title=""/>
<friends visible="yes" title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>
@ -244,13 +244,13 @@
<memberdecl>
<concepts visible="yes" title=""/>
<classes visible="yes" title=""/>
<enums title=""/>
<typedefs title=""/>
<functions title=""/>
<variables title=""/>
<membergroups title=""/>
<enums visible="yes" title=""/>
<typedefs visible="yes" title=""/>
<functions visible="yes" title=""/>
<variables visible="yes" title=""/>
<membergroups visible="yes" title=""/>
</memberdecl>
<detaileddescription title=""/>
<detaileddescription visible="yes" title=""/>
<memberdecl>
<files visible="yes"/>
</memberdecl>
@ -264,6 +264,6 @@
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<detaileddescription visible="yes" title=""/>
</directory>
</doxygenlayout>

View file

@ -91,7 +91,6 @@ Category flags on the struct control what gets drawn:
| `drawContacts` | Contact points and anchors |
| `drawContactNormals` | Contact normal directions |
| `drawContactForces` | Normal impulse magnitudes |
| `drawFrictionForces` | Friction impulse magnitudes |
| `drawGraphColors` | Constraint-graph color assignment |
| `drawContactFeatures` | Raw contact feature indices |
| `drawIslands` | Island bounding boxes |

View file

@ -1,4 +1,10 @@
# Overview {#mainpage}
> **Caution**:
> The written part of this manual is a work in progress.
> It will be updated as v1.0 approaches.
> The reference section should be complete and accurate.
Box3D is a 3D rigid body simulation library for games. Programmers can
use it in their games to make objects move in realistic ways and make
the game world more interactive. From the game engine's point of view,
@ -14,6 +20,7 @@ engine begin with the `b3` prefix. Hopefully this is sufficient to avoid
name clashing with your application.
## Prerequisites
In this manual I'll assume you are familiar with basic physics
concepts, such as mass, force, torque, and impulses. If not, please
first consult Google search and Wikipedia.
@ -33,6 +40,7 @@ should be comfortable with compiling, linking, and debugging.
> Box3D. There are many resources for this online.
## Scope
This manual covers the majority of the Box3D API. However, not every
aspect is covered. Please look at the Reference section and samples
application included with Box3D to learn more.
@ -45,6 +53,7 @@ Box3D may be out of sync with this manual.
> latest version on the main branch.
## Feedback and Bugs
Please file bugs and feature requests here:
[Box3D Issues](https://github.com/erincatto/box3d/issues)
@ -130,6 +139,7 @@ the first time of impact (TOI). Second, speculative collision is used to create
contact constraints between bodies before they touch.
### events
World simulation leads to the creation of events that are available at the end
of the time step:
@ -141,6 +151,7 @@ of the time step:
These events allow your application to react to changes in the simulation.
## Modules
Box3D's primary purpose is to provide rigid body simulation. However,
there are math and collision features that may be useful apart from the
rigid body simulation. These are provided in the `include` directory. Anything
@ -153,6 +164,7 @@ study the code and ask questions. I'm happy to share all the details of how
Box3D works internally.
## Units
Box3D works with floating point numbers and tolerances have to be used
to make Box3D perform well. These tolerances have been tuned to work
well with meters-kilogram-second (MKS) units. In particular, Box3D has
@ -185,6 +197,7 @@ the full 3D rotation is tracked continuously.
> Box3D uses radians, not degrees.
## Changing the length units
Advanced users may change the length unit by calling `b3SetLengthUnitsPerMeter()`
at application startup. If you keep Box3D in a shared library, you will need
to call this if the shared library is reloaded.
@ -195,6 +208,7 @@ One of the benefits of using MKS units for physics simulation is that you can
use real world values to get reasonable results.
## Ids and Definitions
Fast memory management plays a central role in the design of the Box3D
interface. When you create a world, body, shape or joint, you will receive
a handle called an *id*. These ids are opaque and are passed to various functions

View file

@ -490,11 +490,12 @@ The body's mass data is available through the following functions:
```c
float mass = b3Body_GetMass(myBodyId);
b3Matrix3 inertia = b3Body_GetLocalRotationalInertia(myBodyId);
b3Vec3 localCenter = b3Body_GetLocalCenterOfMass(myBodyId);
b3Vec3 localCenter = b3Body_GetLocalCenter(myBodyId);
b3MassData massData = b3Body_GetMassData(myBodyId);
```
### State Information
There are many aspects to the body's state. You can access this state
data through the following functions:
@ -537,8 +538,8 @@ body that is a box. The body origin might be a corner of the box,
while the center of mass is located at the center of the box.
```c
b3Vec3 worldCenter = b3Body_GetWorldCenterOfMass(myBodyId);
b3Vec3 localCenter = b3Body_GetLocalCenterOfMass(myBodyId);
b3Pos worldCenter = b3Body_GetWorldCenter(myBodyId);
b3Vec3 localCenter = b3Body_GetLocalCenter(myBodyId);
```
You can access the linear and angular velocity. The linear velocity is
@ -704,22 +705,25 @@ instead of bodies. Since you can attach multiple shapes to a body, this allows f
possible setups. For example, you can make a vehicle that is heavier in the back.
### Density
The shape density is used to compute the mass properties of the parent
body. The density can be zero or positive. You should generally use
similar densities for all your shapes. This will improve stacking
stability.
The mass of a body is not adjusted when you set the density. You must
call `b3Body_ApplyMassFromShapes()` for this to occur. Generally you should establish
the shape density in `b3ShapeDef` and avoid modifying it later because this
can be expensive, especially on a compound body.
You may adjust the density of an existing body. You may choose to update the body mass immediately
or defer for a later call to `b3Body_ApplyMassFromShapes()`. Generally you should establish
the shape density in `b3ShapeDef` and avoid modifying it later because this can be expensive,
especially on a body with many shapes.
```c
b3Shape_SetDensity(myShapeId, 5.0f, true);
bool updateMass = false;
b3Shape_SetDensity(myShapeId, 5.0f, updateMass);
b3Body_ApplyMassFromShapes(myBodyId);
```
### Friction
Friction is used to make objects slide along each other realistically.
Box3D supports static and dynamic friction, but uses the same parameter
for both. Box3D attempts to simulate friction accurately and the friction
@ -745,6 +749,7 @@ shapeDef.baseMaterial.friction = 0.5f;
```
### Restitution
[Restitution](https://en.wikipedia.org/wiki/Coefficient_of_restitution) is used to make
objects bounce. The restitution value is
usually set to be between 0 and 1. Consider dropping a ball on a table.
@ -772,6 +777,7 @@ shapeDef.baseMaterial.restitution = 0.3f;
```
### Friction and Restitution Callbacks
Advanced users can override friction and restitution mixing using `b3FrictionCallback`
and `b3RestitutionCallback`. These should be very lightweight functions because they
are called frequently. The callbacks receive the two friction (or restitution) values
@ -794,6 +800,7 @@ worldDef.frictionCallback = MyFrictionCallback;
```
### Filtering {#filtering}
Collision filtering allows you to efficiently prevent collision between shapes.
For example, say you make a character that rides a bicycle. You want the
bicycle to collide with the terrain and the character to collide with
@ -866,6 +873,7 @@ Collision groups have a higher priority than categories and masks.
Note that additional collision filtering occurs automatically in Box3D. Here is a
list:
- A shape on a static body can only collide with a dynamic body.
- A shape on a kinematic body can only collide with a dynamic body.
- Shapes on the same body never collide with each other.
@ -878,6 +886,7 @@ an existing shape using `b3Shape_GetFilter()` and
it causes contacts to be destroyed.
### Sensors
Sometimes game logic needs to know when two shapes overlap yet there
should be no collision response. This is done by using sensors. A sensor
is a shape that detects overlap but does not produce a response.

3537
extern/imguizmo/ImGuizmo.cpp vendored Normal file

File diff suppressed because it is too large Load diff

348
extern/imguizmo/ImGuizmo.h vendored Normal file
View file

@ -0,0 +1,348 @@
// https://github.com/CedricGuillemet/ImGuizmo
// v1.92.5 WIP
//
// The MIT License(MIT)
//
// Copyright(c) 2016-2026 Cedric Guillemet and contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -------------------------------------------------------------------------------------------
// History :
// 2026/05/03 v1.9 release. CMake build system, vcpkg support, many fixes and new features from contributors.
// 2019/11/03 View gizmo
// 2016/09/11 Behind camera culling. Scaling Delta matrix not multiplied by source matrix scales. local/world rotation and translation fixed. Display message is incorrect (X: ... Y:...) in local mode.
// 2016/09/09 Hatched negative axis. Snapping. Documentation update.
// 2016/09/04 Axis switch and translation plan autohiding. Scale transform stability improved
// 2016/09/01 Mogwai changed to Manipulate. Draw debug cube. Fixed inverted scale. Mixing scale and translation/rotation gives bad results.
// 2016/08/31 First version
//
// -------------------------------------------------------------------------------------------
// Future (no order):
//
// - Multi view
// - display rotation/translation/scale infos in local/world space and not only local
// - finish local/world matrix application
// - OPERATION as bitmask
//
// -------------------------------------------------------------------------------------------
// Example
#if 0
void EditTransform(const Camera& camera, matrix_t& matrix)
{
static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::ROTATE);
static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::WORLD);
if (ImGui::IsKeyPressed(90))
mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
if (ImGui::IsKeyPressed(69))
mCurrentGizmoOperation = ImGuizmo::ROTATE;
if (ImGui::IsKeyPressed(82)) // r Key
mCurrentGizmoOperation = ImGuizmo::SCALE;
if (ImGui::RadioButton("Translate", mCurrentGizmoOperation == ImGuizmo::TRANSLATE))
mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
ImGui::SameLine();
if (ImGui::RadioButton("Rotate", mCurrentGizmoOperation == ImGuizmo::ROTATE))
mCurrentGizmoOperation = ImGuizmo::ROTATE;
ImGui::SameLine();
if (ImGui::RadioButton("Scale", mCurrentGizmoOperation == ImGuizmo::SCALE))
mCurrentGizmoOperation = ImGuizmo::SCALE;
float matrixTranslation[3], matrixRotation[3], matrixScale[3];
ImGuizmo::DecomposeMatrixToComponents(matrix.m16, matrixTranslation, matrixRotation, matrixScale);
ImGui::InputFloat3("Tr", matrixTranslation, 3);
ImGui::InputFloat3("Rt", matrixRotation, 3);
ImGui::InputFloat3("Sc", matrixScale, 3);
ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, matrix.m16);
if (mCurrentGizmoOperation != ImGuizmo::SCALE)
{
if (ImGui::RadioButton("Local", mCurrentGizmoMode == ImGuizmo::LOCAL))
mCurrentGizmoMode = ImGuizmo::LOCAL;
ImGui::SameLine();
if (ImGui::RadioButton("World", mCurrentGizmoMode == ImGuizmo::WORLD))
mCurrentGizmoMode = ImGuizmo::WORLD;
}
static bool useSnap(false);
if (ImGui::IsKeyPressed(83))
useSnap = !useSnap;
ImGui::Checkbox("", &useSnap);
ImGui::SameLine();
vec_t snap;
switch (mCurrentGizmoOperation)
{
case ImGuizmo::TRANSLATE:
snap = config.mSnapTranslation;
ImGui::InputFloat3("Snap", &snap.x);
break;
case ImGuizmo::ROTATE:
snap = config.mSnapRotation;
ImGui::InputFloat("Angle Snap", &snap.x);
break;
case ImGuizmo::SCALE:
snap = config.mSnapScale;
ImGui::InputFloat("Scale Snap", &snap.x);
break;
}
ImGuiIO& io = ImGui::GetIO();
ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y);
ImGuizmo::Manipulate(camera.mView.m16, camera.mProjection.m16, mCurrentGizmoOperation, mCurrentGizmoMode, matrix.m16, NULL, useSnap ? &snap.x : NULL);
}
#endif
#pragma once
#ifdef USE_IMGUI_API
#include "imconfig.h"
#endif
#ifndef IMGUI_API
#define IMGUI_API
#endif
#ifndef IMGUIZMO_NAMESPACE
#define IMGUIZMO_NAMESPACE ImGuizmo
#endif
struct ImGuiWindow;
namespace IMGUIZMO_NAMESPACE
{
// call inside your own window and before Manipulate() in order to draw gizmo to that window.
// Or pass a specific ImDrawList to draw to (e.g. ImGui::GetForegroundDrawList()).
IMGUI_API void SetDrawlist(ImDrawList* drawlist = nullptr);
// call BeginFrame right after ImGui_XXXX_NewFrame();
IMGUI_API void BeginFrame();
// this is necessary because when imguizmo is compiled into a dll, and imgui into another
// globals are not shared between them.
// More details at https://stackoverflow.com/questions/19373061/what-happens-to-global-and-static-variables-in-a-shared-library-when-it-is-dynam
// expose method to set imgui context
IMGUI_API void SetImGuiContext(ImGuiContext* ctx);
// return true if mouse cursor is over any gizmo control (axis, plan or screen component)
IMGUI_API bool IsOver();
// return true if mouse IsOver or if the gizmo is in moving state
IMGUI_API bool IsUsing();
// return true if the view gizmo is in moving state
IMGUI_API bool IsUsingViewManipulate();
// only check if your mouse is over the view manipulator - no matter whether it's active or not
IMGUI_API bool IsViewManipulateHovered();
// return true if any gizmo is in moving state
IMGUI_API bool IsUsingAny();
// enable/disable the gizmo. Stay in the state until next call to Enable.
// gizmo is rendered with gray half transparent color when disabled
IMGUI_API void Enable(bool enable);
// helper functions for manualy editing translation/rotation/scale with an input float
// translation, rotation and scale float points to 3 floats each
// Angles are in degrees (more suitable for human editing)
// example:
// float matrixTranslation[3], matrixRotation[3], matrixScale[3];
// ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale);
// ImGui::InputFloat3("Tr", matrixTranslation, 3);
// ImGui::InputFloat3("Rt", matrixRotation, 3);
// ImGui::InputFloat3("Sc", matrixScale, 3);
// ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16);
//
// These functions have some numerical stability issues for now. Use with caution.
IMGUI_API void DecomposeMatrixToComponents(const float* matrix, float* translation, float* rotation, float* scale);
IMGUI_API void RecomposeMatrixFromComponents(const float* translation, const float* rotation, const float* scale, float* matrix);
IMGUI_API void SetRect(float x, float y, float width, float height);
// default is false
IMGUI_API void SetOrthographic(bool isOrthographic);
// Render coordinate system axes (red X, green Y and blue Z). Usefull for debug/tests
IMGUI_API void DrawAxes(const float* view, const float* projection, const float* matrices, int matrixCount);
// Render a cube with face color corresponding to face normal. Usefull for debug/tests
IMGUI_API void DrawCubes(const float* view, const float* projection, const float* matrices, int matrixCount);
IMGUI_API void DrawGrid(const float* view, const float* projection, const float* matrix, const float gridSize);
// Render grid with customizable major line step and amount of segments between major lines.
// NOTE(m.wlasiuk) : calling this function with majorStep = 1.0f and subdivision = 1 is equivalent to DrawGrid in terms of the end result but performs more calculations
IMGUI_API void DrawGridCustom(const float* view, const float* projection, const float* matrix, const float gridSize, const float majorStep, const unsigned int subdivision);
// Render grid with customizable major line step and amount of segments between major lines and with possibility to set custom colors for major, minor and center lines
IMGUI_API void DrawGridCustomColor(const float* view, const float* projection, const float* matrix, const float gridSize, const float majorStep, const unsigned int subdivision, const ImU32 majorCol, const ImU32 minorCol, const ImU32 centerCol);
// call it when you want a gizmo
// Needs view and projection matrices.
// matrix parameter is the source matrix (where will be gizmo be drawn) and might be transformed by the function. Return deltaMatrix is optional
// translation is applied in world space
enum OPERATION
{
TRANSLATE_X = (1u << 0),
TRANSLATE_Y = (1u << 1),
TRANSLATE_Z = (1u << 2),
ROTATE_X = (1u << 3),
ROTATE_Y = (1u << 4),
ROTATE_Z = (1u << 5),
ROTATE_SCREEN = (1u << 6),
SCALE_X = (1u << 7),
SCALE_Y = (1u << 8),
SCALE_Z = (1u << 9),
BOUNDS = (1u << 10),
SCALE_XU = (1u << 11),
SCALE_YU = (1u << 12),
SCALE_ZU = (1u << 13),
TRANSLATE = TRANSLATE_X | TRANSLATE_Y | TRANSLATE_Z,
ROTATE = ROTATE_X | ROTATE_Y | ROTATE_Z | ROTATE_SCREEN,
SCALE = SCALE_X | SCALE_Y | SCALE_Z,
SCALEU = SCALE_XU | SCALE_YU | SCALE_ZU, // universal
UNIVERSAL = TRANSLATE | ROTATE | SCALEU
};
inline OPERATION operator|(OPERATION lhs, OPERATION rhs)
{
return static_cast<OPERATION>(static_cast<int>(lhs) | static_cast<int>(rhs));
}
enum MODE
{
LOCAL,
WORLD
};
IMGUI_API bool Manipulate(const float* view, const float* projection, OPERATION operation, MODE mode, float* matrix, float* deltaMatrix = NULL, const float* snap = NULL, const float* localBounds = NULL, const float* boundsSnap = NULL);
//
// Please note that this cubeview is patented by Autodesk : https://patents.google.com/patent/US7782319B2/en
// It seems to be a defensive patent in the US. I don't think it will bring troubles using it as
// other software are using the same mechanics. But just in case, you are now warned!
//
IMGUI_API void ViewManipulate(float* view, float length, ImVec2 position, ImVec2 size, ImU32 backgroundColor);
// use this version if you did not call Manipulate before and you are just using ViewManipulate
IMGUI_API void ViewManipulate(float* view, const float* projection, OPERATION operation, MODE mode, float* matrix, float length, ImVec2 position, ImVec2 size, ImU32 backgroundColor);
IMGUI_API void SetAlternativeWindow(ImGuiWindow* window);
[[deprecated("Use PushID/PopID instead.")]]
IMGUI_API void SetID(int id);
// ID stack/scopes
// Read the FAQ (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui.
// - Those questions are answered and impacted by understanding of the ID stack system:
// - "Q: Why is my widget not reacting when I click on it?"
// - "Q: How can I have widgets with an empty label?"
// - "Q: How can I have multiple widgets with the same label?"
// - Short version: ID are hashes of the entire ID stack. If you are creating widgets in a loop you most likely
// want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them.
// - You can also use the "Label##foobar" syntax within widget label to distinguish them from each others.
// - In this header file we use the "label"/"name" terminology to denote a string that will be displayed + used as an ID,
// whereas "str_id" denote a string that is only used as an ID and not normally displayed.
IMGUI_API void PushID(const char* str_id); // push string into the ID stack (will hash string).
IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end); // push string into the ID stack (will hash string).
IMGUI_API void PushID(const void* ptr_id); // push pointer into the ID stack (will hash pointer).
IMGUI_API void PushID(int int_id); // push integer into the ID stack (will hash integer).
IMGUI_API void PopID(); // pop from the ID stack.
IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself
IMGUI_API ImGuiID GetID(const char* str_id_begin, const char* str_id_end);
IMGUI_API ImGuiID GetID(const void* ptr_id);
// return true if the cursor is over the operation's gizmo
IMGUI_API bool IsOver(OPERATION op);
IMGUI_API void SetGizmoSizeClipSpace(float value);
// Handle type used by the translate/rotate/scale gizmos.
enum MOVETYPE
{
MT_NONE,
MT_MOVE_X,
MT_MOVE_Y,
MT_MOVE_Z,
MT_MOVE_YZ,
MT_MOVE_ZX,
MT_MOVE_XY,
MT_MOVE_SCREEN,
MT_ROTATE_X,
MT_ROTATE_Y,
MT_ROTATE_Z,
MT_ROTATE_SCREEN,
MT_SCALE_X,
MT_SCALE_Y,
MT_SCALE_Z,
MT_SCALE_XYZ
};
// Returns which handle is actively being dragged, or MT_NONE.
IMGUI_API MOVETYPE GetActiveHandleType();
// Returns which handle is currently hovered, or MT_NONE.
IMGUI_API MOVETYPE GetHoveredHandleType();
// Aliases matching the MOVETYPE enum name.
IMGUI_API MOVETYPE GetActiveMoveType();
IMGUI_API MOVETYPE GetHoveredMoveType();
// Allow axis to flip
// When true (default), the guizmo axis flip for better visibility
// When false, they always stay along the positive world/local axis
IMGUI_API void AllowAxisFlip(bool value);
// Configure the limit where axis are hidden
IMGUI_API void SetAxisLimit(float value);
// Set an axis mask to permanently hide a given axis (true -> hidden, false -> shown)
IMGUI_API void SetAxisMask(bool x, bool y, bool z);
// Configure the limit where planes are hiden
IMGUI_API void SetPlaneLimit(float value);
// from a x,y,z point in space and using Manipulation view/projection matrix, check if mouse is in pixel radius distance of that projected point
IMGUI_API bool IsOver(float* position, float pixelRadius);
// Compute the world-space mouse picking ray from explicit inputs, without reading ImGui IO.
// Useful for tests/headless usage. view and projection are column-major float[16] (same
// layout as Manipulate). rayOrigin and rayDirection receive a float[3] each.
IMGUI_API void ComputeMouseRay(const float* view, const float* projection, const ImVec2& mousePosition, const ImVec2& rectPosition, const ImVec2& rectSize, float* rayOrigin, float* rayDirection);
enum COLOR
{
DIRECTION_X, // directionColor[0]
DIRECTION_Y, // directionColor[1]
DIRECTION_Z, // directionColor[2]
PLANE_X, // planeColor[0]
PLANE_Y, // planeColor[1]
PLANE_Z, // planeColor[2]
SELECTION, // selectionColor
INACTIVE, // inactiveColor
TRANSLATION_LINE, // translationLineColor
SCALE_LINE,
ROTATION_USING_BORDER,
ROTATION_USING_FILL,
HATCHED_AXIS_LINES,
TEXT,
TEXT_SHADOW,
COUNT
};
struct Style
{
IMGUI_API Style();
float TranslationLineThickness; // Thickness of lines for translation gizmo
float TranslationLineArrowSize; // Size of arrow at the end of lines for translation gizmo
float RotationLineThickness; // Thickness of lines for rotation gizmo
float RotationOuterLineThickness; // Thickness of line surrounding the rotation gizmo
float ScaleLineThickness; // Thickness of lines for scale gizmo
float ScaleLineCircleSize; // Size of circle at the end of lines for scale gizmo
float HatchedAxisLineThickness; // Thickness of hatched axis lines
float CenterCircleSize; // Size of circle at the center of the translate/scale gizmo
ImVec4 Colors[COLOR::COUNT];
};
IMGUI_API Style& GetStyle();
}

21
extern/imguizmo/LICENSE vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Cedric Guillemet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -5893,7 +5893,9 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
[NSApp activateIgnoringOtherApps:YES];
[_sapp.macos.window makeKeyAndOrderFront:nil];
_sapp_macos_update_dimensions();
[NSEvent setMouseCoalescingEnabled:NO];
// See https://github.com/erincatto/box3d/issues/37
// [NSEvent setMouseCoalescingEnabled:NO];
// workaround for window not being focused during a long init callback
// for details see: https://github.com/floooh/sokol/pull/982

View file

@ -4,6 +4,7 @@
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// Compile-time options. Edit box3d/config.h, or define BOX3D_USER_CONFIG to
@ -38,7 +39,7 @@
#ifdef __cplusplus
#define B3_API extern "C" BOX3D_EXPORT
#define B3_INLINE inline
#define B3_ALIGN_AS(N) alignas(N)
#if defined( _MSC_VER )
#define B3_FORCE_INLINE __forceinline
#elif defined( __GNUC__ ) || defined( __clang__ )
@ -52,6 +53,7 @@
#else
#define B3_API BOX3D_EXPORT
#define B3_INLINE static inline
#define B3_ALIGN_AS(N) _Alignas(N)
#if defined( _MSC_VER )
#define B3_FORCE_INLINE static __forceinline
@ -67,6 +69,13 @@
#endif
// clang-format on
// This is used to validate arguments for functions similar to printf.
#if defined( __GNUC__ ) || defined( __clang__ )
#define B3_PRINTF_FORMAT( INDEX1, INDEX2 ) __attribute__( ( format( printf, INDEX1, INDEX2 ) ) )
#else
#define B3_PRINTF_FORMAT( INDEX1, INDEX2 )
#endif
#if defined( BOX3D_VALIDATE ) && !defined( NDEBUG )
#define B3_ENABLE_VALIDATION 1
#else
@ -85,11 +94,12 @@
/// Prototype for user allocation function.
/// @param size the allocation size in bytes
/// @param alignment the required alignment, guaranteed to be a power of 2
typedef void* b3AllocFcn( int32_t size, int32_t alignment );
typedef void* b3AllocFcn( size_t size, int32_t alignment );
/// Prototype for user free function.
/// @param mem the memory previously allocated through `b3AllocFcn`
typedef void b3FreeFcn( void* mem );
/// @param size the size of the allocation in bytes.
typedef void b3FreeFcn( void* mem, size_t size );
/// Prototype for the user assert callback. Return 0 to skip the debugger break.
typedef int b3AssertFcn( const char* condition, const char* fileName, int lineNumber );
@ -102,7 +112,7 @@ typedef void b3LogFcn( const char* message );
B3_API void b3SetAllocator( b3AllocFcn* allocFcn, b3FreeFcn* freeFcn );
/// Total bytes allocated by Box3D
B3_API int32_t b3GetByteCount( void );
B3_API int64_t b3GetByteCount( void );
/// Override the default assert callback.
/// @param assertFcn a non-null assert callback
@ -124,7 +134,7 @@ B3_API void b3SetAssertFcn( b3AssertFcn* assertFcn );
/// Internal assertion handler. Allows for host intervention.
B3_API int b3InternalAssert( const char* condition, const char* fileName, int lineNumber );
/// Assert that a condition is true.
#define B3_ASSERT( condition ) \
#define B3_ASSERT( condition ) \
( (void)( ( !!( condition ) ) || ( b3InternalAssert( #condition, __FILE__, (int)( __LINE__ ) ), 0 ) ) )
#else
#define B3_ASSERT( ... ) ( (void)0 )
@ -163,6 +173,13 @@ B3_API b3Version b3GetVersion( void );
/// @return true if the library was built with BOX3D_DOUBLE_PRECISION (large world mode)
B3_API bool b3IsDoublePrecision( void );
/// @return the value of B3_MAX_MANIFOLD_POINTS the library was compiled with. Useful for
/// an ABI test.
B3_API int b3GetMaxManifoldPoints( void );
/// @return true if the current CPU has the AVX2 instruction set.
B3_API bool b3IsAVX2Available( void );
/**@}*/
//! @cond
@ -186,8 +203,4 @@ B3_API void b3Sleep( int milliseconds );
#define B3_HASH_INIT 5381
B3_API uint32_t b3Hash( uint32_t hash, const uint8_t* data, int count );
// Dump file support functions
B3_API void b3WriteBinaryFile( void* data, int size, const char* fileName );
B3_API void* b3ReadBinaryFile( const char* prefix, const char* fileName, int* memSize );
//! @endcond

Some files were not shown because too many files have changed in this diff Show more