Compare commits

...

200 Commits

Author SHA1 Message Date
11e53383c7 feat: deterministic natural logarithm
The rocket equation produces par-fuel and delta-v figures that ship inside
level data. A value that differs between platforms is the same class of bug
as a desynced replay, so log belongs in the kernel rather than falling back
to the host libm.

Reduce x = m*2^k with m in [2/3, 4/3), then ln(m) = 2*atanh((m-1)/(m+1)).
Accurate to <1e-13 against the host libm across the tested range.
2026-09-15 01:05:10 +03:00
4c82aabc5d feat: deterministic cross-platform math kernel
Replaces every host-libm call in the physics source with a kernel built from
IEEE-754-exact operations only, so simulation results are bit-identical on
ARM64/JavaScriptCore and x86-64/V8.

ECMAScript permits Math.sin/cos/atan2 to be implementation-dependent
approximations, and Rot.setAngle and Sweep.getTransform call them for every
rotating body on every step. Without this, a replay recorded on mobile does
not reproduce on desktop, which breaks replay verification and leaderboards.

- add src/common/DeterministicMath.ts (fdlibm-derived polynomials and
  Cody-Waite range reduction, plus a seeded mulberry32 PRNG)
- rewire the nine hoisted aliases in Math, Matrix, Rot, Sweep and
  dynamics/Position; no host libm call remains in src/
- export DeterministicMath and seedRandom for consumers
- add determinism tests, incl. a free fall matching the analytic solution

All 14 upstream tests still pass (22 total).
2026-09-15 00:52:19 +03:00
Ali Shakiba
93dd64df0f v1.5.0 2026-04-07 15:59:37 +03:30
Ali Shakiba
6ede4f3d2d Publish add-body, add-fixture, add-joint events 2026-04-07 15:16:03 +03:30
Ali Shakiba
86c9079d69 Remove hasVertex0 and hasVertex3 from serialize Edge 2026-04-07 15:15:48 +03:30
Ali Shakiba
7791ea1f1b Remove temp fields from distance-joint serialization 2026-04-07 15:15:40 +03:30
Ali Shakiba
9415379691 Add fixedRotation to body serialize 2026-04-07 15:15:31 +03:30
Ali Shakiba
4fc10a7fee In polygon and chain deserialize use Vec2Value 2026-04-07 15:14:59 +03:30
Ali Shakiba
c96feaccea v1.4.3 2026-02-10 15:31:37 +03:30
Ali Shakiba
0bba3b2911 Bug fix addVec2 2026-02-10 15:30:00 +03:30
Ali Shakiba
f6d90c2703 Cleanup eslint, upgrade dev deps 2026-02-08 23:08:31 +03:30
Ali Shakiba
83e5f622be remove api doc, ignore docs/dist 2026-02-08 20:15:49 +03:30
Ali Shakiba
18a00bdcf6 use vitepress 2026-02-08 20:00:27 +03:30
Ali Shakiba
cdbf302d41 update docs 2025-10-21 14:05:17 -05:00
Ali Shakiba
3b561c1880 fix example 2025-06-06 07:21:41 +03:30
Ali Shakiba
724e410c8f fix example 2025-06-01 21:38:46 +03:30
Ali Shakiba
cbec05b7e8 v1.4.2 2025-06-01 21:33:59 +03:30
Ali Shakiba
9343ffc8ec fix testbed drawing 2025-06-01 21:32:45 +03:30
Ali Shakiba
be9b789942 clean up assert and unused statements 2025-06-01 11:24:41 +03:30
Ali Shakiba
3aee543586 fix testbed page 2025-06-01 11:03:05 +03:30
Ali Shakiba
23e89ec1f7 v1.4.1 2025-05-30 16:16:08 +03:30
Ali Shakiba
d12d0cc9df fix shape name export 2025-05-30 16:14:31 +03:30
Ali Shakiba
54cfa2d206 add setup and teardown to benchmark 2025-05-29 21:14:22 +03:30
Ali Shakiba
37414c7dad v1.4.0 2025-05-26 19:43:18 +03:30
Ali Shakiba
97e4fcd011 change changesets scripts 2025-05-26 19:41:16 +03:30
Ali Shakiba
75ece37751 pretty code 2025-05-26 19:41:12 +03:30
Ali Shakiba
0dcc98b053 split TestbedInterface and Testbed class 2025-05-26 19:41:05 +03:30
Ali Shakiba
e1a271755d mark serialize and deserialize as hidden instead of internal 2025-05-26 17:31:08 +03:30
Ali Shakiba
3446820c88 fix aabb raycast 2025-05-26 17:25:07 +03:30
Ali Shakiba
1999deb142
fix typo in contacts doc 2025-04-28 15:18:15 -05:00
Ali Shakiba
02600898af update docs 2025-04-14 21:28:32 +03:30
Ali Shakiba
ffc8cb316d change local dev testbed url format and handling 2025-04-13 13:24:34 +03:30
Ali Shakiba
f628eabc36
Update limitations.md 2025-02-10 01:31:52 +03:30
Ali Shakiba
6cfb385214 update docs, use object literal 2025-01-29 19:25:02 +03:30
Ali Shakiba
8416d7b516 Add playground link to docs 2024-12-28 02:26:06 +03:30
Ali Shakiba
1c50a3f381 build v1.3.0 2024-12-28 02:03:06 +03:30
Ali Shakiba
ce1c486efa No pointer interaction when mouseForce===0 2024-12-28 02:00:31 +03:30
Ali Shakiba
56193e788c Add DataDriver (experimental) 2024-12-27 22:42:56 +03:30
Ali Shakiba
bb9bb873fc Testbed rendering rewrite 2024-12-27 22:41:01 +03:30
Ali Shakiba
7c400fa896 build v1.2.0 2024-12-24 20:11:59 +03:30
Ali Shakiba
97bb79eb94 Improve queueUpdate 2024-12-24 20:09:56 +03:30
Ali Shakiba
4b06bb31bd Unify createFixture usage in examples 2024-12-24 19:58:07 +03:30
Ali Shakiba
f0127f4fe6
Add world.queueUpdate 2024-12-24 17:41:58 +03:30
Ali Shakiba
5b611d70fb Unify createBody usage in examples 2024-12-24 15:07:16 +03:30
Ali Shakiba
3b496b846c migrate examples to Vec2Value 2024-12-23 18:57:15 +03:30
Ali Shakiba
0b31620212 build v1.1.6 2024-12-23 18:30:56 +03:30
Ali Shakiba
922ff97583 Add static Vec2.normalize 2024-12-23 18:29:40 +03:30
Ali Shakiba
bee0e1609a Change clampVec2 arg to Vec2Value 2024-12-23 18:25:46 +03:30
Ali Shakiba
fe31a9101e fix api docs links 2024-12-20 15:08:27 +03:30
Ali Shakiba
97b1a8387d v1.1.5 2024-12-19 23:15:21 +03:30
Ali Shakiba
fbd0021e30 Un-hidden style field type 2024-12-19 23:13:52 +03:30
Ali Shakiba
50ce8a971a add changesets 2024-12-19 23:12:55 +03:30
Ali Shakiba
bdbac53347 add noEmit to eslint 2024-12-19 23:09:21 +03:30
Ali Shakiba
a1753d5a1d build v1.1.4 2024-12-18 15:24:45 +03:30
Ali Shakiba
a7a62dddd8 update examples 2024-12-18 15:23:07 +03:30
Ali Shakiba
cc7fde175f fix testbed style 2024-12-18 15:21:38 +03:30
Ali Shakiba
e2c850a5d4 allow style in fixture/body/joint def 2024-12-18 15:21:21 +03:30
Ali Shakiba
22541bc6e6 migrate examples to ts 2024-12-18 14:18:45 +03:30
Ali Shakiba
9604296ed3 rename examples to .ts 2024-12-18 14:18:44 +03:30
Ali Shakiba
c11f0493f6 build v1.1.3 2024-12-18 14:17:43 +03:30
Ali Shakiba
7d09b35cea update eslint 2024-12-18 13:02:16 +03:30
Ali Shakiba
fa2112ffc1 add clampVec2 2024-12-18 13:00:20 +03:30
Ali Shakiba
3cf402108c update optional joint props type 2024-12-18 13:00:14 +03:30
Ali Shakiba
c08580cd36 fix typedoc 2024-12-15 14:41:31 +03:30
Ali Shakiba
92ce0d1080 examples: use vite-alias planck, and lint pretty 2024-12-15 13:30:32 +03:30
Ali Shakiba
71f4e5c286 v1.1.2: add body.setTransform(xf) signature 2024-12-03 22:19:17 +03:30
Ali Shakiba
0e58a85d1a v1.1.1: fix serializing chain with loop 2024-11-30 23:31:39 +03:30
Ali Shakiba
b4d7ffa0ee v1.1.0 2024-11-24 09:31:10 +03:30
Ali Shakiba
cbaf2299c4 simplify license notice 2024-11-23 16:32:23 +03:30
Ali Shakiba
e5048fe80d
v1.1.0-alpha: vite build migration 2024-11-23 16:08:24 +03:30
Ali Shakiba
514a34b23f
remove year from license 2024-11-23 12:46:32 +03:30
Ali Shakiba
d87394b2e4
bump actions/checkout@v4 and actions/setup-node@v4 2024-11-22 22:26:59 +03:30
Ali Shakiba
9930e2174d lint testbed 2024-11-22 13:24:52 +03:30
Ali Shakiba
a4fbc31180 fix collide circle types 2024-11-22 13:23:28 +03:30
Ali Shakiba
733e30b659 v1.0.9: fix exported internal.Settings and hide internal, stats 2024-11-19 12:57:40 +03:30
Ali Shakiba
b6883d0723 Fix api index 2024-11-18 17:54:19 +03:30
Ali Shakiba
0e0bef9c1e v1.0.8: lint 2024-11-18 11:29:36 +03:30
Ali Shakiba
55a9b170d2 Build v1.0.7: testbed minor update 2024-11-17 23:03:44 +03:30
Ali Shakiba
50ff5fd0f9 add lineWidth to style 2024-11-10 19:01:27 +03:30
Ali Shakiba
4cd1883c2f clean up testbed class 2024-11-10 19:01:21 +03:30
Ali Shakiba
56f0d71814 add eslint quotes and semi rules 2024-10-27 23:41:00 +03:30
Ali Shakiba
404ebd14e2
exclude examples from tsconfig 2024-10-12 14:09:31 +03:30
Ali Shakiba
a9f23fa414 Fix wheel-joint doc 2024-09-30 23:53:02 +03:30
Ali Shakiba
9e20146bc5 Build v1.0.6: use es5 stage.js 2024-09-30 23:38:39 +03:30
Ali Shakiba
fb79f188fa
Update wheel-joint.md 2024-09-30 22:27:14 +03:30
Ali Shakiba
4b6d6ec0ab build v1.0.5 2024-08-17 01:40:15 +03:30
Ali Shakiba
363f566ce3 mv stage-js to peerDependencies 2024-08-17 01:40:15 +03:30
ArShAm
11d3966c1a
add utility iframe messenger to docs 2024-08-13 15:09:31 +03:30
Wojciech Maj
8ef74eca53 Remove unnecessary dependency on is-core-module 2024-08-09 22:41:03 +03:30
Ali Shakiba
ca98be96ae update docs 2024-07-23 23:10:43 +03:30
Ali Shakiba
0d2efe6ae0 replace vec2 with vec2value in the api, update docs 2024-05-23 23:07:21 +03:30
Ali Shakiba
293c0c6d1d update docs 2024-05-13 16:44:09 +03:30
James Stanley
fe829184b3 Example renderer: refer to this.world instead of global world 2024-05-02 14:39:39 +03:30
Ali Shakiba
09cf743d5e clean up docs 2024-05-02 12:50:37 +03:30
Ali Shakiba
3d9286bd81 migrate docs to vocs 2024-05-02 00:05:28 +03:30
James Stanley
e8e3ff9b3c
Documentation cleanup (#278)
documentation cleanup
2024-04-30 22:17:38 +03:30
James Stanley
fc913b1f22 Don't dereference null pointer if elements don't exist 2024-04-29 20:30:22 +03:30
Ali Shakiba
7caf1509c2 add docs pages 2024-04-29 20:07:45 +03:30
Ali Shakiba
f089bb0c66 use new stage version 2024-04-24 23:38:42 +03:30
Ali Shakiba
34e256609a update ray cast docs and minor bug fix 2024-04-01 16:55:16 +03:30
Ali Shakiba
2b0dd3d0e9 build 1.0.2 2024-03-13 16:49:16 +03:30
Ali Shakiba
4fc3e0325d clean up serializer code 2024-03-12 16:00:30 +03:30
Ali Shakiba
c2c482fd8b fix types 2024-03-12 16:00:30 +03:30
Ali Shakiba
6de9126f75 build 1.0.1 2024-01-01 20:01:49 -08:00
Ali Shakiba
af22d7c3d1 minor fix api visibility 2024-01-01 20:01:39 -08:00
Ali Shakiba
282c3fac45 build v1.0.0 2023-12-30 16:09:06 -08:00
Ali Shakiba
041726a83f build v1.0-beta.20 2023-12-26 19:39:48 -08:00
Ali Shakiba
b205657281 normalize joints _reset 2023-12-26 19:37:24 -08:00
Ali Shakiba
3e1f0bc74e add appData 2023-12-26 19:09:49 -08:00
Ali Shakiba
0a2556722b build beta.18 2023-12-25 19:04:39 -08:00
Ali Shakiba
ba52e0c9ff rename matrix functions 2023-12-25 18:50:41 -08:00
Ali Shakiba
eade1934a0 build v1.0.0-beta.18 2023-12-24 23:22:20 -08:00
Ali Shakiba
1ea2ddd477 update docs 2023-12-24 23:19:11 -08:00
Ali Shakiba
4de71d9038 build v1.0.0-beta.17 2023-12-24 22:33:09 -08:00
Ali Shakiba
1bbdadc890 add style for debugging 2023-12-20 23:24:43 -08:00
Ali Shakiba
dc63010b82 add Testbed.start() shortcut 2023-12-20 22:52:01 -08:00
Ali Shakiba
4830ce50cf use Vec2Value interface in the api 2023-12-20 22:48:53 -08:00
Ali Shakiba
3c6390079f update testbed types 2023-12-20 22:47:10 -08:00
Ali Shakiba
a714319f6c fix json schema 2023-12-20 22:35:09 -08:00
Oliver Zell
80803cbca4
fix: fix numerical stability for area weighted centroid 2023-12-20 21:00:57 +01:00
Ali Shakiba
820f6105d7 fix setMassData 2023-09-09 11:54:00 -07:00
Oliver Zell
3efc9234ff
feat: set sideEffects to false for planck.js (#262) 2023-08-28 18:58:54 +02:00
Ali Shakiba
1aa9fb300a remove unfinished rope 2023-08-26 21:33:07 -07:00
Ali Shakiba
fcfec569be clean up step functions 2023-08-26 21:25:45 -07:00
Ali Shakiba
6b3113eb57 build v1.0.0-beta.15 2023-08-26 16:42:08 -07:00
Ali Shakiba
7f82dc49f3 fix api doc 2023-08-26 16:41:20 -07:00
Ali Shakiba
83e71a3339 add npm preflight 2023-08-26 15:43:36 -07:00
Ali Shakiba
b42b76f4bc update api-doc 2023-08-26 15:43:19 -07:00
Ali Shakiba
6ab76c7b21 fix example 2023-08-26 15:42:09 -07:00
Ali Shakiba
71cb8243bf use vec2value in joints api 2023-08-26 15:41:59 -07:00
Ali Shakiba
4a54360b54 build v1-beta.14 2023-08-26 11:56:32 -07:00
Ali Shakiba
ae249043ed call refilter after updating filter data 2023-08-26 11:51:58 -07:00
Ali Shakiba
f190017c19 update WorldRayCastCallback doc 2023-08-24 23:44:58 -07:00
Ali Shakiba
25074e5ff3
Update README.md 2023-08-24 23:24:44 -07:00
Ali Shakiba
2edd8a14ed add js-doc for rot fields 2023-08-24 17:26:02 -07:00
Ali Shakiba
ee8785ff30 build v1-beta.13 2023-08-24 12:29:59 -07:00
Ali Shakiba
549e597d11 add template testbed example 2023-08-24 12:28:21 -07:00
Ali Shakiba
cb7052f1c1 fix velocity shift on mass data change 2023-08-24 12:26:43 -07:00
Ali Shakiba
57d8126998 remove old build files 2023-08-24 11:55:03 -07:00
Ali Shakiba
33eabb680c build v1-beta.12 2023-08-23 21:58:00 -07:00
Ali Shakiba
a29feef14f functional change from box2d #582 2023-08-23 21:57:17 -07:00
Ali Shakiba
cfc9102453 awake body on setTransform 2023-08-23 21:53:37 -07:00
Ali Shakiba
9d86ecc65b convert MassData to interface 2023-08-23 02:34:55 -07:00
Ali Shakiba
5b96d954b7 update Body.shouldCollide docs 2023-08-23 00:42:52 -07:00
Ali Shakiba
d43d2c1919 update api doc 2023-08-22 12:40:19 -07:00
Ali Shakiba
e957136800 fix typo in Settings 2023-08-22 12:23:12 -07:00
harun
a69b20475a
docs: Update Body class documentation (#259)
Added information about the setType and getType methods in the Body class documentation.
2023-08-20 09:28:08 -07:00
Ali Shakiba
a971fb7908 refactor testbed api 2023-08-20 09:23:47 -07:00
Ali Shakiba
ce047fa2e9 build v1.0-beta.9 2023-08-16 19:50:00 -07:00
Ali Shakiba
edd5883795 set v1-beta to umd, with es option 2023-08-16 19:43:31 -07:00
Ali Shakiba
80a5693796 refactor math functions 2023-08-16 19:43:31 -07:00
Ali Shakiba
48f873e6ea clean up revolute joint 2023-08-16 19:42:58 -07:00
Ali Shakiba
c7e93407f5 testbed use canvas drawing for joints 2023-08-16 19:42:58 -07:00
Ali Shakiba
5dafb74b72 fix fixture proxies reactivation 2023-08-16 19:41:42 -07:00
Ali Shakiba
1d77eb8e90 update api docs and examples 2023-08-14 13:59:23 -07:00
Ali Shakiba
2b297519d9 update build v1-beta.8 2023-08-11 09:54:13 -07:00
Ali Shakiba
46aea292e5 add lengthUnitsPerMeter to settings 2023-08-11 09:40:52 -07:00
Ali Shakiba
277f60eb13 update build v1-beta.7 2023-08-11 08:15:49 -07:00
Ali Shakiba
6090cc44a7 initialize DistanceInput 2023-08-11 08:11:10 -07:00
Ali Shakiba
b7ce8be80e
optimize matrix functions (#255) 2023-08-10 20:55:02 -07:00
Ali Shakiba
9bc1bc03dc fix node benchmark 2023-08-09 23:53:44 -07:00
Oliver Zell
652eb41563
test: switch to vitest (#252)
* test: switch to vitest

* docs: exclude tests from typedocs

* chore: remove ts-node dependency

* test: remove chai dependency
2023-08-07 13:32:29 -07:00
Ali Shakiba
e942302745 add git info to benchmark page 2023-08-06 23:41:04 -07:00
Ali Shakiba
322bdaf42b improve memory allocation 2023-08-06 22:20:43 -07:00
Ali Shakiba
500bb9c71e
fix benchmark link 2023-08-06 22:13:14 -07:00
Ali Shakiba
3aa18f07b6 add benchmark 2023-08-06 21:56:56 -07:00
Ali Shakiba
2ca89b0ad2 update stage.js version 2023-08-06 19:55:25 -07:00
Oliver Zell
849f0e7f9b fix: fix testbed findBody function 2023-08-06 19:29:11 -07:00
Ali Shakiba
1a4b19d3ee fix build, js files default to esm 2023-08-06 19:16:45 -07:00
Ali Shakiba
c2877d248c update pool class 2023-08-06 12:22:21 -07:00
Ali Shakiba
0d4e72564a remove duplicate type 2023-08-05 21:38:22 -07:00
Oliver Zell
a904b1fdb3
Merge pull request #247 from piqnt/shape-cast
feat: add ShapeCast function
2023-08-05 10:15:42 +02:00
Oliver Zell
05352bd7b6 docs: make ShapeCast example more interesting 2023-08-05 10:14:42 +02:00
Oliver Zell
bbcdc54da4 feat: add ShapeCast function 2023-08-05 09:29:46 +02:00
Oliver Zell
65eaf4d858 refactor: use early returns 2023-08-04 16:27:56 -07:00
Oliver Zell
c76525ba24 fix: fix anchor A formula for MotorJoint to include the offset 2023-08-04 16:27:56 -07:00
Oliver Zell
5ed20efedb docs: added documentation of damping parameter units 2023-08-04 16:27:56 -07:00
Oliver Zell
09b41946e3 refactor!: remove getVertex method on shapes 2023-08-04 16:27:56 -07:00
Oliver Zell
bfd859669b feat: body.setAwake now resets the sleep timer even if the body is awake 2023-08-04 16:27:56 -07:00
Oliver Zell
c7e33ee2d1 refactor: polygonal radius clarity 2023-08-04 16:27:56 -07:00
Oliver Zell
af01b2921d refactor: remove dead code 2023-08-04 16:27:56 -07:00
Oliver Zell
3ccbd84dc4 refactor: minor refactorings 2023-08-04 16:27:56 -07:00
Ali Shakiba
39a983b7c5
make build backward compatible (#245) 2023-08-01 14:30:08 -07:00
Ali Shakiba
cbfba8ccc8
typescript testbed and vite build (#244) 2023-07-31 21:47:06 -07:00
Ali Shakiba
499075d715
refactor exports and add esm export (#243) 2023-07-31 19:35:10 -07:00
Ali Shakiba
c8e7407241
update links 2023-07-28 19:02:24 -07:00
Ali Shakiba
f41da62e94
update links 2023-07-28 19:00:59 -07:00
Ali Shakiba
836cdb0d5f fix typo 2023-07-28 02:05:59 -07:00
harun
2d69c7727b Update OneSidedPlatform.js
Added comments for clarification of if(0) { ... } else { ... } usage
2023-07-23 22:34:22 -07:00
Ali Shakiba
298d7dd6d4
move docs to new site 2023-07-09 01:06:21 -07:00
Jean Saint Fleur
9ae39ce602 remove userData exception when he has falsy value "0" 2023-07-06 18:14:37 -07:00
Ali Shakiba
26b6185f95
remove install instruction 2023-07-04 23:55:51 -07:00
Ali Shakiba
29d2462eb3
fix DistanceJoint typing 2023-06-13 15:51:55 -07:00
Ali Shakiba
1702647e06 move initialization after factory call check 2023-06-12 11:17:29 -07:00
Ali Shakiba
889236ea3c move build-utils 2023-06-09 08:19:20 -07:00
Ali Shakiba
361199edae update license and changes 2023-06-09 08:19:20 -07:00
Ali Shakiba
04e9f70561 remove babel 2023-06-09 08:19:20 -07:00
Ali Shakiba
83eb157c73
remove bower.json 2023-06-08 18:09:06 -07:00
Ali Shakiba
83e3e33295
Update README.md 2023-06-02 23:08:58 -07:00
Oliver Zell
3b262124ce alpha.4 2022-03-29 12:23:36 +02:00
435 changed files with 95853 additions and 92869 deletions

View File

@ -1,8 +0,0 @@
{
"presets": [
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}

8
.changeset/README.md Normal file
View File

@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

11
.changeset/config.json Normal file
View File

@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}

View File

@ -1,35 +0,0 @@
module.exports = {
'extends': [
'plugin:@typescript-eslint/recommended',
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'project': 'tsconfig.json',
'sourceType': 'module',
},
'plugins': [
'@typescript-eslint',
],
'rules': {
'no-var': 'off',
'prefer-rest-params': 'off',
'prefer-spread': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/typedef': [
'error',
{
'arrowParameter': true,
'propertyDeclaration': true,
},
],
},
};

50
.github/workflows/deploy-docs.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Deploy docs to github pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master", "main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: lts/*
cache: "npm"
- name: Install dependencies
run: npm install
- name: Build
run: npm run typedoc && npm run docs:build
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
# Upload dist folder
path: "./dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View File

@ -14,10 +14,10 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '14'
node-version: '18'
- name: npm-install
run: npm install

52
.gitignore vendored
View File

@ -1,7 +1,51 @@
node_modules/
.idea
**/ignore
**/ignore.*
dist/docs/
# typedoc
docs/pages/api/
# vitepress
docs/.vitepress/cache/
docs/.vitepress/dist/
docs/.vitepress/.temp/
# misc
.DS_Store
*.pem
# dependencies
node_modules
.pnp
.pnp.js
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
.env
# testing
/coverage
/.nyc_output
# production
build
/docs/dist
# next.js
.next/
# out/
# vercel
.vercel
# ide
.idea/
.vscode*/
# typescript
*.tsbuildinfo
next-env.d.ts

2
.prettierignore Normal file
View File

@ -0,0 +1,2 @@
/dist/
/docs/api/

4
.prettierrc.json Normal file
View File

@ -0,0 +1,4 @@
{
"printWidth": 120,
"quoteProps": "preserve"
}

77
CHANGELOG.md Normal file
View File

@ -0,0 +1,77 @@
# planck
## 1.5.0
### Minor Changes
- 6ede4f3: Publish add-body, add-fixture, add-joint events
### Patch Changes
- 9415379: Add fixedRotation to body serialize
- 7791ea1: Remove temp fields from distance-joint serialization
- 86c9079: Remove hasVertex0 and hasVertex3 from serialize Edge
- 4fc10a7: In polygon and chain \_deserialize use Vec2Value
## 1.4.3
### Patch Changes
- 0bba3b2: Bug fix addVec2
## 1.4.2
### Patch Changes
- 9343ffc: Fix testbed drawing
## 1.4.1
### Patch Changes
- d12d0cc: Fix shape name alias export
## 1.4.0
### Minor Changes
- 0dcc98b: Split TestbedInterface and Testbed class
### Patch Changes
- e1a2717: Mark serialize and deserialize functions as @hidden instead of @internal
- 3446820: Fix AABB.rayCast
## 1.3.0
### Minor Changes
- bb9bb87: Testbed rendering rewrite
- 56193e7: Add DataDriver (experimental for demo use-case)
### Patch Changes
- ce1c486: No pointer interaction when mouseForce===0
## 1.2.0
### Minor Changes
- f0127f4: Add world.queueUpdate() to queue and defer updates after current simulation step
### Patch Changes
- 97bb79e: Improve world.queueUpdate
## 1.1.6
### Patch Changes
- f31114b: Add static Vec2.normalize
- bee0e16: Change clampVec2 arg to Vec2Value
## 1.1.5
### Patch Changes
- fbd0021: Un-hidden style field type

View File

@ -1,3 +1,10 @@
## 1.1.0
* Vite build migration
## 1.0.0
* Typescript migration
* Performance improvements
## 0.2
* TypeScript definitions added
* wSet/wAdd/wSub(a, v, b, w) replaced with combine/setCombine/addCombine/subCombine(a, v, b, w)

View File

@ -1,106 +0,0 @@
/*
* MIT License
* Copyright (c) 2019 Erin Catto
*
* 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.
*/
/*
* This is a simple example of building and running a simulation
* using Planck.js. Here we create a large ground box and a small dynamic
* box.
* There are no graphics for this example. Planck.js is meant to be used
* with your rendering engine in your game engine.
*
* To run this example simply run `node HelloWorld.js` from command line.
*/
var planck = require('./dist/planck')
var Vec2 = planck.Vec2;
// Define the gravity vector.
var gravity = Vec2(0.0, -10.0);
// Construct a world object, which will hold and simulate the rigid bodies.
var world = planck.World(gravity);
// Define the ground body.
var groundBodyDef = {
position: Vec2(0.0, -10.0)
};
// Call the body factory which allocates memory for the ground body
// from a pool and creates the ground box shape (also from a pool).
// The body is also added to the world.
var groundBody = world.createBody(groundBodyDef);
// Define the ground box shape.
// The extents are the half-widths of the box.
var groundBox = planck.Box(50.0, 10.0);
// Add the ground fixture to the ground body.
groundBody.createFixture(groundBox, 0.0);
// Define the dynamic body. We set its position and call the body factory.
var bodyDef = {
type: 'dynamic',
position: Vec2(0.0, 4.0),
}
var body = world.createBody(bodyDef);
// Define another box shape for our dynamic body.
var dynamicBox = planck.Box(1.0, 1.0);
// Define the dynamic body fixture.
var fixtureDef = {
shape: dynamicBox,
// Set the box density to be non-zero, so it will be dynamic.
density: 1.0,
// Override the default friction.
friction: 0.3,
};
// Add the shape to the body.
body.createFixture(fixtureDef);
// Prepare for simulation. Typically we use a time step of 1/60 of a
// second (60Hz) and 10 iterations. This provides a high quality simulation
// in most game scenarios.
var timeStep = 1.0 / 60.0;
var velocityIterations = 6;
var positionIterations = 2;
// This is our little game loop.
for (var i = 0; i < 60; ++i) {
// Instruct the world to perform a single step of simulation.
// It is generally best to keep the time step and iterations fixed.
world.step(timeStep, velocityIterations, positionIterations);
// Now print the position and angle of the body.
var position = body.getPosition();
var angle = body.getAngle();
console.log(position.x.toFixed(2), position.y.toFixed(2), angle.toFixed(2));
}
console.log(Math.abs(position.x) < 0.01);
console.log(Math.abs(position.y - 1.01) < 0.01);
console.log(Math.abs(angle) < 0.01);

86
HelloWorld.ts Normal file
View File

@ -0,0 +1,86 @@
/*
* Copyright (c) Erin Catto
* Licensed under the MIT license
*/
/*
* This is a simple example of building and running a simulation
* using Planck.js. Here we create a large ground box and a small dynamic
* box.
* There are no graphics for this example. Planck.js is meant to be used
* with your rendering engine in your game engine.
*
* To run this example simply run `node HelloWorld.js` from command line.
*/
import { Box, World } from "./src";
// Define the gravity vector.
var gravity = { x: 0.0, y: -10.0 };
// Construct a world object, which will hold and simulate the rigid bodies.
var world = new World({
gravity: gravity,
});
// Define the ground body.
var groundBodyDef = {
position: { x: 0.0, y: -10.0 },
};
// Call the body factory which allocates memory for the ground body
// from a pool and creates the ground box shape (also from a pool).
// The body is also added to the world.
var groundBody = world.createBody(groundBodyDef);
// Define the ground box shape.
// The extents are the half-widths of the box.
var groundBox = new Box(50.0, 10.0);
// Add the ground fixture to the ground body.
groundBody.createFixture(groundBox, 0.0);
// Define the dynamic body. We set its position and call the body factory.
var body = world.createBody({
type: "dynamic",
position: { x: 0.0, y: 4.0 },
});
// Define another box shape for our dynamic body.
var dynamicBox = new Box(1.0, 1.0);
// Define the dynamic body fixture.
var fixtureDef = {
shape: dynamicBox,
// Set the box density to be non-zero, so it will be dynamic.
density: 1.0,
// Override the default friction.
friction: 0.3,
};
// Add the shape to the body.
body.createFixture(fixtureDef);
// Prepare for simulation. Typically we use a time step of 1/60 of a
// second (60Hz) and 10 iterations. This provides a high quality simulation
// in most game scenarios.
var timeStep = 1.0 / 60.0;
var velocityIterations = 6;
var positionIterations = 2;
// This is our little game loop.
for (var i = 0; i < 60; ++i) {
// Instruct the world to perform a single step of simulation.
// It is generally best to keep the time step and iterations fixed.
world.step(timeStep, velocityIterations, positionIterations);
// Now print the position and angle of the body.
var position = body.getPosition();
var angle = body.getAngle();
console.log(position.x.toFixed(2), position.y.toFixed(2), angle.toFixed(2));
}
console.log(Math.abs(position.x) < 0.01);
console.log(Math.abs(position.y - 1.01) < 0.01);
console.log(Math.abs(angle) < 0.01);

View File

@ -1,6 +1,5 @@
The MIT License
Copyright (c) 2021 Erin Catto, Ali Shakiba
Copyright (c) Erin Catto, Ali Shakiba
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

196
README.md
View File

@ -1,155 +1,65 @@
# planck-deterministic
A fork of [planck.js](https://github.com/piqnt/planck.js) (MIT, Erin Catto / Ali Shakiba)
with a **cross-platform deterministic math kernel**.
## Why
Upstream planck calls the host `Math.sin`, `Math.cos`, `Math.atan2` and `Math.random`.
IEEE-754 guarantees `+ - * /` and `sqrt` are correctly rounded, so those are identical
everywhere — but ECMAScript explicitly permits an *implementation-dependent approximation*
for the transcendental functions, and every engine forwards them to the host libm. Those
results differ between ARM64/JavaScriptCore (iOS) and x86-64/V8 (desktop).
`Rot.setAngle` and `Sweep.getTransform` call sin/cos for **every rotating body on every
step**. So a simulation shared between a mobile build and a desktop build diverges as soon
as anything rotates. That breaks replay portability, server-side replay verification, and
any leaderboard built on re-simulating a replay.
## What changed
- Added `src/common/DeterministicMath.ts` — `sin`, `cos`, `exp`, `atan`, `atan2`, `sqrt` and
a seeded PRNG, built from `+ - * /` and comparisons only. Coefficients and the Cody-Waite
range reduction follow fdlibm (Sun, freely distributable), the reference implementation
most libms derive from. Accuracy is within a few ulp of the host libm.
- Rewired the nine hoisted aliases in `Math.ts`, `Matrix.ts`, `Rot.ts`, `Sweep.ts` and
`dynamics/Position.ts` to use it. **No host libm call remains anywhere in `src/`.**
- Exported the kernel (`DeterministicMath`, `seedRandom`) so consumers can share the exact
same functions the solver uses and seed the PRNG for reproducible replays.
Every upstream test still passes, plus new determinism tests including a check that a
simulated free fall matches the closed-form analytic solution.
```js
import { World, seedRandom, DeterministicMath } from "planck-deterministic";
seedRandom(12345); // before a run, and before replaying it
```
## Upstream
This tracks planck.js v1.5.0. Upstream docs and API below.
---
# Planck.js
Planck.js is JavaScript (TypeScript) rewrite of Box2D physics engine for cross-platform HTML5 game development.
Planck.js is JavaScript/TypeScript rewrite of Box2D physics engine for cross-platform HTML5 game development.
#### Motivations
- Taking advantage of Box2D's efforts and achievements
- Developing readable and maintainable JavaScript code
- Developing readable and editable code in JavaScript/TypeScript
- Providing idiomatic JavaScript/TypeScript API
- Optimizing the library for web and mobile platforms
- Providing a JavaScript-friendly API
#### [Documentation](https://piqnt.com/planck.js/docs/)
## Documentation
#### [Examples](https://piqnt.com/planck.js/)
- [Documentation Wiki](https://github.com/shakiba/planck.js/wiki/) - This is the best place to start, and find other resources
- [Examples](https://piqnt.com/planck.js/) - Online examples with editable code
#### [Discord](https://discord.com/invite/znjh6J7)
#### [Made with Planck.js](https://github.com/piqnt/planck.js/wiki/)
## Community
- [Discord](https://discord.gg/znjh6J7) - Community discussions and Q/A
- [Twitter @Piqnt](https://twitter.com/piqnt) - Updates and news
- [GitHub](https://github.com/shakiba/planck.js/) - Source code and issues
## API and Architecture
Planck.js includes Box2D algorithms without modification and its architecture is very similar to Box2D.
However some internal changes and refactoring are made during rewrite to address differences between C++ and JavaScript.
Planck.js public API closely follows Box2D API, with the following differences:
- `b2` prefix is dropped from class names, for example `b2World` is now available as `planck.World`.
- Method names are converted from UpperCamelCase to lowerCamelCase.
- Definition classes/objects (BodyDef, FixtureDef, etc.) are replaced by inline JavaScript objects (`{}`).
- Shapes are considered immutable and are not cloned when used to create fixtures.
- Contact filtering can be customized by overriding shouldCollide method of Fixture.
- Listener classes are replaced with simple functions.
- `World#on(eventName, listenerFn)` and `World#off(eventName, listenerFn)` are added to add and remove event listeners. Currently supported events are:
`'begin-contact'`, `'end-contact'`, `'pre-solve'`, `'post-solve'`, `'remove-joint'`, `'remove-fixture'`, `'remove-body'`
## Updates
#### v1.0-alpha
- Source code is migrated to TypeScript, to improves library usability, documentation and maintenance.
- Package name for v1.0+ is changed to `planck`. Package name for releases *before v1.0* is `planck-js`.
- `planck.internal` namespace is deprecated and everything is directly available under main namesapce (except `planck.internal.stats`).
- Source files are moved to `/src` directory (from `/lib`) and directory layout is updated to match Box2D.
- Rollup is used to build the project.
## Install
### v0.3 (stable release)
To install `planck-js@0.3` (stable release) see [v0.3 branch](https://github.com/shakiba/planck.js/tree/v0.3#install).
### v1.0 (alpha)
Staring from v1.0 package name is changed to `planck`.
Releases and updates before v1.0 will remain available under `planck-js`.
##### CDN
Planck.js is available on [jsDelivr](https://www.jsdelivr.com/package/npm/planck).
##### NPM
Install npm package.
```sh
npm install planck
```
Import it in your code.
```js
import * as planck from 'planck';
```
##### Testbed
Use CDN in a web page.
```html
<html><body>
<script src="//cdn.jsdelivr.net/npm/planck@latest/dist/planck-with-testbed.min.js"></script>
<script>
planck.testbed(function(testbed) {
// Your testbed code
});
</script>
</body></html>
```
Use NPM package in Node.
```js
const planck = require('planck/dist/planck-with-testbed');
planck.testbed(function() {
// ...
});
```
## Projects
#### Games
- [Astray 2](https://wwwtyro.github.io/astray-2/) ([source](https://github.com/wwwtyro/astray-2)) by Rye Terrell
- [Rope](https://one.fserb.com/rope/) ([source](https://github.com/fserb/one/blob/master/src/rope.js)) by Fernando Serboncini
- [I have to flap](https://ihavetoflap.web.app/) by Elias Ku
- [Hoverator](https://vgel.me/hoverator/) by Jonathon Vogel
- [Totem Destroyer](https://www.emanueleferonato.com/2021/03/13/build-a-html5-game-like-old-flash-glory-totem-destroyer-using-phaser-and-planck-js-physics-engine/) by Emanuele Feronato
- [Pancake Tower](https://pancake-tower.netlify.app/) by Aloysius Kieth
- [Acolyte Fight](https://acolytefight.io/)
- [Comeback](http://romainclement.eu/Comeback/) by Romain Clément
- [Nitro Clash](http://nitroclash.io/)
- [Space Rage 2](https://space-rage-2-bad-prospects-dev.netlify.app/) by Hendrik Mans
- Air Hockey ([source](https://github.com/Steveeeie/webgl-air-hockey-server)) by Steve Meredith
- [Coined](https://coined--parameterized.repl.co/) ([source](https://repl.it/talk/challenge/Coined/13314))
- [Zzzone!](https://www.engehausen.de/jan/zzz.html) ([source](https://github.com/smurf667/zzzone)) by Jan Engehausen
- [Star Fly](https://fxplayground.herokuapp.com/) by Kal Torak
#### Dynamic Visualization
- [Fall / Fill](https://twitter.com/jezzamonn/status/1246212104593403905) by Jez Swanson
- [1000 Unique Postcards](https://twitter.com/andreasgysin/status/956131218386509824) by Andreas Gysin
- [Flag in the Wind](https://codepen.io/unframework/pen/OrOMBg) by Nick Matantsev
- [Dynamic Convex Hull](https://codepen.io/bozheng-stokes/pen/abormNX) by Bo Zheng
- [Chaotic Water Wheel](https://john-hearn.info/articles/simulate-chaotic-water-wheel-with-planck) by John Hearn
#### Science and AI
- [Handle](https://twitter.com/marurur/status/1240141036606947329) by Ichiro Maruta
- [Q-Learning Ragdoll](https://codepen.io/mikkokam/pen/EGEjYe) by Mikko Kämäräinen
- [Walking EA](https://matsemann.github.io/walkingea/) by Mats Krüger Svensson
- [Neuroevolution Bots](https://twitter.com/mishig25/status/1077672181503590400) by Mishig Davaadorj
- [Bubble Treemaps](https://github.com/grtlr/bubble-treemaps)
- [Walking Robot](https://neuro-ts.vercel.app/walk) [Source](https://github.com/suhdonghwi/neuro-ts/)
#### Game Development
- [Space](https://piqnt.com/space/)
- [Modd.io](https://www.modd.io/)
## Credits
[Box2D](https://github.com/erincatto/box2d) is a popular C++ 2D rigid-body physics engine created by [Erin Catto](https://twitter.com/erin_catto). Box2D is used in several popular games, such as Angry Birds, Limbo and Crayon Physics, as well as game development tools and libraries such as Apple's SpriteKit.
[Planck.js](https://github.com/shakiba/planck.js) is developed and maintained by [Ali Shakiba](https://github.com/shakiba/).
TypeScript definitions for planck.js are developed by [Oliver Zell](https://github.com/zOadT).
## License
Planck.js is [available under the MIT license](./LICENSE.txt).
#### [Report Issues](https://github.com/piqnt/planck.js/issues)
To speed up resolving issues, please provide [testbed](https://piqnt.com/planck.js/docs/testbed) code to reproduce the issue.

225
benchmark/benchmark.ts Normal file
View File

@ -0,0 +1,225 @@
export interface TestInterface {
name: string;
createBoxShape: (hx: number, hy: number) => any;
createBoxBody: (shape: any, x: number, y: number, density: number) => any;
step: (timeStep: number, velocityIterations: number, positionIterations: number) => void;
setup: () => void;
teardown: () => void;
}
export interface XY {
x: number;
y: number;
}
export type TestFactory = (gravity: XY, edgeV1: XY, edgeV2: XY, edgeDensity: number) => TestInterface;
const PYRAMID_SIZE = 40;
const GRAVITY = { x: 0, y: -10 };
const DELTA_X = { x: 0.5625, y: 1 };
const DELTA_Y = { x: 1.125, y: 0 };
const BOX_DENSITY = 5;
const GROUND_DENSITY = 0;
const TIME_STEP = 1 / 60;
const VELOCITY_ITERATIONS = 3;
const POSITION_ITERATIONS = 3;
const EDGE_V1 = { x: -40, y: 0 };
const EDGE_V2 = { x: 40, y: 0 };
const START_X = { x: -7, y: 0.75 };
const BOX_SIZE = { x: 0.5, y: 0.5 };
const WARMUP_ITERATIONS = 64;
const BENCH_ITERATIONS = 256;
function setupWorld(test: TestInterface) {
// Setup world
const shape = test.createBoxShape(BOX_SIZE.x, BOX_SIZE.y);
const x = { ...START_X };
for (let i = 0; i < PYRAMID_SIZE; ++i) {
const y = { ...x };
for (let j = i; j < PYRAMID_SIZE; ++j) {
test.createBoxBody(shape, y.x, y.y, BOX_DENSITY);
y.x += DELTA_Y.x;
y.y += DELTA_Y.y;
}
x.x += DELTA_X.x;
x.y += DELTA_X.y;
}
}
export type ProgressFunc = (value: number, max: number) => void;
async function warmupAsync(test: TestInterface, progress: ProgressFunc): Promise<void> {
return new Promise<void>((resolve: (value: void) => void) => {
let step = 0;
progress(0, WARMUP_ITERATIONS + BENCH_ITERATIONS);
const runNext = () => {
if (step < WARMUP_ITERATIONS) {
test.step(TIME_STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
progress(step, WARMUP_ITERATIONS + BENCH_ITERATIONS);
step++;
window.requestAnimationFrame(runNext);
} else {
resolve();
}
};
window.requestAnimationFrame(runNext);
});
}
async function benchAsync(test: TestInterface, progress: ProgressFunc): Promise<number[]> {
return new Promise((resolve: (value: number[]) => void) => {
let step = 0;
progress(0, WARMUP_ITERATIONS + BENCH_ITERATIONS);
const times: number[] = [];
const runNext = () => {
if (step < BENCH_ITERATIONS) {
const begin = performance.now();
test.step(TIME_STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
times.push(performance.now() - begin);
progress(WARMUP_ITERATIONS + step, WARMUP_ITERATIONS + BENCH_ITERATIONS);
step++;
window.requestAnimationFrame(runNext);
} else {
resolve(times);
}
};
window.requestAnimationFrame(runNext);
});
}
function warmup(test: TestInterface) {
for (let i = 0; i < WARMUP_ITERATIONS; i++) {
test.step(TIME_STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
}
}
function bench(test: TestInterface) {
const times: number[] = [];
for (let i = 0; i < BENCH_ITERATIONS; i++) {
const begin = performance.now();
test.step(TIME_STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
times.push(performance.now() - begin);
}
return times.sort();
}
function mean(values: number[]) {
let total = 0;
for (const value of values) total += value;
return total / BENCH_ITERATIONS;
}
// Simple nearest-rank %ile (on sorted array). We should have enough samples to make this reasonable.
function percentile(values: number[], pc: number) {
const rank = Math.floor((pc * values.length) / 100);
return values[rank];
}
export function prepareTests(factories: TestFactory[]) {
return factories.map((factory: TestFactory) => factory(GRAVITY, EDGE_V1, EDGE_V2, GROUND_DENSITY));
}
export function runTest(test: TestInterface) {
setupWorld(test);
warmup(test);
const times = bench(test);
return {
name: test.name,
avg: mean(times),
p5: percentile(times, 5),
p95: percentile(times, 95),
};
}
export async function runTestAsync(test: TestInterface, progress: ProgressFunc) {
setupWorld(test);
await warmupAsync(test, progress);
const times = await benchAsync(test, progress);
return {
name: test.name,
avg: mean(times),
p5: percentile(times, 5),
p95: percentile(times, 95),
};
}
export type TestResult = ReturnType<typeof runTest>;
export function runAllTests(factories: TestFactory[]) {
const tests = prepareTests(factories);
const results: TestResult[] = [];
console.log("Running Benchmarks:");
for (const test of tests) {
const result = runTest(test);
results.push(result);
console.log(` ✓ ${result.name}`);
}
return results.sort((a: TestResult, b: TestResult) => a.avg - b.avg);
}
const noop = () => undefined;
export async function runAllTestsAsync(factories: TestFactory[]) {
const tests = prepareTests(factories);
console.log("Running Benchmarks:");
const results: TestResult[] = [];
for (const test of tests) {
// eslint-disable-next-line no-await-in-loop
const result = await runTestAsync(test, noop);
console.log(` ✓ ${result.name}`);
results.push(result);
}
return results.sort((a: TestResult, b: TestResult) => a.avg - b.avg);
}
export function resultsToMarkdown(results: TestResult[]) {
const header = ["Name", "avg ms/frame", "5th %ile", "95th %ile", "Ratio"];
const rows = results.map((r: TestResult) => [
r.name,
r.avg.toFixed(2),
r.p5.toString(),
r.p95.toString(),
(r.avg / results[0].avg).toFixed(2),
]);
const lengths = header.map((label: string, index: number) =>
Math.max(label.length, ...rows.map((columns: string[]) => columns[index].length)),
);
function getDashes(length: number) {
return "-".repeat(length);
}
const dashes = `| ${lengths.map(getDashes).join(" | ")} |`;
const lines: string[] = [];
lines.push(`| ${header.map(pad).join(" | ")} |`);
lines.push(dashes);
function pad(value: string, index: number) {
const length = lengths[index];
if (value.length < length) {
if (index > 0) return " ".repeat(length - value.length) + value;
return value + " ".repeat(length - value.length);
}
return value;
}
for (const row of rows) {
lines.push(`| ${row.map(pad).join(" | ")} |`);
}
return lines.join("\n");
}
export function logResults(results: TestResult[]) {
console.log("\nResults:");
console.log(resultsToMarkdown(results));
}

106
benchmark/browser.ts Normal file
View File

@ -0,0 +1,106 @@
import { prepareTests, resultsToMarkdown, runTestAsync, TestResult, TestInterface, TestFactory } from "./benchmark";
import { box2dJsFactory } from "./tests/box2d-js";
import { planckFactory } from "./tests/planck";
export const tests: TestFactory[] = [
box2dJsFactory,
planckFactory,
];
export function getBrowserInfo() {
const ua = navigator.userAgent;
let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) ?? [];
if (/trident/i.test(M[1])) {
const tem = /\brv[ :]+(\d+)/g.exec(ua) ?? [];
const version = tem[1] || "";
return `IE ${version}`;
}
if (M[1] === "Chrome") {
const tem = ua.match(/\bOPR|Edge\/(\d+)/);
if (tem !== null) return `Opera ${tem[1]}`;
}
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, "-?"];
const tem = ua.match(/version\/(\d+)/i);
if (tem !== null) M.splice(1, 1, tem[1]);
return `${M[0]} ${M[1]}`;
}
const startButton = document.getElementById("start") as HTMLButtonElement;
const tbody = document.querySelector("tbody") as HTMLElement;
const ratioHead = document.getElementById("ratio") as HTMLElement;
const branchName = document.getElementById("branch-name") as HTMLElement;
branchName.innerHTML = [
import.meta.env.VITE_GIT_BRANCH_NAME,
import.meta.env.VITE_GIT_COMMIT_HASH.slice(0, 7),
import.meta.env.VITE_GIT_COMMIT_DATE.slice(0, 19).replace("T", " "),
'\"' + import.meta.env.VITE_GIT_LAST_COMMIT_MESSAGE + '\"',
].join("<br />");
const testRows = prepareTests(tests).map((test: TestInterface) => {
const row = document.createElement("tr");
tbody.appendChild(row);
const name = document.createElement("td");
const avg = document.createElement("td");
const p5 = document.createElement("td");
const p95 = document.createElement("td");
const ratio = document.createElement("td");
name.textContent = test.name;
row.appendChild(name);
row.appendChild(avg);
row.appendChild(p5);
row.appendChild(p95);
row.appendChild(ratio);
const progress = document.createElement("progress");
return {
row,
test,
begin() {
test.setup();
ratio.appendChild(progress);
progress.value = 0;
},
progress(value: number, max: number) {
progress.value = value;
progress.max = max;
},
end(result: TestResult) {
test.teardown();
avg.textContent = result.avg.toFixed(2);
p5.textContent = result.p5.toString();
p95.textContent = result.p95.toString();
ratio.textContent = "✓";
},
final(ratioValue: number) {
ratio.textContent = ratioValue.toFixed(2);
tbody.appendChild(row);
},
};
});
type TestResultAndRow = TestResult & { testRow: typeof testRows[0] };
export async function runAllTestsAsync() {
ratioHead.textContent = "";
const results: TestResultAndRow[] = [];
for (const testRow of testRows) {
testRow.begin();
// eslint-disable-next-line no-await-in-loop
const result = await runTestAsync(testRow.test, testRow.progress);
testRow.end(result);
results.push({ ...result, testRow });
}
results.sort((a: TestResultAndRow, b: TestResultAndRow) => a.avg - b.avg).forEach((result: TestResultAndRow) => result.testRow.final(result.avg / results[0].avg));
startButton.removeAttribute("disabled");
ratioHead.textContent = "Ratio";
console.log(`Browser: ${getBrowserInfo()}\n${resultsToMarkdown(results)}`);
}
startButton.addEventListener("click", () => {
startButton.disabled = true;
runAllTestsAsync();
});

49
benchmark/index.html Normal file
View File

@ -0,0 +1,49 @@
<html>
<head>
<meta charset="utf-8" />
<title>Planck.js/Box2D Benchmark</title>
<style>
th, td {
padding: 2px 5px;
}
table {
border-collapse: collapse;
margin-top: 5px;
}
td {
border: 1px solid gray;
}
th:first-child {
text-align: left;
}
progress {
width: 200px;
}
textarea {
width: 500px;
height: 300px;
}
</style>
</head>
<body>
<h3>Planck.js/Box2D Benchmark</h3>
<button id="start">Start</button>
<table>
<thead>
<tr>
<th>Name</th>
<th>avg ms/frame</th>
<th>5th %ile</th>
<th>95th %ile</th>
<th id="ratio">Ratio</th>
</tr>
</thead>
<tbody></tbody>
</table>
<script src="https://kripken.github.io/box2d.js/build/Box2D_v2.3.1_min.js"></script>
<script type="module" src="./browser.ts"></script>
<br />
<br />
<span id="branch-name"></span>
</body>
</html>

13
benchmark/node.ts Normal file
View File

@ -0,0 +1,13 @@
import { performance } from "perf_hooks";
global.performance = performance as any;
import { logResults, runAllTests } from "./benchmark";
import type { TestFactory } from "./benchmark";
import { planckFactory } from "./tests/planck";
export const tests: TestFactory[] = [
planckFactory,
];
const results = runAllTests(tests);
logResults(results);

View File

@ -0,0 +1,42 @@
import "./fixprocess";
const { b2Body, b2World, b2Vec2, b2EdgeShape, b2PolygonShape, b2_dynamicBody, b2BodyDef } = Box2D;
import type { TestFactory } from "../benchmark";
export const box2dJsFactory: TestFactory = (gravity, edgeV1, edgeV2, edgeDensity) => {
let world: typeof b2World;
let ground: typeof b2Body;
let edgeShape: typeof b2EdgeShape;
return {
name: "box2d.js",
setup() {
world = new b2World(new b2Vec2(gravity.x, gravity.y));
ground = world.CreateBody(new b2BodyDef());
edgeShape = new b2EdgeShape();
edgeShape.Set(new b2Vec2(edgeV1.x, edgeV1.y), new b2Vec2(edgeV2.x, edgeV2.y));
ground.CreateFixture(edgeShape as any, edgeDensity);
},
teardown() {
world = null;
ground = null;
edgeShape = null;
},
createBoxShape(hx: number, hy: number) {
const box = new b2PolygonShape();
box.SetAsBox(hx, hy);
return box;
},
createBoxBody(shape: any, x: number, y: number, density: number) {
const bd = new b2BodyDef();
bd.set_type(b2_dynamicBody);
bd.set_position(new b2Vec2(x, y));
const body = world.CreateBody(bd);
body.CreateFixture(shape, density);
},
step(timeStep: number, velocityIterations: number, positionIterations: number) {
world.Step(timeStep, velocityIterations, positionIterations);
},
};
};

View File

@ -0,0 +1,19 @@
// box2d.js tries to access process.stdout/err, need to emulate it
if ("requestAnimationFrame" in globalThis) {
// // @ts-ignore
// window.process.stdout = {
// write(x: string) {
// console.log(x);
// return true;
// },
// };
// // @ts-ignore
// globalThis.process.stderr = {
// write(x: string) {
// console.error(x);
// return true;
// },
// };
}

39
benchmark/tests/planck.ts Normal file
View File

@ -0,0 +1,39 @@
import { World, Vec2, EdgeShape, BoxShape, Body } from "../../src/index";
import { TestFactory } from "../benchmark";
export const planckFactory: TestFactory = (gravity, edgeV1, edgeV2, edgeDensity) => {
let world: World | null = null;
let ground: Body | null = null;
let edgeShape: EdgeShape | null = null;
return {
name: "planck.js (current)",
setup() {
world = new World({
gravity: new Vec2(gravity.x, gravity.y),
});
ground = world.createBody({});
edgeShape = new EdgeShape(new Vec2(edgeV1.x, edgeV1.y), new Vec2(edgeV2.x, edgeV2.y));
ground.createFixture(edgeShape as any, edgeDensity);
},
createBoxShape(hx: number, hy: number) {
return new BoxShape(hx, hy);
},
createBoxBody(shape: any, x: number, y: number, density: number) {
const body = world?.createBody({
type: "dynamic",
position: new Vec2(x, y),
});
body?.createFixture(shape, density);
},
step(timeStep: number, velocityIterations: number, positionIterations: number) {
world?.step(timeStep, velocityIterations, positionIterations);
},
teardown() {
world = null;
ground = null;
edgeShape = null;
},
};
};

View File

@ -1,20 +0,0 @@
{
"name": "planck",
"description": "2D JavaScript/TypeScript physics engine for cross-platform HTML5 game development",
"keywords": [
"box2d",
"html5",
"javascript",
"typescript",
"game",
"physics",
"engine",
"2d",
"mobile"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/shakiba/planck.js.git"
}
}

View File

@ -1,157 +0,0 @@
import ts from 'typescript';
export default options => context => node => {
return ts.visitEachChild(node, (node) => visitor(context.factory, node, options), context);
}
function visitor(factory, node, options) {
if (!ts.isClassDeclaration(node) ||
!isClassIncluded(node.name.escapedText, options)) {
return node;
}
if (isClassDerived(node)) {
// workaround for https://github.com/microsoft/TypeScript/issues/46503
return splitClassIntoConstAndInterface(factory, node);
}
return createNodeWithFactories(factory, node);
}
function isClassIncluded(className, options) {
return options.classes.includes(className);
}
function isClassDerived(node) {
return node.heritageClauses[0] !== undefined;
}
function splitClassIntoConstAndInterface(factory, node) {
return [
createConstNodeWithStaticMethods(factory, node),
createInterfaceWithMethods(factory, node)
];
}
function createConstNodeWithStaticMethods(factory, node) {
return factory.createVariableStatement(
[factory.createModifier(ts.SyntaxKind.DeclareKeyword)],
factory.createVariableDeclarationList(
[factory.createVariableDeclaration(
node.name,
undefined,
factory.createTypeLiteralNode([
// constructors
...node.members
.filter(ts.isConstructorDeclaration)
.flatMap(member => [
factory.createConstructSignature(
undefined,
member.parameters,
factory.createTypeReferenceNode(
node.name,
undefined
)
),
factory.createCallSignature(
undefined,
member.parameters,
factory.createTypeReferenceNode(
node.name,
undefined
)
)
].map(node => copyComments(node, member))
),
// static properties
...node.members
.filter(member => hasModifier(ts.SyntaxKind.StaticKeyword, member))
.filter(member => !hasModifier(ts.SyntaxKind.PrivateKeyword, member))
.map(member => declarationToSignature(factory, member))
]
),
undefined
)],
ts.NodeFlags.Const | ts.NodeFlags.Ambient | ts.NodeFlags.ContextFlags
)
);
}
function createInterfaceWithMethods(factory, node) {
const result = factory.createInterfaceDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.DeclareKeyword)],
node.name,
undefined,
node.heritageClauses,
// instance properties
node.members
.filter(member => !ts.isConstructorDeclaration(member))
.filter(member => !hasModifier(ts.SyntaxKind.StaticKeyword, member))
.filter(member => !hasModifier(ts.SyntaxKind.PrivateKeyword, member))
.map(member => declarationToSignature(factory, member))
);
return copyComments(result, node);
}
function hasModifier(kind, node) {
return node.modifiers?.some?.(modifier => modifier.kind === kind);
}
function declarationToSignature(factory, node) {
let result;
switch (node.kind) {
case ts.SyntaxKind.PropertyDeclaration:
result = factory.createPropertySignature(
undefined,
node.name,
undefined,
node.type
);
break;
case ts.SyntaxKind.MethodDeclaration:
result = factory.createMethodSignature(
undefined,
node.name,
undefined,
undefined,
node.parameters,
node.type
);
break;
default:
throw new Error(`Could not convert node of kind ${node.kind} to signature.`);
}
return copyComments(result, node);
}
function createNodeWithFactories(factory, node) {
return [
...node.members
.filter(ts.isConstructorDeclaration)
.map(member => member.parameters)
.map(parameters => createFunctionDeclaration(factory, node, parameters)),
node
];
}
function createFunctionDeclaration(factory, node, parameters) {
const result = factory.createFunctionDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.DeclareKeyword)],
undefined,
node.name,
undefined,
parameters,
factory.createTypeReferenceNode(
node.name,
undefined
),
undefined
);
return copyComments(result, node);
}
function copyComments(node, original) {
ts.setSyntheticLeadingComments(node, ts.getSyntheticLeadingComments(original));
ts.setSyntheticTrailingComments(node, ts.getSyntheticTrailingComments(original));
return node;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

16987
dist/planck-with-testbed.mjs vendored Normal file

File diff suppressed because it is too large Load Diff

1
dist/planck-with-testbed.mjs.map vendored Normal file

File diff suppressed because one or more lines are too long

7381
dist/planck.d.ts vendored

File diff suppressed because it is too large Load Diff

26665
dist/planck.js vendored

File diff suppressed because it is too large Load Diff

2
dist/planck.js.map vendored

File diff suppressed because one or more lines are too long

23
dist/planck.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

12144
dist/planck.mjs vendored Normal file

File diff suppressed because it is too large Load Diff

1
dist/planck.mjs.map vendored Normal file

File diff suppressed because one or more lines are too long

96
docs/.vitepress/config.ts Normal file
View File

@ -0,0 +1,96 @@
import { defineConfig } from "vitepress";
// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "Planck.js Docs",
description: "2D Physics Engine for JavaScript",
srcDir: "./pages",
base: "/planck.js/docs/",
outDir: "../dist/docs",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
search: {
provider: "local",
},
nav: [
{ text: "API Reference", link: "/api/" },
{ text: "Playground", link: "https://piqnt.com/" },
{ text: "GitHub", link: "https://github.com/piqnt/planck.js/" },
{ text: "Discord", link: "https://discord.gg/znjh6J7" },
],
sidebar: [
{ link: "/", text: "Introduction" },
{
text: "Get Started",
collapsed: true,
items: [
{ link: "/run-your-code", text: "Run Your Code" },
{ link: "/hello-world", text: "Hello World" },
{ link: "/core-concepts", text: "Core Concepts" },
{ link: "/install", text: "Install" },
],
},
{
text: "API Conventions",
collapsed: true,
items: [
{ link: "/api-conventions/units", text: "Units" },
{ link: "/api-conventions/factories-and-definitions", text: "Factories and Definitions" },
{ link: "/api-conventions/implicit-destruction", text: "Implicit Destruction" },
{ link: "/api-conventions/user-data", text: "User Data" },
],
},
{ link: "/world", text: "World" },
{ link: "/body", text: "Body" },
{ link: "/fixture", text: "Fixture" },
{
text: "Shape",
collapsed: true,
link: "/shape",
items: [
{ link: "/shape", text: "Shape" },
{ link: "/shape/circle", text: "Circle" },
{ link: "/shape/polygon", text: "Polygon" },
{ link: "/shape/edge", text: "Edge" },
{ link: "/shape/chain", text: "Chain" },
],
},
{
text: "Joint",
collapsed: true,
link: "/joint",
items: [
{ link: "/joint", text: "Joint" },
{ link: "/joint/distance-joint", text: "Distance Joint" },
{ link: "/joint/friction-joint", text: "Friction Joint" },
{ link: "/joint/gear-joint", text: "Gear Joint" },
{ link: "/joint/motor-joint", text: "Motor Joint" },
{ link: "/joint/prismatic-joint", text: "Prismatic Joint" },
{ link: "/joint/pulley", text: "Pulley" },
{ link: "/joint/revolute-joint", text: "Revolute Joint" },
{ link: "/joint/rope-joint", text: "Rope Joint" },
{ link: "/joint/weld-joint", text: "Weld Joint" },
{ link: "/joint/wheel-joint", text: "Wheel Joint" },
{ link: "/joint/mouse-joint", text: "Mouse Joint" },
],
},
{ link: "/contacts", text: "Contacts" },
{ link: "/collision", text: "Collision" },
{ link: "/world/simulation", text: "Simulation" },
{ link: "/rendering", text: "Rendering" },
{ link: "/testbed", text: "Testbed" },
{ link: "/limitations", text: "Limitations" },
{ link: "/api/", text: "API Reference" },
{ link: "/references-resources", text: "References & Resources" },
{ link: "/credits", text: "Credits & License" },
],
},
});

View File

@ -1,71 +0,0 @@
### API Index
* [World](/docs/api/classes/world.md)
* [Body](/docs/api/classes/body.md)
* [Fixture](/docs/api/classes/fixture.md)
* [Settings](/docs/api/classes/settings.md)
#### Math
* [Math](/docs/api/classes/math.md)
* [Vec2](/docs/api/classes/vec2.md)
* [Vec3](/docs/api/classes/vec3.md)
* [Transform](/docs/api/classes/transform.md)
* [Rot](/docs/api/classes/rot.md)
* [Mat22](/docs/api/classes/mat22.md)
* [Mat33](/docs/api/classes/mat33.md)
#### Shapes
* [BoxShape](/docs/api/classes/boxshape.md)
* [ChainShape](/docs/api/classes/chainshape.md)
* [CircleShape](/docs/api/classes/circleshape.md)
* [EdgeShape](/docs/api/classes/edgeshape.md)
* [PolygonShape](/docs/api/classes/polygonshape.md)
#### Joints
* [FrictionJoint](/docs/api/classes/frictionjoint.md)
* [DistanceJoint](/docs/api/classes/distancejoint.md)
* [GearJoint](/docs/api/classes/gearjoint.md)
* [MotorJoint](/docs/api/classes/motorjoint.md)
* [MouseJoint](/docs/api/classes/mousejoint.md)
* [PrismaticJoint](/docs/api/classes/prismaticjoint.md)
* [PulleyJoint](/docs/api/classes/pulleyjoint.md)
* [RevoluteJoint](/docs/api/classes/revolutejoint.md)
* [RopeJoint](/docs/api/classes/ropejoint.md)
* [WeldJoint](/docs/api/classes/weldjoint.md)
* [WheelJoint](/docs/api/classes/wheeljoint.md)
#### Collision Internal
* [BroadPhase](/docs/api/classes/broadphase.md)
* [AABB](/docs/api/classes/aabb.md)
* [DynamicTree](/docs/api/classes/dynamictree.md)
* [TreeNode](/docs/api/classes/treenode.md)
* [DistanceProxy](/docs/api/classes/distanceproxy.md)
* [ContactFeatureType](/docs/api/enums/contactfeaturetype.md)
* [ManifoldType](/docs/api/enums/manifoldtype.md)
* [TOIOutputState](/docs/api/enums/toioutputstate.md)
* [FixtureProxy](/docs/api/interfaces/fixtureproxy.md)
* [Manifold](/docs/api/interfaces/manifold.md)
* [ManifoldPoint](/docs/api/interfaces/manifoldpoint.md)
* [WorldManifold](/docs/api/interfaces/worldmanifold.md)
#### Dynamics Internal
* [Solver](/docs/api/classes/solver.md)
* [Contact](/docs/api/classes/contact.md)
* [ContactImpulse](/docs/api/classes/contactimpulse.md)
* [ContactEdge](/docs/api/classes/contactedge.md)
* [ContactFeature](/docs/api/interfaces/contactfeature.md)
* [ContactID](/docs/api/interfaces/contactid.md)
* [Position](/docs/api/classes/position.md)
* [Velocity](/docs/api/classes/velocity.md)
* [Sweep](/docs/api/classes/sweep.md)
* [VelocityConstraintPoint](/docs/api/classes/velocityconstraintpoint.md)

View File

@ -1,69 +0,0 @@
[Planck.js API Doc](README.md) › [Globals](globals.md)
# Planck.js API Doc
### API Index
* [World](/docs/api/classes/world.md)
* [Body](/docs/api/classes/body.md)
* [Fixture](/docs/api/classes/fixture.md)
* [Settings](/docs/api/classes/settings.md)
#### Math
* [Math](/docs/api/classes/math.md)
* [Vec2](/docs/api/classes/vec2.md)
* [Vec3](/docs/api/classes/vec3.md)
* [Transform](/docs/api/classes/transform.md)
* [Rot](/docs/api/classes/rot.md)
* [Mat22](/docs/api/classes/mat22.md)
* [Mat33](/docs/api/classes/mat33.md)
#### Shapes
* [BoxShape](/docs/api/classes/boxshape.md)
* [ChainShape](/docs/api/classes/chainshape.md)
* [CircleShape](/docs/api/classes/circleshape.md)
* [EdgeShape](/docs/api/classes/edgeshape.md)
* [PolygonShape](/docs/api/classes/polygonshape.md)
#### Joints
* [FrictionJoint](/docs/api/classes/frictionjoint.md)
* [DistanceJoint](/docs/api/classes/distancejoint.md)
* [GearJoint](/docs/api/classes/gearjoint.md)
* [MotorJoint](/docs/api/classes/motorjoint.md)
* [MouseJoint](/docs/api/classes/mousejoint.md)
* [PrismaticJoint](/docs/api/classes/prismaticjoint.md)
* [PulleyJoint](/docs/api/classes/pulleyjoint.md)
* [RevoluteJoint](/docs/api/classes/revolutejoint.md)
* [RopeJoint](/docs/api/classes/ropejoint.md)
* [WeldJoint](/docs/api/classes/weldjoint.md)
* [WheelJoint](/docs/api/classes/wheeljoint.md)
#### Collision Internal
* [BroadPhase](/docs/api/classes/broadphase.md)
* [AABB](/docs/api/classes/aabb.md)
* [DynamicTree](/docs/api/classes/dynamictree.md)
* [TreeNode](/docs/api/classes/treenode.md)
* [DistanceProxy](/docs/api/classes/distanceproxy.md)
* [ContactFeatureType](/docs/api/enums/contactfeaturetype.md)
* [ManifoldType](/docs/api/enums/manifoldtype.md)
* [TOIOutputState](/docs/api/enums/toioutputstate.md)
* [FixtureProxy](/docs/api/interfaces/fixtureproxy.md)
* [Manifold](/docs/api/interfaces/manifold.md)
* [ManifoldPoint](/docs/api/interfaces/manifoldpoint.md)
* [WorldManifold](/docs/api/interfaces/worldmanifold.md)
#### Dynamics Internal
* [Solver](/docs/api/classes/solver.md)
* [Contact](/docs/api/classes/contact.md)
* [ContactImpulse](/docs/api/classes/contactimpulse.md)
* [ContactEdge](/docs/api/classes/contactedge.md)
* [ContactFeature](/docs/api/interfaces/contactfeature.md)
* [ContactID](/docs/api/interfaces/contactid.md)
* [Position](/docs/api/classes/position.md)
* [Velocity](/docs/api/classes/velocity.md)
* [Sweep](/docs/api/classes/sweep.md)
* [VelocityConstraintPoint](/docs/api/classes/velocityconstraintpoint.md)

View File

@ -1,330 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [AABB](aabb.md)
# Class: AABB
## Hierarchy
* **AABB**
## Index
### Constructors
* [constructor](aabb.md#constructor)
### Properties
* [lowerBound](aabb.md#lowerbound)
* [upperBound](aabb.md#upperbound)
### Methods
* [combine](aabb.md#combine)
* [combinePoints](aabb.md#combinepoints)
* [contains](aabb.md#contains)
* [extend](aabb.md#extend)
* [getCenter](aabb.md#getcenter)
* [getExtents](aabb.md#getextents)
* [getPerimeter](aabb.md#getperimeter)
* [isValid](aabb.md#isvalid)
* [rayCast](aabb.md#raycast)
* [set](aabb.md#set)
* [toString](aabb.md#tostring)
* [areEqual](aabb.md#static-areequal)
* [assert](aabb.md#static-assert)
* [diff](aabb.md#static-diff)
* [extend](aabb.md#static-extend)
* [isValid](aabb.md#static-isvalid)
* [testOverlap](aabb.md#static-testoverlap)
## Constructors
### constructor
\+ **new AABB**(`lower?`: [Vec2](vec2.md), `upper?`: [Vec2](vec2.md)): *[AABB](aabb.md)*
*Defined in [src/collision/AABB.ts:56](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L56)*
**Parameters:**
Name | Type |
------ | ------ |
`lower?` | [Vec2](vec2.md) |
`upper?` | [Vec2](vec2.md) |
**Returns:** *[AABB](aabb.md)*
## Properties
### lowerBound
• **lowerBound**: *[Vec2](vec2.md)*
*Defined in [src/collision/AABB.ts:55](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L55)*
___
### upperBound
• **upperBound**: *[Vec2](vec2.md)*
*Defined in [src/collision/AABB.ts:56](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L56)*
## Methods
### combine
▸ **combine**(`a`: [AABB](aabb.md), `b?`: [AABB](aabb.md)): *void*
*Defined in [src/collision/AABB.ts:121](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L121)*
Combine one or two AABB into this one.
**Parameters:**
Name | Type |
------ | ------ |
`a` | [AABB](aabb.md) |
`b?` | [AABB](aabb.md) |
**Returns:** *void*
___
### combinePoints
▸ **combinePoints**(`a`: [Vec2](vec2.md), `b`: [Vec2](vec2.md)): *void*
*Defined in [src/collision/AABB.ts:138](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L138)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *void*
___
### contains
▸ **contains**(`aabb`: [AABB](aabb.md)): *boolean*
*Defined in [src/collision/AABB.ts:148](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L148)*
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
**Returns:** *boolean*
___
### extend
▸ **extend**(`value`: number): *[AABB](aabb.md)*
*Defined in [src/collision/AABB.ts:157](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L157)*
**Parameters:**
Name | Type |
------ | ------ |
`value` | number |
**Returns:** *[AABB](aabb.md)*
___
### getCenter
▸ **getCenter**(): *[Vec2](vec2.md)*
*Defined in [src/collision/AABB.ts:100](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L100)*
Get the center of the AABB.
**Returns:** *[Vec2](vec2.md)*
___
### getExtents
▸ **getExtents**(): *[Vec2](vec2.md)*
*Defined in [src/collision/AABB.ts:107](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L107)*
Get the extents of the AABB (half-widths).
**Returns:** *[Vec2](vec2.md)*
___
### getPerimeter
▸ **getPerimeter**(): *number*
*Defined in [src/collision/AABB.ts:114](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L114)*
Get the perimeter length.
**Returns:** *number*
___
### isValid
▸ **isValid**(): *boolean*
*Defined in [src/collision/AABB.ts:79](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L79)*
Verify that the bounds are sorted.
**Returns:** *boolean*
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md)): *boolean*
*Defined in [src/collision/AABB.ts:199](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L199)*
**Parameters:**
Name | Type |
------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) |
`input` | [RayCastInput](../interfaces/raycastinput.md) |
**Returns:** *boolean*
___
### set
▸ **set**(`aabb`: [AABB](aabb.md)): *void*
*Defined in [src/collision/AABB.ts:143](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L143)*
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
**Returns:** *void*
___
### toString
▸ **toString**(): *string*
*Defined in [src/collision/AABB.ts:260](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L260)*
**Returns:** *string*
___
### `Static` areEqual
▸ **areEqual**(`a`: [AABB](aabb.md), `b`: [AABB](aabb.md)): *boolean*
*Defined in [src/collision/AABB.ts:182](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L182)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [AABB](aabb.md) |
`b` | [AABB](aabb.md) |
**Returns:** *boolean*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [src/collision/AABB.ts:89](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L89)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` diff
▸ **diff**(`a`: [AABB](aabb.md), `b`: [AABB](aabb.md)): *number*
*Defined in [src/collision/AABB.ts:186](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L186)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [AABB](aabb.md) |
`b` | [AABB](aabb.md) |
**Returns:** *number*
___
### `Static` extend
▸ **extend**(`aabb`: [AABB](aabb.md), `value`: number): *void*
*Defined in [src/collision/AABB.ts:162](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L162)*
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
`value` | number |
**Returns:** *void*
___
### `Static` isValid
▸ **isValid**(`aabb`: any): *boolean*
*Defined in [src/collision/AABB.ts:83](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L83)*
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | any |
**Returns:** *boolean*
___
### `Static` testOverlap
▸ **testOverlap**(`a`: [AABB](aabb.md), `b`: [AABB](aabb.md)): *boolean*
*Defined in [src/collision/AABB.ts:169](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/AABB.ts#L169)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [AABB](aabb.md) |
`b` | [AABB](aabb.md) |
**Returns:** *boolean*

File diff suppressed because it is too large Load Diff

View File

@ -1,347 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [BoxShape](boxshape.md)
# Class: BoxShape
A rectangle polygon which extend PolygonShape.
## Hierarchy
↳ [PolygonShape](polygonshape.md)
↳ **BoxShape**
## Index
### Constructors
* [constructor](boxshape.md#constructor)
### Properties
* [m_centroid](boxshape.md#m_centroid)
* [m_count](boxshape.md#m_count)
* [m_normals](boxshape.md#m_normals)
* [m_radius](boxshape.md#m_radius)
* [m_type](boxshape.md#m_type)
* [m_vertices](boxshape.md#m_vertices)
* [TYPE](boxshape.md#static-type)
### Methods
* [computeAABB](boxshape.md#computeaabb)
* [computeDistanceProxy](boxshape.md#computedistanceproxy)
* [computeMass](boxshape.md#computemass)
* [getChildCount](boxshape.md#getchildcount)
* [getRadius](boxshape.md#getradius)
* [getType](boxshape.md#gettype)
* [getVertex](boxshape.md#getvertex)
* [rayCast](boxshape.md#raycast)
* [testPoint](boxshape.md#testpoint)
* [validate](boxshape.md#validate)
* [isValid](boxshape.md#static-isvalid)
## Constructors
### constructor
\+ **new BoxShape**(`hx`: number, `hy`: number, `center?`: [Vec2](vec2.md), `angle?`: number): *[BoxShape](boxshape.md)*
*Overrides [PolygonShape](polygonshape.md).[constructor](polygonshape.md#constructor)*
*Defined in [src/collision/shape/BoxShape.ts:32](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/BoxShape.ts#L32)*
**Parameters:**
Name | Type |
------ | ------ |
`hx` | number |
`hy` | number |
`center?` | [Vec2](vec2.md) |
`angle?` | number |
**Returns:** *[BoxShape](boxshape.md)*
## Properties
### m_centroid
• **m_centroid**: *[Vec2](vec2.md)*
*Inherited from [PolygonShape](polygonshape.md).[m_centroid](polygonshape.md#m_centroid)*
*Defined in [src/collision/shape/PolygonShape.ts:49](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L49)*
___
### m_count
• **m_count**: *number*
*Inherited from [PolygonShape](polygonshape.md).[m_count](polygonshape.md#m_count)*
*Defined in [src/collision/shape/PolygonShape.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L52)*
___
### m_normals
• **m_normals**: *[Vec2](vec2.md)[]*
*Inherited from [PolygonShape](polygonshape.md).[m_normals](polygonshape.md#m_normals)*
*Defined in [src/collision/shape/PolygonShape.ts:51](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L51)*
___
### m_radius
• **m_radius**: *number*
*Inherited from [Shape](shape.md).[m_radius](shape.md#m_radius)*
*Defined in [src/collision/Shape.ts:39](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L39)*
___
### m_type
• **m_type**: *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[m_type](shape.md#m_type)*
*Defined in [src/collision/Shape.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L38)*
___
### m_vertices
• **m_vertices**: *[Vec2](vec2.md)[]*
*Inherited from [PolygonShape](polygonshape.md).[m_vertices](polygonshape.md#m_vertices)*
*Defined in [src/collision/shape/PolygonShape.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L50)*
___
### `Static` TYPE
▪ **TYPE**: *"polygon"* = 'polygon' as 'polygon'
*Overrides [PolygonShape](polygonshape.md).[TYPE](polygonshape.md#static-type)*
*Defined in [src/collision/shape/BoxShape.ts:32](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/BoxShape.ts#L32)*
## Methods
### computeAABB
▸ **computeAABB**(`aabb`: [AABB](aabb.md), `xf`: [Transform](transform.md), `childIndex`: number): *void*
*Inherited from [PolygonShape](polygonshape.md).[computeAABB](polygonshape.md#computeaabb)*
*Overrides [Shape](shape.md).[computeAABB](shape.md#abstract-computeaabb)*
*Defined in [src/collision/shape/PolygonShape.ts:388](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L388)*
Given a transform, compute the associated axis aligned bounding box for a
child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`aabb` | [AABB](aabb.md) | Returns the axis aligned box. |
`xf` | [Transform](transform.md) | The world transform of the shape. |
`childIndex` | number | The child shape |
**Returns:** *void*
___
### computeDistanceProxy
▸ **computeDistanceProxy**(`proxy`: [DistanceProxy](distanceproxy.md)): *void*
*Inherited from [PolygonShape](polygonshape.md).[computeDistanceProxy](polygonshape.md#computedistanceproxy)*
*Overrides [Shape](shape.md).[computeDistanceProxy](shape.md#abstract-computedistanceproxy)*
*Defined in [src/collision/shape/PolygonShape.ts:522](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L522)*
**Parameters:**
Name | Type |
------ | ------ |
`proxy` | [DistanceProxy](distanceproxy.md) |
**Returns:** *void*
___
### computeMass
▸ **computeMass**(`massData`: [MassData](massdata.md), `density`: number): *void*
*Inherited from [PolygonShape](polygonshape.md).[computeMass](polygonshape.md#computemass)*
*Overrides [Shape](shape.md).[computeMass](shape.md#abstract-computemass)*
*Defined in [src/collision/shape/PolygonShape.ts:413](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L413)*
Compute the mass properties of this shape using its dimensions and density.
The inertia tensor is computed about the local origin.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`massData` | [MassData](massdata.md) | Returns the mass data for this shape. |
`density` | number | The density in kilograms per meter squared. |
**Returns:** *void*
___
### getChildCount
▸ **getChildCount**(): *1*
*Inherited from [PolygonShape](polygonshape.md).[getChildCount](polygonshape.md#getchildcount)*
*Overrides [Shape](shape.md).[getChildCount](shape.md#abstract-getchildcount)*
*Defined in [src/collision/shape/PolygonShape.ts:127](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L127)*
Get the number of child primitives.
**Returns:** *1*
___
### getRadius
▸ **getRadius**(): *number*
*Inherited from [Shape](shape.md).[getRadius](shape.md#getradius)*
*Defined in [src/collision/Shape.ts:62](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L62)*
**Returns:** *number*
___
### getType
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[getType](shape.md#gettype)*
*Defined in [src/collision/Shape.ts:72](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L72)*
Get the type of this shape. You can use this to down cast to the concrete
shape.
**Returns:** *[ShapeType](../globals.md#shapetype)*
the shape type.
___
### getVertex
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
*Inherited from [PolygonShape](polygonshape.md).[getVertex](polygonshape.md#getvertex)*
*Defined in [src/collision/shape/PolygonShape.ts:98](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L98)*
**Parameters:**
Name | Type |
------ | ------ |
`index` | number |
**Returns:** *[Vec2](vec2.md)*
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `xf`: [Transform](transform.md), `childIndex`: number): *boolean*
*Inherited from [PolygonShape](polygonshape.md).[rayCast](polygonshape.md#raycast)*
*Overrides [Shape](shape.md).[rayCast](shape.md#abstract-raycast)*
*Defined in [src/collision/shape/PolygonShape.ts:320](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L320)*
Cast a ray against a child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) | The ray-cast results. |
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input parameters. |
`xf` | [Transform](transform.md) | The transform to be applied to the shape. |
`childIndex` | number | The child shape index |
**Returns:** *boolean*
___
### testPoint
▸ **testPoint**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *boolean*
*Inherited from [PolygonShape](polygonshape.md).[testPoint](polygonshape.md#testpoint)*
*Overrides [Shape](shape.md).[testPoint](shape.md#abstract-testpoint)*
*Defined in [src/collision/shape/PolygonShape.ts:299](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L299)*
Test a point for containment in this shape. This only works for convex
shapes.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`xf` | [Transform](transform.md) | The shape world transform. |
`p` | [Vec2](vec2.md) | A point in world coordinates. |
**Returns:** *boolean*
___
### validate
▸ **validate**(): *boolean*
*Inherited from [PolygonShape](polygonshape.md).[validate](polygonshape.md#validate)*
*Defined in [src/collision/shape/PolygonShape.ts:499](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L499)*
Validate convexity. This is a very time consuming operation.
**Returns:** *boolean*
true if valid
___
### `Static` isValid
▸ **isValid**(`shape`: [Shape](shape.md) | null | undefined): *shape is Shape*
*Inherited from [Shape](shape.md).[isValid](shape.md#static-isvalid)*
*Defined in [src/collision/Shape.ts:58](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L58)*
**Parameters:**
Name | Type |
------ | ------ |
`shape` | [Shape](shape.md) &#124; null &#124; undefined |
**Returns:** *shape is Shape*

View File

@ -1,408 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [BroadPhase](broadphase.md)
# Class: BroadPhase
The broad-phase wraps and extends a dynamic-tree to keep track of moved
objects and query them on update.
## Hierarchy
* **BroadPhase**
## Index
### Properties
* [m_callback](broadphase.md#m_callback)
* [m_moveBuffer](broadphase.md#m_movebuffer)
* [m_proxyCount](broadphase.md#m_proxycount)
* [m_queryProxyId](broadphase.md#m_queryproxyid)
* [m_tree](broadphase.md#m_tree)
### Methods
* [bufferMove](broadphase.md#buffermove)
* [createProxy](broadphase.md#createproxy)
* [destroyProxy](broadphase.md#destroyproxy)
* [getFatAABB](broadphase.md#getfataabb)
* [getProxyCount](broadphase.md#getproxycount)
* [getTreeBalance](broadphase.md#gettreebalance)
* [getTreeHeight](broadphase.md#gettreeheight)
* [getTreeQuality](broadphase.md#gettreequality)
* [getUserData](broadphase.md#getuserdata)
* [moveProxy](broadphase.md#moveproxy)
* [query](broadphase.md#query)
* [queryCallback](broadphase.md#querycallback)
* [rayCast](broadphase.md#raycast)
* [shiftOrigin](broadphase.md#shiftorigin)
* [testOverlap](broadphase.md#testoverlap)
* [touchProxy](broadphase.md#touchproxy)
* [unbufferMove](broadphase.md#unbuffermove)
* [updatePairs](broadphase.md#updatepairs)
## Properties
### m_callback
• **m_callback**: *function*
*Defined in [src/collision/BroadPhase.ts:45](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L45)*
#### Type declaration:
▸ (`userDataA`: any, `userDataB`: any): *void*
**Parameters:**
Name | Type |
------ | ------ |
`userDataA` | any |
`userDataB` | any |
___
### m_moveBuffer
• **m_moveBuffer**: *any[]* = []
*Defined in [src/collision/BroadPhase.ts:43](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L43)*
___
### m_proxyCount
• **m_proxyCount**: *number* = 0
*Defined in [src/collision/BroadPhase.ts:42](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L42)*
___
### m_queryProxyId
• **m_queryProxyId**: *number*
*Defined in [src/collision/BroadPhase.ts:46](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L46)*
___
### m_tree
• **m_tree**: *[DynamicTree](dynamictree.md)‹[FixtureProxy](fixtureproxy.md)‹››* = new DynamicTree<FixtureProxy>()
*Defined in [src/collision/BroadPhase.ts:41](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L41)*
## Methods
### bufferMove
▸ **bufferMove**(`proxyId`: number): *void*
*Defined in [src/collision/BroadPhase.ts:172](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L172)*
**Parameters:**
Name | Type |
------ | ------ |
`proxyId` | number |
**Returns:** *void*
___
### createProxy
▸ **createProxy**(`aabb`: [AABB](aabb.md), `userData`: [FixtureProxy](fixtureproxy.md)): *number*
*Defined in [src/collision/BroadPhase.ts:135](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L135)*
Create a proxy with an initial AABB. Pairs are not reported until UpdatePairs
is called.
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
`userData` | [FixtureProxy](fixtureproxy.md) |
**Returns:** *number*
___
### destroyProxy
▸ **destroyProxy**(`proxyId`: number): *void*
*Defined in [src/collision/BroadPhase.ts:146](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L146)*
Destroy a proxy. It is up to the client to remove any pairs.
**Parameters:**
Name | Type |
------ | ------ |
`proxyId` | number |
**Returns:** *void*
___
### getFatAABB
▸ **getFatAABB**(`proxyId`: number): *[AABB](aabb.md)*
*Defined in [src/collision/BroadPhase.ts:67](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L67)*
Get the fat AABB for a proxy.
**Parameters:**
Name | Type |
------ | ------ |
`proxyId` | number |
**Returns:** *[AABB](aabb.md)*
___
### getProxyCount
▸ **getProxyCount**(): *number*
*Defined in [src/collision/BroadPhase.ts:74](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L74)*
Get the number of proxies.
**Returns:** *number*
___
### getTreeBalance
▸ **getTreeBalance**(): *number*
*Defined in [src/collision/BroadPhase.ts:88](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L88)*
Get the balance (integer) of the embedded tree.
**Returns:** *number*
___
### getTreeHeight
▸ **getTreeHeight**(): *number*
*Defined in [src/collision/BroadPhase.ts:81](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L81)*
Get the height of the embedded tree.
**Returns:** *number*
___
### getTreeQuality
▸ **getTreeQuality**(): *number*
*Defined in [src/collision/BroadPhase.ts:95](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L95)*
Get the quality metric of the embedded tree.
**Returns:** *number*
___
### getUserData
▸ **getUserData**(`proxyId`: number): *[FixtureProxy](fixtureproxy.md)*
*Defined in [src/collision/BroadPhase.ts:51](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L51)*
Get user data from a proxy. Returns null if the id is invalid.
**Parameters:**
Name | Type |
------ | ------ |
`proxyId` | number |
**Returns:** *[FixtureProxy](fixtureproxy.md)*
___
### moveProxy
▸ **moveProxy**(`proxyId`: number, `aabb`: [AABB](aabb.md), `displacement`: [Vec2](vec2.md)): *void*
*Defined in [src/collision/BroadPhase.ts:156](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L156)*
Call moveProxy as many times as you like, then when you are done call
UpdatePairs to finalized the proxy pairs (for your time step).
**Parameters:**
Name | Type |
------ | ------ |
`proxyId` | number |
`aabb` | [AABB](aabb.md) |
`displacement` | [Vec2](vec2.md) |
**Returns:** *void*
___
### query
▸ **query**(`aabb`: any, `queryCallback`: any): *void*
*Defined in [src/collision/BroadPhase.ts:103](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L103)*
Query an AABB for overlapping proxies. The callback class is called for each
proxy that overlaps the supplied AABB.
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | any |
`queryCallback` | any |
**Returns:** *void*
___
### queryCallback
▸ **queryCallback**(`proxyId`: number): *boolean*
*Defined in [src/collision/BroadPhase.ts:210](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L210)*
**Parameters:**
Name | Type |
------ | ------ |
`proxyId` | number |
**Returns:** *boolean*
___
### rayCast
▸ **rayCast**(`input`: [RayCastInput](../interfaces/raycastinput.md), `rayCastCallback`: [RayCastCallback](../globals.md#raycastcallback)): *void*
*Defined in [src/collision/BroadPhase.ts:117](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L117)*
Ray-cast against the proxies in the tree. This relies on the callback to
perform a exact ray-cast in the case were the proxy contains a shape. The
callback also performs the any collision filtering. This has performance
roughly equal to k * log(n), where k is the number of collisions and n is the
number of proxies in the tree.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input data. The ray extends from `p1` to `p1 + maxFraction * (p2 - p1)`. |
`rayCastCallback` | [RayCastCallback](../globals.md#raycastcallback) | A function that is called for each proxy that is hit by the ray. |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Defined in [src/collision/BroadPhase.ts:127](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L127)*
Shift the world origin. Useful for large worlds. The shift formula is:
position -= newOrigin
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`newOrigin` | [Vec2](vec2.md) | The new origin with respect to the old origin |
**Returns:** *void*
___
### testOverlap
▸ **testOverlap**(`proxyIdA`: number, `proxyIdB`: number): *boolean*
*Defined in [src/collision/BroadPhase.ts:58](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L58)*
Test overlap of fat AABBs.
**Parameters:**
Name | Type |
------ | ------ |
`proxyIdA` | number |
`proxyIdB` | number |
**Returns:** *boolean*
___
### touchProxy
▸ **touchProxy**(`proxyId`: number): *void*
*Defined in [src/collision/BroadPhase.ts:168](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L168)*
Call to trigger a re-processing of it's pairs on the next call to
UpdatePairs.
**Parameters:**
Name | Type |
------ | ------ |
`proxyId` | number |
**Returns:** *void*
___
### unbufferMove
▸ **unbufferMove**(`proxyId`: number): *void*
*Defined in [src/collision/BroadPhase.ts:176](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L176)*
**Parameters:**
Name | Type |
------ | ------ |
`proxyId` | number |
**Returns:** *void*
___
### updatePairs
▸ **updatePairs**(`addPairCallback`: function): *void*
*Defined in [src/collision/BroadPhase.ts:187](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/BroadPhase.ts#L187)*
Update the pairs. This results in pair callbacks. This can only add pairs.
**Parameters:**
▪ **addPairCallback**: *function*
▸ (`userDataA`: [FixtureProxy](fixtureproxy.md), `userDataB`: [FixtureProxy](fixtureproxy.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`userDataA` | [FixtureProxy](fixtureproxy.md) |
`userDataB` | [FixtureProxy](fixtureproxy.md) |
**Returns:** *void*

View File

@ -1,430 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ChainShape](chainshape.md)
# Class: ChainShape
A chain shape is a free form sequence of line segments. The chain has
two-sided collision, so you can use inside and outside collision. Therefore,
you may use any winding order. Connectivity information is used to create
smooth collisions.
WARNING: The chain will not collide properly if there are self-intersections.
## Hierarchy
* [Shape](shape.md)
↳ **ChainShape**
## Index
### Constructors
* [constructor](chainshape.md#constructor)
### Properties
* [m_count](chainshape.md#m_count)
* [m_hasNextVertex](chainshape.md#m_hasnextvertex)
* [m_hasPrevVertex](chainshape.md#m_hasprevvertex)
* [m_isLoop](chainshape.md#m_isloop)
* [m_nextVertex](chainshape.md#m_nextvertex)
* [m_prevVertex](chainshape.md#m_prevvertex)
* [m_radius](chainshape.md#m_radius)
* [m_type](chainshape.md#m_type)
* [m_vertices](chainshape.md#m_vertices)
* [TYPE](chainshape.md#static-type)
### Methods
* [computeAABB](chainshape.md#computeaabb)
* [computeDistanceProxy](chainshape.md#computedistanceproxy)
* [computeMass](chainshape.md#computemass)
* [getChildCount](chainshape.md#getchildcount)
* [getChildEdge](chainshape.md#getchildedge)
* [getNextVertex](chainshape.md#getnextvertex)
* [getPrevVertex](chainshape.md#getprevvertex)
* [getRadius](chainshape.md#getradius)
* [getType](chainshape.md#gettype)
* [getVertex](chainshape.md#getvertex)
* [isLoop](chainshape.md#isloop)
* [rayCast](chainshape.md#raycast)
* [setNextVertex](chainshape.md#setnextvertex)
* [setPrevVertex](chainshape.md#setprevvertex)
* [testPoint](chainshape.md#testpoint)
* [isValid](chainshape.md#static-isvalid)
## Constructors
### constructor
\+ **new ChainShape**(`vertices?`: [Vec2](vec2.md)[], `loop?`: boolean): *[ChainShape](chainshape.md)*
*Defined in [src/collision/shape/ChainShape.ts:57](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L57)*
**Parameters:**
Name | Type |
------ | ------ |
`vertices?` | [Vec2](vec2.md)[] |
`loop?` | boolean |
**Returns:** *[ChainShape](chainshape.md)*
## Properties
### m_count
• **m_count**: *number*
*Defined in [src/collision/shape/ChainShape.ts:51](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L51)*
___
### m_hasNextVertex
• **m_hasNextVertex**: *boolean*
*Defined in [src/collision/shape/ChainShape.ts:55](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L55)*
___
### m_hasPrevVertex
• **m_hasPrevVertex**: *boolean*
*Defined in [src/collision/shape/ChainShape.ts:54](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L54)*
___
### m_isLoop
• **m_isLoop**: *boolean*
*Defined in [src/collision/shape/ChainShape.ts:57](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L57)*
___
### m_nextVertex
• **m_nextVertex**: *[Vec2](vec2.md) | null*
*Defined in [src/collision/shape/ChainShape.ts:53](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L53)*
___
### m_prevVertex
• **m_prevVertex**: *[Vec2](vec2.md) | null*
*Defined in [src/collision/shape/ChainShape.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L52)*
___
### m_radius
• **m_radius**: *number*
*Inherited from [Shape](shape.md).[m_radius](shape.md#m_radius)*
*Defined in [src/collision/Shape.ts:39](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L39)*
___
### m_type
• **m_type**: *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[m_type](shape.md#m_type)*
*Defined in [src/collision/Shape.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L38)*
___
### m_vertices
• **m_vertices**: *[Vec2](vec2.md)[]*
*Defined in [src/collision/shape/ChainShape.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L50)*
___
### `Static` TYPE
▪ **TYPE**: *"chain"* = 'chain' as 'chain'
*Defined in [src/collision/shape/ChainShape.ts:48](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L48)*
## Methods
### computeAABB
▸ **computeAABB**(`aabb`: [AABB](aabb.md), `xf`: [Transform](transform.md), `childIndex`: number): *void*
*Overrides [Shape](shape.md).[computeAABB](shape.md#abstract-computeaabb)*
*Defined in [src/collision/shape/ChainShape.ts:327](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L327)*
Given a transform, compute the associated axis aligned bounding box for a
child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`aabb` | [AABB](aabb.md) | Returns the axis aligned box. |
`xf` | [Transform](transform.md) | The world transform of the shape. |
`childIndex` | number | The child shape |
**Returns:** *void*
___
### computeDistanceProxy
▸ **computeDistanceProxy**(`proxy`: [DistanceProxy](distanceproxy.md), `childIndex`: number): *void*
*Overrides [Shape](shape.md).[computeDistanceProxy](shape.md#abstract-computedistanceproxy)*
*Defined in [src/collision/shape/ChainShape.ts:351](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L351)*
**Parameters:**
Name | Type |
------ | ------ |
`proxy` | [DistanceProxy](distanceproxy.md) |
`childIndex` | number |
**Returns:** *void*
___
### computeMass
▸ **computeMass**(`massData`: [MassData](massdata.md), `density?`: number): *void*
*Overrides [Shape](shape.md).[computeMass](shape.md#abstract-computemass)*
*Defined in [src/collision/shape/ChainShape.ts:345](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L345)*
Compute the mass properties of this shape using its dimensions and density.
The inertia tensor is computed about the local origin.
Chains have zero mass.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`massData` | [MassData](massdata.md) | Returns the mass data for this shape. |
`density?` | number | The density in kilograms per meter squared. |
**Returns:** *void*
___
### getChildCount
▸ **getChildCount**(): *number*
*Overrides [Shape](shape.md).[getChildCount](shape.md#abstract-getchildcount)*
*Defined in [src/collision/shape/ChainShape.ts:247](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L247)*
Get the number of child primitives.
**Returns:** *number*
___
### getChildEdge
▸ **getChildEdge**(`edge`: [EdgeShape](edgeshape.md), `childIndex`: number): *void*
*Defined in [src/collision/shape/ChainShape.ts:253](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L253)*
**Parameters:**
Name | Type |
------ | ------ |
`edge` | [EdgeShape](edgeshape.md) |
`childIndex` | number |
**Returns:** *void*
___
### getNextVertex
▸ **getNextVertex**(): *[Vec2](vec2.md)*
*Defined in [src/collision/shape/ChainShape.ts:222](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L222)*
**Returns:** *[Vec2](vec2.md)*
___
### getPrevVertex
▸ **getPrevVertex**(): *[Vec2](vec2.md)*
*Defined in [src/collision/shape/ChainShape.ts:209](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L209)*
**Returns:** *[Vec2](vec2.md)*
___
### getRadius
▸ **getRadius**(): *number*
*Inherited from [Shape](shape.md).[getRadius](shape.md#getradius)*
*Defined in [src/collision/Shape.ts:62](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L62)*
**Returns:** *number*
___
### getType
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[getType](shape.md#gettype)*
*Defined in [src/collision/Shape.ts:72](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L72)*
Get the type of this shape. You can use this to down cast to the concrete
shape.
**Returns:** *[ShapeType](../globals.md#shapetype)*
the shape type.
___
### getVertex
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
*Defined in [src/collision/shape/ChainShape.ts:278](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L278)*
**Parameters:**
Name | Type |
------ | ------ |
`index` | number |
**Returns:** *[Vec2](vec2.md)*
___
### isLoop
▸ **isLoop**(): *boolean*
*Defined in [src/collision/shape/ChainShape.ts:287](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L287)*
**Returns:** *boolean*
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `xf`: [Transform](transform.md), `childIndex`: number): *boolean*
*Overrides [Shape](shape.md).[rayCast](shape.md#abstract-raycast)*
*Defined in [src/collision/shape/ChainShape.ts:312](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L312)*
Cast a ray against a child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) | The ray-cast results. |
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input parameters. |
`xf` | [Transform](transform.md) | The transform to be applied to the shape. |
`childIndex` | number | The child shape index |
**Returns:** *boolean*
___
### setNextVertex
▸ **setNextVertex**(`nextVertex`: [Vec2](vec2.md)): *void*
*Defined in [src/collision/shape/ChainShape.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L217)*
Establish connectivity to a vertex that follows the last vertex. Don't call
this for loops.
**Parameters:**
Name | Type |
------ | ------ |
`nextVertex` | [Vec2](vec2.md) |
**Returns:** *void*
___
### setPrevVertex
▸ **setPrevVertex**(`prevVertex`: [Vec2](vec2.md)): *void*
*Defined in [src/collision/shape/ChainShape.ts:204](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L204)*
Establish connectivity to a vertex that precedes the first vertex. Don't call
this for loops.
**Parameters:**
Name | Type |
------ | ------ |
`prevVertex` | [Vec2](vec2.md) |
**Returns:** *void*
___
### testPoint
▸ **testPoint**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *false*
*Overrides [Shape](shape.md).[testPoint](shape.md#abstract-testpoint)*
*Defined in [src/collision/shape/ChainShape.ts:300](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L300)*
Test a point for containment in this shape. This only works for convex
shapes.
This always return false.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`xf` | [Transform](transform.md) | The shape world transform. |
`p` | [Vec2](vec2.md) | A point in world coordinates. |
**Returns:** *false*
___
### `Static` isValid
▸ **isValid**(`shape`: [Shape](shape.md) | null | undefined): *shape is Shape*
*Inherited from [Shape](shape.md).[isValid](shape.md#static-isvalid)*
*Defined in [src/collision/Shape.ts:58](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L58)*
**Parameters:**
Name | Type |
------ | ------ |
`shape` | [Shape](shape.md) &#124; null &#124; undefined |
**Returns:** *shape is Shape*

View File

@ -1,296 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [CircleShape](circleshape.md)
# Class: CircleShape
## Hierarchy
* [Shape](shape.md)
↳ **CircleShape**
## Index
### Constructors
* [constructor](circleshape.md#constructor)
### Properties
* [m_p](circleshape.md#m_p)
* [m_radius](circleshape.md#m_radius)
* [m_type](circleshape.md#m_type)
* [TYPE](circleshape.md#static-type)
### Methods
* [computeAABB](circleshape.md#computeaabb)
* [computeDistanceProxy](circleshape.md#computedistanceproxy)
* [computeMass](circleshape.md#computemass)
* [getCenter](circleshape.md#getcenter)
* [getChildCount](circleshape.md#getchildcount)
* [getRadius](circleshape.md#getradius)
* [getType](circleshape.md#gettype)
* [getVertex](circleshape.md#getvertex)
* [rayCast](circleshape.md#raycast)
* [testPoint](circleshape.md#testpoint)
* [isValid](circleshape.md#static-isvalid)
## Constructors
### constructor
\+ **new CircleShape**(`position`: [Vec2](vec2.md), `radius?`: number): *[CircleShape](circleshape.md)*
*Defined in [src/collision/shape/CircleShape.ts:42](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L42)*
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`radius?` | number |
**Returns:** *[CircleShape](circleshape.md)*
\+ **new CircleShape**(`radius?`: number): *[CircleShape](circleshape.md)*
*Defined in [src/collision/shape/CircleShape.ts:44](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L44)*
**Parameters:**
Name | Type |
------ | ------ |
`radius?` | number |
**Returns:** *[CircleShape](circleshape.md)*
## Properties
### m_p
• **m_p**: *[Vec2](vec2.md)*
*Defined in [src/collision/shape/CircleShape.ts:42](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L42)*
___
### m_radius
• **m_radius**: *number*
*Inherited from [Shape](shape.md).[m_radius](shape.md#m_radius)*
*Defined in [src/collision/Shape.ts:39](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L39)*
___
### m_type
• **m_type**: *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[m_type](shape.md#m_type)*
*Defined in [src/collision/Shape.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L38)*
___
### `Static` TYPE
▪ **TYPE**: *"circle"* = 'circle' as 'circle'
*Defined in [src/collision/shape/CircleShape.ts:40](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L40)*
## Methods
### computeAABB
▸ **computeAABB**(`aabb`: [AABB](aabb.md), `xf`: [Transform](transform.md), `childIndex`: number): *void*
*Overrides [Shape](shape.md).[computeAABB](shape.md#abstract-computeaabb)*
*Defined in [src/collision/shape/CircleShape.ts:187](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L187)*
Given a transform, compute the associated axis aligned bounding box for a
child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`aabb` | [AABB](aabb.md) | Returns the axis aligned box. |
`xf` | [Transform](transform.md) | The world transform of the shape. |
`childIndex` | number | The child shape |
**Returns:** *void*
___
### computeDistanceProxy
▸ **computeDistanceProxy**(`proxy`: [DistanceProxy](distanceproxy.md)): *void*
*Overrides [Shape](shape.md).[computeDistanceProxy](shape.md#abstract-computedistanceproxy)*
*Defined in [src/collision/shape/CircleShape.ts:208](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L208)*
**Parameters:**
Name | Type |
------ | ------ |
`proxy` | [DistanceProxy](distanceproxy.md) |
**Returns:** *void*
___
### computeMass
▸ **computeMass**(`massData`: [MassData](massdata.md), `density`: number): *void*
*Overrides [Shape](shape.md).[computeMass](shape.md#abstract-computemass)*
*Defined in [src/collision/shape/CircleShape.ts:200](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L200)*
Compute the mass properties of this shape using its dimensions and density.
The inertia tensor is computed about the local origin.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`massData` | [MassData](massdata.md) | Returns the mass data for this shape. |
`density` | number | The density in kilograms per meter squared. |
**Returns:** *void*
___
### getCenter
▸ **getCenter**(): *[Vec2](vec2.md)*
*Defined in [src/collision/shape/CircleShape.ts:92](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L92)*
**Returns:** *[Vec2](vec2.md)*
___
### getChildCount
▸ **getChildCount**(): *1*
*Overrides [Shape](shape.md).[getChildCount](shape.md#abstract-getchildcount)*
*Defined in [src/collision/shape/CircleShape.ts:118](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L118)*
Get the number of child primitives.
**Returns:** *1*
___
### getRadius
▸ **getRadius**(): *number*
*Overrides [Shape](shape.md).[getRadius](shape.md#getradius)*
*Defined in [src/collision/shape/CircleShape.ts:88](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L88)*
**Returns:** *number*
___
### getType
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[getType](shape.md#gettype)*
*Defined in [src/collision/Shape.ts:72](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L72)*
Get the type of this shape. You can use this to down cast to the concrete
shape.
**Returns:** *[ShapeType](../globals.md#shapetype)*
the shape type.
___
### getVertex
▸ **getVertex**(`index`: 0): *[Vec2](vec2.md)*
*Defined in [src/collision/shape/CircleShape.ts:96](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L96)*
**Parameters:**
Name | Type |
------ | ------ |
`index` | 0 |
**Returns:** *[Vec2](vec2.md)*
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `xf`: [Transform](transform.md), `childIndex`: number): *boolean*
*Overrides [Shape](shape.md).[rayCast](shape.md#abstract-raycast)*
*Defined in [src/collision/shape/CircleShape.ts:143](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L143)*
Cast a ray against a child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) | The ray-cast results. |
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input parameters. |
`xf` | [Transform](transform.md) | The transform to be applied to the shape. |
`childIndex` | number | The child shape index |
**Returns:** *boolean*
___
### testPoint
▸ **testPoint**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *boolean*
*Overrides [Shape](shape.md).[testPoint](shape.md#abstract-testpoint)*
*Defined in [src/collision/shape/CircleShape.ts:129](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CircleShape.ts#L129)*
Test a point for containment in this shape. This only works for convex
shapes.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`xf` | [Transform](transform.md) | The shape world transform. |
`p` | [Vec2](vec2.md) | A point in world coordinates. |
**Returns:** *boolean*
___
### `Static` isValid
▸ **isValid**(`shape`: [Shape](shape.md) | null | undefined): *shape is Shape*
*Inherited from [Shape](shape.md).[isValid](shape.md#static-isvalid)*
*Defined in [src/collision/Shape.ts:58](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L58)*
**Parameters:**
Name | Type |
------ | ------ |
`shape` | [Shape](shape.md) &#124; null &#124; undefined |
**Returns:** *shape is Shape*

View File

@ -1,52 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ClipVertex](clipvertex.md)
# Class: ClipVertex
Used for computing contact manifolds.
## Hierarchy
* **ClipVertex**
## Index
### Properties
* [id](clipvertex.md#id)
* [v](clipvertex.md#v)
### Methods
* [set](clipvertex.md#set)
## Properties
### id
• **id**: *[ContactID](contactid.md)‹›* = new ContactID()
*Defined in [src/collision/Manifold.ts:312](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L312)*
___
### v
• **v**: *[Vec2](vec2.md)‹›* = Vec2.zero()
*Defined in [src/collision/Manifold.ts:311](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L311)*
## Methods
### set
▸ **set**(`o`: [ClipVertex](clipvertex.md)): *void*
*Defined in [src/collision/Manifold.ts:314](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L314)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | [ClipVertex](clipvertex.md) |
**Returns:** *void*

View File

@ -1,490 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Contact](contact.md)
# Class: Contact
The class manages contact between two shapes. A contact exists for each
overlapping AABB in the broad-phase (except if filtered). Therefore a contact
object may exist that has no contact points.
## Hierarchy
* **Contact**
## Index
### Constructors
* [constructor](contact.md#constructor)
### Methods
* [evaluate](contact.md#evaluate)
* [flagForFiltering](contact.md#flagforfiltering)
* [getChildIndexA](contact.md#getchildindexa)
* [getChildIndexB](contact.md#getchildindexb)
* [getFixtureA](contact.md#getfixturea)
* [getFixtureB](contact.md#getfixtureb)
* [getFriction](contact.md#getfriction)
* [getManifold](contact.md#getmanifold)
* [getNext](contact.md#getnext)
* [getRestitution](contact.md#getrestitution)
* [getTangentSpeed](contact.md#gettangentspeed)
* [getWorldManifold](contact.md#getworldmanifold)
* [initConstraint](contact.md#initconstraint)
* [initVelocityConstraint](contact.md#initvelocityconstraint)
* [isEnabled](contact.md#isenabled)
* [isTouching](contact.md#istouching)
* [resetFriction](contact.md#resetfriction)
* [resetRestitution](contact.md#resetrestitution)
* [setEnabled](contact.md#setenabled)
* [setFriction](contact.md#setfriction)
* [setRestitution](contact.md#setrestitution)
* [setTangentSpeed](contact.md#settangentspeed)
* [solvePositionConstraint](contact.md#solvepositionconstraint)
* [solvePositionConstraintTOI](contact.md#solvepositionconstrainttoi)
* [solveVelocityConstraint](contact.md#solvevelocityconstraint)
* [storeConstraintImpulses](contact.md#storeconstraintimpulses)
* [update](contact.md#update)
* [warmStartConstraint](contact.md#warmstartconstraint)
## Constructors
### constructor
\+ **new Contact**(`fA`: [Fixture](fixture.md), `indexA`: number, `fB`: [Fixture](fixture.md), `indexB`: number, `evaluateFcn`: [EvaluateFunction](../globals.md#evaluatefunction)): *[Contact](contact.md)*
*Defined in [src/dynamics/Contact.ts:196](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L196)*
**Parameters:**
Name | Type |
------ | ------ |
`fA` | [Fixture](fixture.md) |
`indexA` | number |
`fB` | [Fixture](fixture.md) |
`indexB` | number |
`evaluateFcn` | [EvaluateFunction](../globals.md#evaluatefunction) |
**Returns:** *[Contact](contact.md)*
## Methods
### evaluate
▸ **evaluate**(`manifold`: [Manifold](manifold.md), `xfA`: [Transform](transform.md), `xfB`: [Transform](transform.md)): *void*
*Defined in [src/dynamics/Contact.ts:433](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L433)*
Called by Update method, and implemented by subclasses.
**Parameters:**
Name | Type |
------ | ------ |
`manifold` | [Manifold](manifold.md) |
`xfA` | [Transform](transform.md) |
`xfB` | [Transform](transform.md) |
**Returns:** *void*
___
### flagForFiltering
▸ **flagForFiltering**(): *void*
*Defined in [src/dynamics/Contact.ts:365](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L365)*
Flag this contact for filtering. Filtering will occur the next time step.
**Returns:** *void*
___
### getChildIndexA
▸ **getChildIndexA**(): *number*
*Defined in [src/dynamics/Contact.ts:351](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L351)*
Get the child primitive index for fixture A.
**Returns:** *number*
___
### getChildIndexB
▸ **getChildIndexB**(): *number*
*Defined in [src/dynamics/Contact.ts:358](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L358)*
Get the child primitive index for fixture B.
**Returns:** *number*
___
### getFixtureA
▸ **getFixtureA**(): *[Fixture](fixture.md)*
*Defined in [src/dynamics/Contact.ts:337](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L337)*
Get fixture A in this contact.
**Returns:** *[Fixture](fixture.md)*
___
### getFixtureB
▸ **getFixtureB**(): *[Fixture](fixture.md)*
*Defined in [src/dynamics/Contact.ts:344](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L344)*
Get fixture B in this contact.
**Returns:** *[Fixture](fixture.md)*
___
### getFriction
▸ **getFriction**(): *number*
*Defined in [src/dynamics/Contact.ts:380](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L380)*
Get the friction.
**Returns:** *number*
___
### getManifold
▸ **getManifold**(): *[Manifold](manifold.md)*
*Defined in [src/dynamics/Contact.ts:287](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L287)*
Get the contact manifold. Do not modify the manifold unless you understand
the internals of the library.
**Returns:** *[Manifold](manifold.md)*
___
### getNext
▸ **getNext**(): *[Contact](contact.md) | null*
*Defined in [src/dynamics/Contact.ts:330](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L330)*
Get the next contact in the world's contact list.
**Returns:** *[Contact](contact.md) | null*
___
### getRestitution
▸ **getRestitution**(): *number*
*Defined in [src/dynamics/Contact.ts:403](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L403)*
Get the restitution.
**Returns:** *number*
___
### getTangentSpeed
▸ **getTangentSpeed**(): *number*
*Defined in [src/dynamics/Contact.ts:426](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L426)*
Get the desired tangent speed. In meters per second.
**Returns:** *number*
___
### getWorldManifold
▸ **getWorldManifold**(`worldManifold`: [WorldManifold](worldmanifold.md) | null | undefined): *[WorldManifold](worldmanifold.md) | undefined*
*Defined in [src/dynamics/Contact.ts:294](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L294)*
Get the world manifold.
**Parameters:**
Name | Type |
------ | ------ |
`worldManifold` | [WorldManifold](worldmanifold.md) &#124; null &#124; undefined |
**Returns:** *[WorldManifold](worldmanifold.md) | undefined*
___
### initConstraint
▸ **initConstraint**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Contact.ts:215](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L215)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### initVelocityConstraint
▸ **initVelocityConstraint**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Contact.ts:657](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L657)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isEnabled
▸ **isEnabled**(): *boolean*
*Defined in [src/dynamics/Contact.ts:316](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L316)*
Has this contact been disabled?
**Returns:** *boolean*
___
### isTouching
▸ **isTouching**(): *boolean*
*Defined in [src/dynamics/Contact.ts:323](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L323)*
Is this contact touching?
**Returns:** *boolean*
___
### resetFriction
▸ **resetFriction**(): *void*
*Defined in [src/dynamics/Contact.ts:387](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L387)*
Reset the friction mixture to the default value.
**Returns:** *void*
___
### resetRestitution
▸ **resetRestitution**(): *void*
*Defined in [src/dynamics/Contact.ts:410](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L410)*
Reset the restitution to the default value.
**Returns:** *void*
___
### setEnabled
▸ **setEnabled**(`flag`: boolean): *void*
*Defined in [src/dynamics/Contact.ts:309](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L309)*
Enable/disable this contact. This can be used inside the pre-solve contact
listener. The contact is only disabled for the current time step (or sub-step
in continuous collisions).
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### setFriction
▸ **setFriction**(`friction`: number): *void*
*Defined in [src/dynamics/Contact.ts:373](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L373)*
Override the default friction mixture. You can call this in
ContactListener.preSolve. This value persists until set or reset.
**Parameters:**
Name | Type |
------ | ------ |
`friction` | number |
**Returns:** *void*
___
### setRestitution
▸ **setRestitution**(`restitution`: number): *void*
*Defined in [src/dynamics/Contact.ts:396](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L396)*
Override the default restitution mixture. You can call this in
ContactListener.preSolve. The value persists until you set or reset.
**Parameters:**
Name | Type |
------ | ------ |
`restitution` | number |
**Returns:** *void*
___
### setTangentSpeed
▸ **setTangentSpeed**(`speed`: number): *void*
*Defined in [src/dynamics/Contact.ts:419](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L419)*
Set the desired tangent speed for a conveyor belt behavior. In meters per
second.
**Parameters:**
Name | Type |
------ | ------ |
`speed` | number |
**Returns:** *void*
___
### solvePositionConstraint
▸ **solvePositionConstraint**(`step`: [TimeStep](timestep.md)): *number*
*Defined in [src/dynamics/Contact.ts:525](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L525)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *number*
___
### solvePositionConstraintTOI
▸ **solvePositionConstraintTOI**(`step`: [TimeStep](timestep.md), `toiA`: [Body](body.md), `toiB`: [Body](body.md)): *number*
*Defined in [src/dynamics/Contact.ts:529](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L529)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
`toiA` | [Body](body.md) |
`toiB` | [Body](body.md) |
**Returns:** *number*
___
### solveVelocityConstraint
▸ **solveVelocityConstraint**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Contact.ts:825](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L825)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### storeConstraintImpulses
▸ **storeConstraintImpulses**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Contact.ts:817](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L817)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### update
▸ **update**(`listener?`: object): *void*
*Defined in [src/dynamics/Contact.ts:447](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L447)*
Updates the contact manifold and touching status.
Note: do not assume the fixture AABBs are overlapping or are valid.
**Parameters:**
▪`Optional` **listener**: *object*
Name | Type | Description |
------ | ------ | ------ |
`beginContact` | | - |
`endContact` | | - |
`preSolve` | | |
**Returns:** *void*
___
### warmStartConstraint
▸ **warmStartConstraint**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Contact.ts:776](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L776)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,81 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ContactEdge](contactedge.md)
# Class: ContactEdge
A contact edge is used to connect bodies and contacts together in a contact
graph where each body is a node and each contact is an edge. A contact edge
belongs to a doubly linked list maintained in each attached body. Each
contact has two contact nodes, one for each attached body.
**`prop`** {Contact} contact The contact
**`prop`** {ContactEdge} prev The previous contact edge in the body's contact list
**`prop`** {ContactEdge} next The next contact edge in the body's contact list
**`prop`** {Body} other Provides quick access to the other body attached.
## Hierarchy
* **ContactEdge**
## Index
### Constructors
* [constructor](contactedge.md#constructor)
### Properties
* [contact](contactedge.md#contact)
* [next](contactedge.md#next)
* [other](contactedge.md#other)
* [prev](contactedge.md#prev)
## Constructors
### constructor
\+ **new ContactEdge**(`contact`: [Contact](contact.md)): *[ContactEdge](contactedge.md)*
*Defined in [src/dynamics/Contact.ts:60](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L60)*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
**Returns:** *[ContactEdge](contactedge.md)*
## Properties
### contact
• **contact**: *[Contact](contact.md)*
*Defined in [src/dynamics/Contact.ts:57](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L57)*
___
### next
• **next**: *[ContactEdge](contactedge.md) | undefined*
*Defined in [src/dynamics/Contact.ts:59](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L59)*
___
### other
• **other**: *[Body](body.md) | undefined*
*Defined in [src/dynamics/Contact.ts:60](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L60)*
___
### prev
• **prev**: *[ContactEdge](contactedge.md) | undefined*
*Defined in [src/dynamics/Contact.ts:58](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Contact.ts#L58)*

View File

@ -1,78 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ContactFeature](contactfeature.md)
# Class: ContactFeature
The features that intersect to form the contact point.
## Hierarchy
* **ContactFeature**
## Index
### Properties
* [indexA](contactfeature.md#indexa)
* [indexB](contactfeature.md#indexb)
* [typeA](contactfeature.md#typea)
* [typeB](contactfeature.md#typeb)
### Methods
* [set](contactfeature.md#set)
## Properties
### indexA
• **indexA**: *number*
*Defined in [src/collision/Manifold.ts:207](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L207)*
Feature index on shapeA
___
### indexB
• **indexB**: *number*
*Defined in [src/collision/Manifold.ts:211](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L211)*
Feature index on shapeB
___
### typeA
• **typeA**: *[ContactFeatureType](../enums/contactfeaturetype.md)*
*Defined in [src/collision/Manifold.ts:215](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L215)*
The feature type on shapeA
___
### typeB
• **typeB**: *[ContactFeatureType](../enums/contactfeaturetype.md)*
*Defined in [src/collision/Manifold.ts:219](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L219)*
The feature type on shapeB
## Methods
### set
▸ **set**(`o`: [ContactFeature](contactfeature.md)): *void*
*Defined in [src/collision/Manifold.ts:220](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L220)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | [ContactFeature](contactfeature.md) |
**Returns:** *void*

View File

@ -1,59 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ContactID](contactid.md)
# Class: ContactID
Contact ids to facilitate warm starting.
## Hierarchy
* **ContactID**
## Index
### Properties
* [cf](contactid.md#cf)
### Accessors
* [key](contactid.md#key)
### Methods
* [set](contactid.md#set)
## Properties
### cf
• **cf**: *[ContactFeature](contactfeature.md)* = new ContactFeature()
*Defined in [src/collision/Manifold.ts:185](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L185)*
## Accessors
### key
• **get key**(): *number*
*Defined in [src/collision/Manifold.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L190)*
Used to quickly compare contact ids.
**Returns:** *number*
## Methods
### set
▸ **set**(`o`: [ContactID](contactid.md)): *void*
*Defined in [src/collision/Manifold.ts:194](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L194)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | [ContactID](contactid.md) |
**Returns:** *void*

View File

@ -1,58 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ContactImpulse](contactimpulse.md)
# Class: ContactImpulse
Contact impulses for reporting. Impulses are used instead of forces because
sub-step forces may approach infinity for rigid body collisions. These match
up one-to-one with the contact points in Manifold.
## Hierarchy
* **ContactImpulse**
## Index
### Constructors
* [constructor](contactimpulse.md#constructor)
### Accessors
* [normalImpulses](contactimpulse.md#normalimpulses)
* [tangentImpulses](contactimpulse.md#tangentimpulses)
## Constructors
### constructor
\+ **new ContactImpulse**(`contact`: [Contact](contact.md)): *[ContactImpulse](contactimpulse.md)*
*Defined in [src/dynamics/Solver.ts:79](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L79)*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
**Returns:** *[ContactImpulse](contactimpulse.md)*
## Accessors
### normalImpulses
• **get normalImpulses**(): *number[]*
*Defined in [src/dynamics/Solver.ts:87](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L87)*
**Returns:** *number[]*
___
### tangentImpulses
• **get tangentImpulses**(): *number[]*
*Defined in [src/dynamics/Solver.ts:97](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L97)*
**Returns:** *number[]*

View File

@ -1,60 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DistanceInput](distanceinput.md)
# Class: DistanceInput
Input for Distance. You have to option to use the shape radii in the
computation. Even
## Hierarchy
* **DistanceInput**
## Index
### Properties
* [proxyA](distanceinput.md#proxya)
* [proxyB](distanceinput.md#proxyb)
* [transformA](distanceinput.md#transforma)
* [transformB](distanceinput.md#transformb)
* [useRadii](distanceinput.md#useradii)
## Properties
### proxyA
• **proxyA**: *[DistanceProxy](distanceproxy.md)* = new DistanceProxy()
*Defined in [src/collision/Distance.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L52)*
___
### proxyB
• **proxyB**: *[DistanceProxy](distanceproxy.md)* = new DistanceProxy()
*Defined in [src/collision/Distance.ts:53](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L53)*
___
### transformA
• **transformA**: *[Transform](transform.md) | null* = null
*Defined in [src/collision/Distance.ts:54](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L54)*
___
### transformB
• **transformB**: *[Transform](transform.md) | null* = null
*Defined in [src/collision/Distance.ts:55](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L55)*
___
### useRadii
• **useRadii**: *boolean* = false
*Defined in [src/collision/Distance.ts:56](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L56)*

View File

@ -1,464 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DistanceJoint](distancejoint.md)
# Class: DistanceJoint
A distance joint constrains two points on two bodies to remain at a fixed
distance from each other. You can view this as a massless, rigid rod.
**`param`** Anchor A in global coordination.
**`param`** Anchor B in global coordination.
## Hierarchy
* [Joint](joint.md)
↳ **DistanceJoint**
## Index
### Constructors
* [constructor](distancejoint.md#constructor)
### Properties
* [TYPE](distancejoint.md#static-type)
### Methods
* [getAnchorA](distancejoint.md#getanchora)
* [getAnchorB](distancejoint.md#getanchorb)
* [getBodyA](distancejoint.md#getbodya)
* [getBodyB](distancejoint.md#getbodyb)
* [getCollideConnected](distancejoint.md#getcollideconnected)
* [getDampingRatio](distancejoint.md#getdampingratio)
* [getFrequency](distancejoint.md#getfrequency)
* [getLength](distancejoint.md#getlength)
* [getLocalAnchorA](distancejoint.md#getlocalanchora)
* [getLocalAnchorB](distancejoint.md#getlocalanchorb)
* [getNext](distancejoint.md#getnext)
* [getReactionForce](distancejoint.md#getreactionforce)
* [getReactionTorque](distancejoint.md#getreactiontorque)
* [getType](distancejoint.md#gettype)
* [getUserData](distancejoint.md#getuserdata)
* [initVelocityConstraints](distancejoint.md#initvelocityconstraints)
* [isActive](distancejoint.md#isactive)
* [setDampingRatio](distancejoint.md#setdampingratio)
* [setFrequency](distancejoint.md#setfrequency)
* [setLength](distancejoint.md#setlength)
* [setUserData](distancejoint.md#setuserdata)
* [shiftOrigin](distancejoint.md#shiftorigin)
* [solvePositionConstraints](distancejoint.md#solvepositionconstraints)
* [solveVelocityConstraints](distancejoint.md#solvevelocityconstraints)
## Constructors
### constructor
\+ **new DistanceJoint**(`def`: [DistanceJointDef](../interfaces/distancejointdef.md)): *[DistanceJoint](distancejoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:108](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L108)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [DistanceJointDef](../interfaces/distancejointdef.md) |
**Returns:** *[DistanceJoint](distancejoint.md)*
\+ **new DistanceJoint**(`def`: [DistanceJointOpt](../interfaces/distancejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchorA`: [Vec2](vec2.md), `anchorB`: [Vec2](vec2.md)): *[DistanceJoint](distancejoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:110](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L110)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [DistanceJointOpt](../interfaces/distancejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchorA` | [Vec2](vec2.md) |
`anchorB` | [Vec2](vec2.md) |
**Returns:** *[DistanceJoint](distancejoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"distance-joint"* = 'distance-joint' as 'distance-joint'
*Defined in [src/dynamics/joint/DistanceJoint.ts:86](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L86)*
## Methods
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:281](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L281)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:288](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L288)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getDampingRatio
▸ **getDampingRatio**(): *number*
*Defined in [src/dynamics/joint/DistanceJoint.ts:274](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L274)*
**Returns:** *number*
___
### getFrequency
▸ **getFrequency**(): *number*
*Defined in [src/dynamics/joint/DistanceJoint.ts:266](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L266)*
**Returns:** *number*
___
### getLength
▸ **getLength**(): *number*
*Defined in [src/dynamics/joint/DistanceJoint.ts:258](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L258)*
Get the natural length.
**Returns:** *number*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:236](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L236)*
The local anchor point relative to bodyA's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:243](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L243)*
The local anchor point relative to bodyB's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:295](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L295)*
Get the reaction force on bodyB at the joint anchor in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:302](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L302)*
Get the reaction torque on bodyB in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUserData
▸ **getUserData**(): *unknown*
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:306](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L306)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### setDampingRatio
▸ **setDampingRatio**(`ratio`: number): *void*
*Defined in [src/dynamics/joint/DistanceJoint.ts:270](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L270)*
**Parameters:**
Name | Type |
------ | ------ |
`ratio` | number |
**Returns:** *void*
___
### setFrequency
▸ **setFrequency**(`hz`: number): *void*
*Defined in [src/dynamics/joint/DistanceJoint.ts:262](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L262)*
**Parameters:**
Name | Type |
------ | ------ |
`hz` | number |
**Returns:** *void*
___
### setLength
▸ **setLength**(`length`: number): *void*
*Defined in [src/dynamics/joint/DistanceJoint.ts:251](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L251)*
Set the natural length. Manipulating the length can lead to non-physical
behavior when the frequency is zero.
**Parameters:**
Name | Type |
------ | ------ |
`length` | number |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Inherited from [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
*Defined in [src/dynamics/Joint.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L217)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:424](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L424)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
*Defined in [src/dynamics/joint/DistanceJoint.ts:394](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/DistanceJoint.ts#L394)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,58 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DistanceOutput](distanceoutput.md)
# Class: DistanceOutput
Output for Distance.
**`prop`** {Vec2} pointA closest point on shapeA
**`prop`** {Vec2} pointB closest point on shapeB
**`prop`** distance
**`prop`** iterations number of GJK iterations used
## Hierarchy
* **DistanceOutput**
## Index
### Properties
* [distance](distanceoutput.md#distance)
* [iterations](distanceoutput.md#iterations)
* [pointA](distanceoutput.md#pointa)
* [pointB](distanceoutput.md#pointb)
## Properties
### distance
• **distance**: *number*
*Defined in [src/collision/Distance.ts:70](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L70)*
___
### iterations
• **iterations**: *number*
*Defined in [src/collision/Distance.ts:71](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L71)*
___
### pointA
• **pointA**: *[Vec2](vec2.md)* = Vec2.zero()
*Defined in [src/collision/Distance.ts:68](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L68)*
___
### pointB
• **pointB**: *[Vec2](vec2.md)* = Vec2.zero()
*Defined in [src/collision/Distance.ts:69](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L69)*

View File

@ -1,166 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DistanceProxy](distanceproxy.md)
# Class: DistanceProxy
A distance proxy is used by the GJK algorithm. It encapsulates any shape.
## Hierarchy
* **DistanceProxy**
## Index
### Constructors
* [constructor](distanceproxy.md#constructor)
### Properties
* [m_buffer](distanceproxy.md#m_buffer)
* [m_count](distanceproxy.md#m_count)
* [m_radius](distanceproxy.md#m_radius)
* [m_vertices](distanceproxy.md#m_vertices)
### Methods
* [getSupport](distanceproxy.md#getsupport)
* [getSupportVertex](distanceproxy.md#getsupportvertex)
* [getVertex](distanceproxy.md#getvertex)
* [getVertexCount](distanceproxy.md#getvertexcount)
* [set](distanceproxy.md#set)
## Constructors
### constructor
\+ **new DistanceProxy**(): *[DistanceProxy](distanceproxy.md)*
*Defined in [src/collision/Distance.ts:235](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L235)*
**Returns:** *[DistanceProxy](distanceproxy.md)*
## Properties
### m_buffer
• **m_buffer**: *[Vec2](vec2.md)[]*
*Defined in [src/collision/Distance.ts:232](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L232)*
internal
___
### m_count
• **m_count**: *number*
*Defined in [src/collision/Distance.ts:234](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L234)*
internal
___
### m_radius
• **m_radius**: *number*
*Defined in [src/collision/Distance.ts:235](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L235)*
internal
___
### m_vertices
• **m_vertices**: *[Vec2](vec2.md)[]*
*Defined in [src/collision/Distance.ts:233](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L233)*
internal
## Methods
### getSupport
▸ **getSupport**(`d`: [Vec2](vec2.md)): *number*
*Defined in [src/collision/Distance.ts:263](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L263)*
Get the supporting vertex index in the given direction.
**Parameters:**
Name | Type |
------ | ------ |
`d` | [Vec2](vec2.md) |
**Returns:** *number*
___
### getSupportVertex
▸ **getSupportVertex**(`d`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/collision/Distance.ts:279](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L279)*
Get the supporting vertex in the given direction.
**Parameters:**
Name | Type |
------ | ------ |
`d` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### getVertex
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
*Defined in [src/collision/Distance.ts:255](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L255)*
Get a vertex by index. Used by Distance.
**Parameters:**
Name | Type |
------ | ------ |
`index` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getVertexCount
▸ **getVertexCount**(): *number*
*Defined in [src/collision/Distance.ts:248](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L248)*
Get the vertex count.
**Returns:** *number*
___
### set
▸ **set**(`shape`: [Shape](shape.md), `index`: number): *void*
*Defined in [src/collision/Distance.ts:287](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L287)*
Initialize the proxy using the given shape. The shape must remain in scope
while the proxy is in use.
**Parameters:**
Name | Type |
------ | ------ |
`shape` | [Shape](shape.md) |
`index` | number |
**Returns:** *void*

View File

@ -1,459 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DynamicTree](dynamictree.md)
# Class: DynamicTree ‹**T**›
A dynamic AABB tree broad-phase, inspired by Nathanael Presson's btDbvt. A
dynamic tree arranges data in a binary tree to accelerate queries such as
volume queries and ray casts. Leafs are proxies with an AABB. In the tree we
expand the proxy AABB by `aabbExtension` so that the proxy AABB is bigger
than the client object. This allows the client object to move by small
amounts without triggering a tree update.
Nodes are pooled and relocatable, so we use node indices rather than
pointers.
## Type parameters
▪ **T**
## Hierarchy
* **DynamicTree**
## Index
### Constructors
* [constructor](dynamictree.md#constructor)
### Properties
* [m_lastProxyId](dynamictree.md#m_lastproxyid)
* [m_nodes](dynamictree.md#m_nodes)
* [m_pool](dynamictree.md#m_pool)
* [m_root](dynamictree.md#m_root)
### Methods
* [allocateNode](dynamictree.md#allocatenode)
* [balance](dynamictree.md#balance)
* [computeHeight](dynamictree.md#computeheight)
* [createProxy](dynamictree.md#createproxy)
* [destroyProxy](dynamictree.md#destroyproxy)
* [freeNode](dynamictree.md#freenode)
* [getAreaRatio](dynamictree.md#getarearatio)
* [getFatAABB](dynamictree.md#getfataabb)
* [getHeight](dynamictree.md#getheight)
* [getMaxBalance](dynamictree.md#getmaxbalance)
* [getUserData](dynamictree.md#getuserdata)
* [insertLeaf](dynamictree.md#insertleaf)
* [moveProxy](dynamictree.md#moveproxy)
* [query](dynamictree.md#query)
* [rayCast](dynamictree.md#raycast)
* [rebuildBottomUp](dynamictree.md#rebuildbottomup)
* [removeLeaf](dynamictree.md#removeleaf)
* [shiftOrigin](dynamictree.md#shiftorigin)
* [validate](dynamictree.md#validate)
* [validateMetrics](dynamictree.md#validatemetrics)
* [validateStructure](dynamictree.md#validatestructure)
## Constructors
### constructor
\+ **new DynamicTree**(): *[DynamicTree](dynamictree.md)*
*Defined in [src/collision/DynamicTree.ts:82](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L82)*
**Returns:** *[DynamicTree](dynamictree.md)*
## Properties
### m_lastProxyId
• **m_lastProxyId**: *number*
*Defined in [src/collision/DynamicTree.ts:78](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L78)*
___
### m_nodes
• **m_nodes**: *object*
*Defined in [src/collision/DynamicTree.ts:79](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L79)*
#### Type declaration:
* \[ **id**: *number*\]: [TreeNode](treenode.md)‹T›
___
### m_pool
• **m_pool**: *[Pool](pool.md)‹[TreeNode](treenode.md)‹T››*
*Defined in [src/collision/DynamicTree.ts:82](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L82)*
___
### m_root
• **m_root**: *[TreeNode](treenode.md)‹T›*
*Defined in [src/collision/DynamicTree.ts:77](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L77)*
## Methods
### allocateNode
▸ **allocateNode**(): *[TreeNode](treenode.md)‹T›*
*Defined in [src/collision/DynamicTree.ts:118](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L118)*
**Returns:** *[TreeNode](treenode.md)‹T›*
___
### balance
▸ **balance**(`iA`: [TreeNode](treenode.md)‹T›): *[TreeNode](treenode.md)‹T›*
*Defined in [src/collision/DynamicTree.ts:395](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L395)*
Perform a left or right rotation if node A is imbalanced. Returns the new
root index.
**Parameters:**
Name | Type |
------ | ------ |
`iA` | [TreeNode](treenode.md)‹T› |
**Returns:** *[TreeNode](treenode.md)‹T›*
___
### computeHeight
▸ **computeHeight**(`id?`: number): *number*
*Defined in [src/collision/DynamicTree.ts:544](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L544)*
Compute the height of a sub-tree.
**Parameters:**
Name | Type |
------ | ------ |
`id?` | number |
**Returns:** *number*
___
### createProxy
▸ **createProxy**(`aabb`: [AABB](aabb.md), `userData`: T): *number*
*Defined in [src/collision/DynamicTree.ts:143](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L143)*
Create a proxy in the tree as a leaf node. We return the index of the node
instead of a pointer so that we can grow the node pool.
Create a proxy. Provide a tight fitting AABB and a userData pointer.
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
`userData` | T |
**Returns:** *number*
___
### destroyProxy
▸ **destroyProxy**(`id`: number): *void*
*Defined in [src/collision/DynamicTree.ts:164](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L164)*
Destroy a proxy. This asserts if the id is invalid.
**Parameters:**
Name | Type |
------ | ------ |
`id` | number |
**Returns:** *void*
___
### freeNode
▸ **freeNode**(`node`: [TreeNode](treenode.md)‹T›): *void*
*Defined in [src/collision/DynamicTree.ts:130](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L130)*
**Parameters:**
Name | Type |
------ | ------ |
`node` | [TreeNode](treenode.md)‹T› |
**Returns:** *void*
___
### getAreaRatio
▸ **getAreaRatio**(): *number*
*Defined in [src/collision/DynamicTree.ts:516](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L516)*
Get the ratio of the sum of the node areas to the root area.
**Returns:** *number*
___
### getFatAABB
▸ **getFatAABB**(`id`: number): *[AABB](aabb.md)*
*Defined in [src/collision/DynamicTree.ts:112](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L112)*
Get the fat AABB for a node id.
**Parameters:**
Name | Type |
------ | ------ |
`id` | number |
**Returns:** *[AABB](aabb.md)*
the proxy user data or 0 if the id is invalid.
___
### getHeight
▸ **getHeight**(): *number*
*Defined in [src/collision/DynamicTree.ts:505](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L505)*
Compute the height of the binary tree in O(N) time. Should not be called
often.
**Returns:** *number*
___
### getMaxBalance
▸ **getMaxBalance**(): *number*
*Defined in [src/collision/DynamicTree.ts:638](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L638)*
Get the maximum balance of an node in the tree. The balance is the difference
in height of the two children of a node.
**Returns:** *number*
___
### getUserData
▸ **getUserData**(`id`: number): *T*
*Defined in [src/collision/DynamicTree.ts:101](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L101)*
Get proxy user data.
**Parameters:**
Name | Type |
------ | ------ |
`id` | number |
**Returns:** *T*
the proxy user data or 0 if the id is invalid.
___
### insertLeaf
▸ **insertLeaf**(`leaf`: [TreeNode](treenode.md)‹T›): *void*
*Defined in [src/collision/DynamicTree.ts:224](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L224)*
**Parameters:**
Name | Type |
------ | ------ |
`leaf` | [TreeNode](treenode.md)‹T› |
**Returns:** *void*
___
### moveProxy
▸ **moveProxy**(`id`: number, `aabb`: [AABB](aabb.md), `d`: [Vec2](vec2.md)): *boolean*
*Defined in [src/collision/DynamicTree.ts:183](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L183)*
Move a proxy with a swepted AABB. If the proxy has moved outside of its
fattened AABB, then the proxy is removed from the tree and re-inserted.
Otherwise the function returns immediately.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`id` | number | - |
`aabb` | [AABB](aabb.md) | - |
`d` | [Vec2](vec2.md) | Displacement |
**Returns:** *boolean*
true if the proxy was re-inserted.
___
### query
▸ **query**(`aabb`: [AABB](aabb.md), `queryCallback`: [DynamicTreeQueryCallback](../globals.md#dynamictreequerycallback)): *void*
*Defined in [src/collision/DynamicTree.ts:749](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L749)*
Query an AABB for overlapping proxies. The callback class is called for each
proxy that overlaps the supplied AABB.
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
`queryCallback` | [DynamicTreeQueryCallback](../globals.md#dynamictreequerycallback) |
**Returns:** *void*
___
### rayCast
▸ **rayCast**(`input`: [RayCastInput](../interfaces/raycastinput.md), `rayCastCallback`: [RayCastCallback](../globals.md#raycastcallback)): *void*
*Defined in [src/collision/DynamicTree.ts:786](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L786)*
Ray-cast against the proxies in the tree. This relies on the callback to
perform a exact ray-cast in the case were the proxy contains a shape. The
callback also performs the any collision filtering. This has performance
roughly equal to k * log(n), where k is the number of collisions and n is the
number of proxies in the tree.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input data. The ray extends from `p1` to `p1 + maxFraction * (p2 - p1)`. |
`rayCastCallback` | [RayCastCallback](../globals.md#raycastcallback) | A function that is called for each proxy that is hit by the ray. |
**Returns:** *void*
___
### rebuildBottomUp
▸ **rebuildBottomUp**(): *void*
*Defined in [src/collision/DynamicTree.ts:660](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L660)*
Build an optimal tree. Very expensive. For testing.
**Returns:** *void*
___
### removeLeaf
▸ **removeLeaf**(`leaf`: [TreeNode](treenode.md)‹T›): *void*
*Defined in [src/collision/DynamicTree.ts:344](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L344)*
**Parameters:**
Name | Type |
------ | ------ |
`leaf` | [TreeNode](treenode.md)‹T› |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Defined in [src/collision/DynamicTree.ts:731](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L731)*
Shift the world origin. Useful for large worlds. The shift formula is:
position -= newOrigin
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`newOrigin` | [Vec2](vec2.md) | The new origin with respect to the old origin |
**Returns:** *void*
___
### validate
▸ **validate**(): *void*
*Defined in [src/collision/DynamicTree.ts:627](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L627)*
Validate this tree. For testing.
**Returns:** *void*
___
### validateMetrics
▸ **validateMetrics**(`node`: [TreeNode](treenode.md)‹T›): *void*
*Defined in [src/collision/DynamicTree.ts:592](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L592)*
**Parameters:**
Name | Type |
------ | ------ |
`node` | [TreeNode](treenode.md)‹T› |
**Returns:** *void*
___
### validateStructure
▸ **validateStructure**(`node`: [TreeNode](treenode.md)‹T›): *void*
*Defined in [src/collision/DynamicTree.ts:563](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L563)*
**Parameters:**
Name | Type |
------ | ------ |
`node` | [TreeNode](treenode.md)‹T› |
**Returns:** *void*

View File

@ -1,389 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [EdgeShape](edgeshape.md)
# Class: EdgeShape
A line segment (edge) shape. These can be connected in chains or loops to
other edge shapes. The connectivity information is used to ensure correct
contact normals.
## Hierarchy
* [Shape](shape.md)
↳ **EdgeShape**
## Index
### Constructors
* [constructor](edgeshape.md#constructor)
### Properties
* [m_hasVertex0](edgeshape.md#m_hasvertex0)
* [m_hasVertex3](edgeshape.md#m_hasvertex3)
* [m_radius](edgeshape.md#m_radius)
* [m_type](edgeshape.md#m_type)
* [m_vertex0](edgeshape.md#m_vertex0)
* [m_vertex1](edgeshape.md#m_vertex1)
* [m_vertex2](edgeshape.md#m_vertex2)
* [m_vertex3](edgeshape.md#m_vertex3)
* [TYPE](edgeshape.md#static-type)
### Methods
* [_set](edgeshape.md#_set)
* [computeAABB](edgeshape.md#computeaabb)
* [computeDistanceProxy](edgeshape.md#computedistanceproxy)
* [computeMass](edgeshape.md#computemass)
* [getChildCount](edgeshape.md#getchildcount)
* [getNextVertex](edgeshape.md#getnextvertex)
* [getPrevVertex](edgeshape.md#getprevvertex)
* [getRadius](edgeshape.md#getradius)
* [getType](edgeshape.md#gettype)
* [rayCast](edgeshape.md#raycast)
* [setNextVertex](edgeshape.md#setnextvertex)
* [setPrevVertex](edgeshape.md#setprevvertex)
* [testPoint](edgeshape.md#testpoint)
* [isValid](edgeshape.md#static-isvalid)
## Constructors
### constructor
\+ **new EdgeShape**(`v1?`: [Vec2](vec2.md), `v2?`: [Vec2](vec2.md)): *[EdgeShape](edgeshape.md)*
*Defined in [src/collision/shape/EdgeShape.ts:51](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L51)*
**Parameters:**
Name | Type |
------ | ------ |
`v1?` | [Vec2](vec2.md) |
`v2?` | [Vec2](vec2.md) |
**Returns:** *[EdgeShape](edgeshape.md)*
## Properties
### m_hasVertex0
• **m_hasVertex0**: *boolean*
*Defined in [src/collision/shape/EdgeShape.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L50)*
___
### m_hasVertex3
• **m_hasVertex3**: *boolean*
*Defined in [src/collision/shape/EdgeShape.ts:51](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L51)*
___
### m_radius
• **m_radius**: *number*
*Inherited from [Shape](shape.md).[m_radius](shape.md#m_radius)*
*Defined in [src/collision/Shape.ts:39](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L39)*
___
### m_type
• **m_type**: *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[m_type](shape.md#m_type)*
*Defined in [src/collision/Shape.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L38)*
___
### m_vertex0
• **m_vertex0**: *[Vec2](vec2.md)*
*Defined in [src/collision/shape/EdgeShape.ts:48](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L48)*
___
### m_vertex1
• **m_vertex1**: *[Vec2](vec2.md)*
*Defined in [src/collision/shape/EdgeShape.ts:43](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L43)*
___
### m_vertex2
• **m_vertex2**: *[Vec2](vec2.md)*
*Defined in [src/collision/shape/EdgeShape.ts:44](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L44)*
___
### m_vertex3
• **m_vertex3**: *[Vec2](vec2.md)*
*Defined in [src/collision/shape/EdgeShape.ts:49](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L49)*
___
### `Static` TYPE
▪ **TYPE**: *"edge"* = 'edge' as 'edge'
*Defined in [src/collision/shape/EdgeShape.ts:40](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L40)*
## Methods
### _set
▸ **_set**(`v1`: [Vec2](vec2.md), `v2`: [Vec2](vec2.md)): *[EdgeShape](edgeshape.md)*
*Defined in [src/collision/shape/EdgeShape.ts:157](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L157)*
Set this as an isolated edge.
**Parameters:**
Name | Type |
------ | ------ |
`v1` | [Vec2](vec2.md) |
`v2` | [Vec2](vec2.md) |
**Returns:** *[EdgeShape](edgeshape.md)*
___
### computeAABB
▸ **computeAABB**(`aabb`: [AABB](aabb.md), `xf`: [Transform](transform.md), `childIndex`: number): *void*
*Overrides [Shape](shape.md).[computeAABB](shape.md#abstract-computeaabb)*
*Defined in [src/collision/shape/EdgeShape.ts:276](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L276)*
Given a transform, compute the associated axis aligned bounding box for a
child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`aabb` | [AABB](aabb.md) | Returns the axis aligned box. |
`xf` | [Transform](transform.md) | The world transform of the shape. |
`childIndex` | number | The child shape |
**Returns:** *void*
___
### computeDistanceProxy
▸ **computeDistanceProxy**(`proxy`: [DistanceProxy](distanceproxy.md)): *void*
*Overrides [Shape](shape.md).[computeDistanceProxy](shape.md#abstract-computedistanceproxy)*
*Defined in [src/collision/shape/EdgeShape.ts:297](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L297)*
**Parameters:**
Name | Type |
------ | ------ |
`proxy` | [DistanceProxy](distanceproxy.md) |
**Returns:** *void*
___
### computeMass
▸ **computeMass**(`massData`: [MassData](massdata.md), `density?`: number): *void*
*Overrides [Shape](shape.md).[computeMass](shape.md#abstract-computemass)*
*Defined in [src/collision/shape/EdgeShape.ts:291](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L291)*
Compute the mass properties of this shape using its dimensions and density.
The inertia tensor is computed about the local origin.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`massData` | [MassData](massdata.md) | Returns the mass data for this shape. |
`density?` | number | The density in kilograms per meter squared. |
**Returns:** *void*
___
### getChildCount
▸ **getChildCount**(): *1*
*Overrides [Shape](shape.md).[getChildCount](shape.md#abstract-getchildcount)*
*Defined in [src/collision/shape/EdgeShape.ts:187](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L187)*
Get the number of child primitives.
**Returns:** *1*
___
### getNextVertex
▸ **getNextVertex**(): *[Vec2](vec2.md)*
*Defined in [src/collision/shape/EdgeShape.ts:124](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L124)*
Optional next vertex, used for smooth collision.
**Returns:** *[Vec2](vec2.md)*
___
### getPrevVertex
▸ **getPrevVertex**(): *[Vec2](vec2.md)*
*Defined in [src/collision/shape/EdgeShape.ts:150](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L150)*
Optional prev vertex, used for smooth collision.
**Returns:** *[Vec2](vec2.md)*
___
### getRadius
▸ **getRadius**(): *number*
*Inherited from [Shape](shape.md).[getRadius](shape.md#getradius)*
*Defined in [src/collision/Shape.ts:62](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L62)*
**Returns:** *number*
___
### getType
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[getType](shape.md#gettype)*
*Defined in [src/collision/Shape.ts:72](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L72)*
Get the type of this shape. You can use this to down cast to the concrete
shape.
**Returns:** *[ShapeType](../globals.md#shapetype)*
the shape type.
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `xf`: [Transform](transform.md), `childIndex`: number): *boolean*
*Overrides [Shape](shape.md).[rayCast](shape.md#abstract-raycast)*
*Defined in [src/collision/shape/EdgeShape.ts:210](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L210)*
Cast a ray against a child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) | The ray-cast results. |
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input parameters. |
`xf` | [Transform](transform.md) | The transform to be applied to the shape. |
`childIndex` | number | The child shape index |
**Returns:** *boolean*
___
### setNextVertex
▸ **setNextVertex**(`v?`: [Vec2](vec2.md)): *[EdgeShape](edgeshape.md)*
*Defined in [src/collision/shape/EdgeShape.ts:110](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L110)*
Optional next vertex, used for smooth collision.
**Parameters:**
Name | Type |
------ | ------ |
`v?` | [Vec2](vec2.md) |
**Returns:** *[EdgeShape](edgeshape.md)*
___
### setPrevVertex
▸ **setPrevVertex**(`v?`: [Vec2](vec2.md)): *[EdgeShape](edgeshape.md)*
*Defined in [src/collision/shape/EdgeShape.ts:136](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L136)*
Optional prev vertex, used for smooth collision.
**Parameters:**
Name | Type |
------ | ------ |
`v?` | [Vec2](vec2.md) |
**Returns:** *[EdgeShape](edgeshape.md)*
___
### testPoint
▸ **testPoint**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *false*
*Overrides [Shape](shape.md).[testPoint](shape.md#abstract-testpoint)*
*Defined in [src/collision/shape/EdgeShape.ts:198](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/EdgeShape.ts#L198)*
Test a point for containment in this shape. This only works for convex
shapes.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`xf` | [Transform](transform.md) | The shape world transform. |
`p` | [Vec2](vec2.md) | A point in world coordinates. |
**Returns:** *false*
___
### `Static` isValid
▸ **isValid**(`shape`: [Shape](shape.md) | null | undefined): *shape is Shape*
*Inherited from [Shape](shape.md).[isValid](shape.md#static-isvalid)*
*Defined in [src/collision/Shape.ts:58](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L58)*
**Parameters:**
Name | Type |
------ | ------ |
`shape` | [Shape](shape.md) &#124; null &#124; undefined |
**Returns:** *shape is Shape*

View File

@ -1,41 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [EPAxis](epaxis.md)
# Class: EPAxis
This structure is used to keep track of the best separating axis.
## Hierarchy
* **EPAxis**
## Index
### Properties
* [index](epaxis.md#index)
* [separation](epaxis.md#separation)
* [type](epaxis.md#type)
## Properties
### index
• **index**: *number*
*Defined in [src/collision/shape/CollideEdgePolygon.ts:81](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L81)*
___
### separation
• **separation**: *number*
*Defined in [src/collision/shape/CollideEdgePolygon.ts:82](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L82)*
___
### type
• **type**: *[EPAxisType](../enums/epaxistype.md)*
*Defined in [src/collision/shape/CollideEdgePolygon.ts:80](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L80)*

View File

@ -1,528 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Fixture](fixture.md)
# Class: Fixture
A fixture is used to attach a shape to a body for collision detection. A
fixture inherits its transform from its parent. Fixtures hold additional
non-geometric data such as friction, collision filters, etc.
To create a new Fixture use [Body.createFixture](body.md#createfixture).
## Hierarchy
* **Fixture**
## Index
### Methods
* [createProxies](fixture.md#createproxies)
* [destroyProxies](fixture.md#destroyproxies)
* [getAABB](fixture.md#getaabb)
* [getBody](fixture.md#getbody)
* [getDensity](fixture.md#getdensity)
* [getFilterCategoryBits](fixture.md#getfiltercategorybits)
* [getFilterGroupIndex](fixture.md#getfiltergroupindex)
* [getFilterMaskBits](fixture.md#getfiltermaskbits)
* [getFriction](fixture.md#getfriction)
* [getMassData](fixture.md#getmassdata)
* [getNext](fixture.md#getnext)
* [getRestitution](fixture.md#getrestitution)
* [getShape](fixture.md#getshape)
* [getType](fixture.md#gettype)
* [getUserData](fixture.md#getuserdata)
* [isSensor](fixture.md#issensor)
* [rayCast](fixture.md#raycast)
* [refilter](fixture.md#refilter)
* [setDensity](fixture.md#setdensity)
* [setFilterCategoryBits](fixture.md#setfiltercategorybits)
* [setFilterData](fixture.md#setfilterdata)
* [setFilterGroupIndex](fixture.md#setfiltergroupindex)
* [setFilterMaskBits](fixture.md#setfiltermaskbits)
* [setFriction](fixture.md#setfriction)
* [setRestitution](fixture.md#setrestitution)
* [setSensor](fixture.md#setsensor)
* [setUserData](fixture.md#setuserdata)
* [shouldCollide](fixture.md#shouldcollide)
* [synchronize](fixture.md#synchronize)
* [testPoint](fixture.md#testpoint)
## Methods
### createProxies
▸ **createProxies**(`broadPhase`: [BroadPhase](broadphase.md), `xf`: [Transform](transform.md)): *void*
*Defined in [src/dynamics/Fixture.ts:369](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L369)*
These support body activation/deactivation.
**Parameters:**
Name | Type |
------ | ------ |
`broadPhase` | [BroadPhase](broadphase.md) |
`xf` | [Transform](transform.md) |
**Returns:** *void*
___
### destroyProxies
▸ **destroyProxies**(`broadPhase`: [BroadPhase](broadphase.md)): *void*
*Defined in [src/dynamics/Fixture.ts:382](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L382)*
**Parameters:**
Name | Type |
------ | ------ |
`broadPhase` | [BroadPhase](broadphase.md) |
**Returns:** *void*
___
### getAABB
▸ **getAABB**(`childIndex`: number): *[AABB](aabb.md)*
*Defined in [src/dynamics/Fixture.ts:361](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L361)*
Get the fixture's AABB. This AABB may be enlarge and/or stale. If you need a
more accurate AABB, compute it using the shape and the body transform.
**Parameters:**
Name | Type |
------ | ------ |
`childIndex` | number |
**Returns:** *[AABB](aabb.md)*
___
### getBody
▸ **getBody**(): *[Body](body.md)*
*Defined in [src/dynamics/Fixture.ts:277](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L277)*
Get the parent body of this fixture. This is null if the fixture is not
attached.
**Returns:** *[Body](body.md)*
___
### getDensity
▸ **getDensity**(): *number*
*Defined in [src/dynamics/Fixture.ts:291](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L291)*
Get the density of this fixture.
**Returns:** *number*
___
### getFilterCategoryBits
▸ **getFilterCategoryBits**(): *number*
*Defined in [src/dynamics/Fixture.ts:435](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L435)*
**Returns:** *number*
___
### getFilterGroupIndex
▸ **getFilterGroupIndex**(): *number*
*Defined in [src/dynamics/Fixture.ts:427](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L427)*
**Returns:** *number*
___
### getFilterMaskBits
▸ **getFilterMaskBits**(): *number*
*Defined in [src/dynamics/Fixture.ts:443](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L443)*
**Returns:** *number*
___
### getFriction
▸ **getFriction**(): *number*
*Defined in [src/dynamics/Fixture.ts:307](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L307)*
Get the coefficient of friction, usually in the range [0,1].
**Returns:** *number*
___
### getMassData
▸ **getMassData**(`massData`: [MassData](massdata.md)): *void*
*Defined in [src/dynamics/Fixture.ts:353](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L353)*
Get the mass data for this fixture. The mass data is based on the density and
the shape. The rotational inertia is about the shape's origin. This operation
may be expensive.
**Parameters:**
Name | Type |
------ | ------ |
`massData` | [MassData](massdata.md) |
**Returns:** *void*
___
### getNext
▸ **getNext**(): *[Fixture](fixture.md) | null*
*Defined in [src/dynamics/Fixture.ts:284](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L284)*
Get the next fixture in the parent body's fixture list.
**Returns:** *[Fixture](fixture.md) | null*
___
### getRestitution
▸ **getRestitution**(): *number*
*Defined in [src/dynamics/Fixture.ts:322](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L322)*
Get the coefficient of restitution.
**Returns:** *number*
___
### getShape
▸ **getShape**(): *[Shape](shape.md)*
*Defined in [src/dynamics/Fixture.ts:229](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L229)*
Get the child shape. You can modify the child shape, however you should not
change the number of vertices because this will crash some collision caching
mechanisms. Manipulating the shape may lead to non-physical behavior.
**Returns:** *[Shape](shape.md)*
___
### getType
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
*Defined in [src/dynamics/Fixture.ts:220](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L220)*
Get the type of the child shape. You can use this to down cast to the
concrete shape.
**Returns:** *[ShapeType](../globals.md#shapetype)*
___
### getUserData
▸ **getUserData**(): *unknown*
*Defined in [src/dynamics/Fixture.ts:262](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L262)*
Get the user data that was assigned in the fixture definition. Use this to
store your application specific data.
**Returns:** *unknown*
___
### isSensor
▸ **isSensor**(): *boolean*
*Defined in [src/dynamics/Fixture.ts:237](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L237)*
A sensor shape collects contact information but never generates a collision
response.
**Returns:** *boolean*
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `childIndex`: number): *boolean*
*Defined in [src/dynamics/Fixture.ts:344](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L344)*
Cast a ray against this shape.
**Parameters:**
Name | Type |
------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) |
`input` | [RayCastInput](../interfaces/raycastinput.md) |
`childIndex` | number |
**Returns:** *boolean*
___
### refilter
▸ **refilter**(): *void*
*Defined in [src/dynamics/Fixture.ts:455](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L455)*
Call this if you want to establish collision that was previously disabled by
ContactFilter.
**Returns:** *void*
___
### setDensity
▸ **setDensity**(`density`: number): *void*
*Defined in [src/dynamics/Fixture.ts:299](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L299)*
Set the density of this fixture. This will _not_ automatically adjust the
mass of the body. You must call Body.resetMassData to update the body's mass.
**Parameters:**
Name | Type |
------ | ------ |
`density` | number |
**Returns:** *void*
___
### setFilterCategoryBits
▸ **setFilterCategoryBits**(`categoryBits`: number): *void*
*Defined in [src/dynamics/Fixture.ts:439](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L439)*
**Parameters:**
Name | Type |
------ | ------ |
`categoryBits` | number |
**Returns:** *void*
___
### setFilterData
▸ **setFilterData**(`filter`: object): *void*
*Defined in [src/dynamics/Fixture.ts:420](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L420)*
Set the contact filtering data. This will not update contacts until the next
time step when either parent body is active and awake. This automatically
calls refilter.
**Parameters:**
▪ **filter**: *object*
Name | Type |
------ | ------ |
`categoryBits` | number |
`groupIndex` | number |
`maskBits` | number |
**Returns:** *void*
___
### setFilterGroupIndex
▸ **setFilterGroupIndex**(`groupIndex`: number): *void*
*Defined in [src/dynamics/Fixture.ts:431](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L431)*
**Parameters:**
Name | Type |
------ | ------ |
`groupIndex` | number |
**Returns:** *void*
___
### setFilterMaskBits
▸ **setFilterMaskBits**(`maskBits`: number): *void*
*Defined in [src/dynamics/Fixture.ts:447](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L447)*
**Parameters:**
Name | Type |
------ | ------ |
`maskBits` | number |
**Returns:** *void*
___
### setFriction
▸ **setFriction**(`friction`: number): *void*
*Defined in [src/dynamics/Fixture.ts:315](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L315)*
Set the coefficient of friction. This will not change the friction of
existing contacts.
**Parameters:**
Name | Type |
------ | ------ |
`friction` | number |
**Returns:** *void*
___
### setRestitution
▸ **setRestitution**(`restitution`: number): *void*
*Defined in [src/dynamics/Fixture.ts:330](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L330)*
Set the coefficient of restitution. This will not change the restitution of
existing contacts.
**Parameters:**
Name | Type |
------ | ------ |
`restitution` | number |
**Returns:** *void*
___
### setSensor
▸ **setSensor**(`sensor`: boolean): *void*
*Defined in [src/dynamics/Fixture.ts:244](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L244)*
Set if this fixture is a sensor.
**Parameters:**
Name | Type |
------ | ------ |
`sensor` | boolean |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Defined in [src/dynamics/Fixture.ts:269](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L269)*
Set the user data. Use this to store your application specific data.
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shouldCollide
▸ **shouldCollide**(`that`: [Fixture](fixture.md)): *boolean*
*Defined in [src/dynamics/Fixture.ts:496](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L496)*
Implement this method to provide collision filtering, if you want finer
control over contact creation.
Return true if contact calculations should be performed between these two
fixtures.
Warning: for performance reasons this is only called when the AABBs begin to
overlap.
**Parameters:**
Name | Type |
------ | ------ |
`that` | [Fixture](fixture.md) |
**Returns:** *boolean*
___
### synchronize
▸ **synchronize**(`broadPhase`: [BroadPhase](broadphase.md), `xf1`: [Transform](transform.md), `xf2`: [Transform](transform.md)): *void*
*Defined in [src/dynamics/Fixture.ts:397](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L397)*
Updates this fixture proxy in broad-phase (with combined AABB of current and
next transformation).
**Parameters:**
Name | Type |
------ | ------ |
`broadPhase` | [BroadPhase](broadphase.md) |
`xf1` | [Transform](transform.md) |
`xf2` | [Transform](transform.md) |
**Returns:** *void*
___
### testPoint
▸ **testPoint**(`p`: [Vec2](vec2.md)): *boolean*
*Defined in [src/dynamics/Fixture.ts:337](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L337)*
Test a point in world coordinates for containment in this fixture.
**Parameters:**
Name | Type |
------ | ------ |
`p` | [Vec2](vec2.md) |
**Returns:** *boolean*

View File

@ -1,71 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [FixtureProxy](fixtureproxy.md)
# Class: FixtureProxy
This proxy is used internally to connect shape children to the broad-phase.
## Hierarchy
* **FixtureProxy**
## Index
### Constructors
* [constructor](fixtureproxy.md#constructor)
### Properties
* [aabb](fixtureproxy.md#aabb)
* [childIndex](fixtureproxy.md#childindex)
* [fixture](fixtureproxy.md#fixture)
* [proxyId](fixtureproxy.md#proxyid)
## Constructors
### constructor
\+ **new FixtureProxy**(`fixture`: [Fixture](fixture.md), `childIndex`: number): *[FixtureProxy](fixtureproxy.md)*
*Defined in [src/dynamics/Fixture.ts:100](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L100)*
**Parameters:**
Name | Type |
------ | ------ |
`fixture` | [Fixture](fixture.md) |
`childIndex` | number |
**Returns:** *[FixtureProxy](fixtureproxy.md)*
## Properties
### aabb
• **aabb**: *[AABB](aabb.md)*
*Defined in [src/dynamics/Fixture.ts:97](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L97)*
___
### childIndex
• **childIndex**: *number*
*Defined in [src/dynamics/Fixture.ts:99](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L99)*
___
### fixture
• **fixture**: *[Fixture](fixture.md)*
*Defined in [src/dynamics/Fixture.ts:98](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L98)*
___
### proxyId
• **proxyId**: *number*
*Defined in [src/dynamics/Fixture.ts:100](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L100)*

View File

@ -1,436 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [FrictionJoint](frictionjoint.md)
# Class: FrictionJoint
Friction joint. This is used for top-down friction. It provides 2D
translational friction and angular friction.
**`param`** Anchor in global coordination.
## Hierarchy
* [Joint](joint.md)
↳ **FrictionJoint**
## Index
### Constructors
* [constructor](frictionjoint.md#constructor)
### Properties
* [TYPE](frictionjoint.md#static-type)
### Methods
* [getAnchorA](frictionjoint.md#getanchora)
* [getAnchorB](frictionjoint.md#getanchorb)
* [getBodyA](frictionjoint.md#getbodya)
* [getBodyB](frictionjoint.md#getbodyb)
* [getCollideConnected](frictionjoint.md#getcollideconnected)
* [getLocalAnchorA](frictionjoint.md#getlocalanchora)
* [getLocalAnchorB](frictionjoint.md#getlocalanchorb)
* [getMaxForce](frictionjoint.md#getmaxforce)
* [getMaxTorque](frictionjoint.md#getmaxtorque)
* [getNext](frictionjoint.md#getnext)
* [getReactionForce](frictionjoint.md#getreactionforce)
* [getReactionTorque](frictionjoint.md#getreactiontorque)
* [getType](frictionjoint.md#gettype)
* [getUserData](frictionjoint.md#getuserdata)
* [initVelocityConstraints](frictionjoint.md#initvelocityconstraints)
* [isActive](frictionjoint.md#isactive)
* [setMaxForce](frictionjoint.md#setmaxforce)
* [setMaxTorque](frictionjoint.md#setmaxtorque)
* [setUserData](frictionjoint.md#setuserdata)
* [shiftOrigin](frictionjoint.md#shiftorigin)
* [solvePositionConstraints](frictionjoint.md#solvepositionconstraints)
* [solveVelocityConstraints](frictionjoint.md#solvevelocityconstraints)
## Constructors
### constructor
\+ **new FrictionJoint**(`def`: [FrictionJointDef](../interfaces/frictionjointdef.md)): *[FrictionJoint](frictionjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:99](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L99)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [FrictionJointDef](../interfaces/frictionjointdef.md) |
**Returns:** *[FrictionJoint](frictionjoint.md)*
\+ **new FrictionJoint**(`def`: [FrictionJointOpt](../interfaces/frictionjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[FrictionJoint](frictionjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:101](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L101)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [FrictionJointOpt](../interfaces/frictionjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[FrictionJoint](frictionjoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"friction-joint"* = 'friction-joint' as 'friction-joint'
*Defined in [src/dynamics/joint/FrictionJoint.ts:78](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L78)*
## Methods
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:244](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L244)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:251](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L251)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:200](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L200)*
The local anchor point relative to bodyA's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:207](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L207)*
The local anchor point relative to bodyB's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getMaxForce
▸ **getMaxForce**(): *number*
*Defined in [src/dynamics/joint/FrictionJoint.ts:222](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L222)*
Get the maximum friction force in N.
**Returns:** *number*
___
### getMaxTorque
▸ **getMaxTorque**(): *number*
*Defined in [src/dynamics/joint/FrictionJoint.ts:237](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L237)*
Get the maximum friction torque in N*m.
**Returns:** *number*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:258](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L258)*
Get the reaction force on bodyB at the joint anchor in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:265](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L265)*
Get the reaction torque on bodyB in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUserData
▸ **getUserData**(): *unknown*
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:269](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L269)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### setMaxForce
▸ **setMaxForce**(`force`: number): *void*
*Defined in [src/dynamics/joint/FrictionJoint.ts:214](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L214)*
Set the maximum friction force in N.
**Parameters:**
Name | Type |
------ | ------ |
`force` | number |
**Returns:** *void*
___
### setMaxTorque
▸ **setMaxTorque**(`torque`: number): *void*
*Defined in [src/dynamics/joint/FrictionJoint.ts:229](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L229)*
Set the maximum friction torque in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`torque` | number |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Inherited from [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
*Defined in [src/dynamics/Joint.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L217)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:407](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L407)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
*Defined in [src/dynamics/joint/FrictionJoint.ts:345](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/FrictionJoint.ts#L345)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,413 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [GearJoint](gearjoint.md)
# Class: GearJoint
A gear joint is used to connect two joints together. Either joint can be a
revolute or prismatic joint. You specify a gear ratio to bind the motions
together: coordinate1 + ratio * coordinate2 = constant
The ratio can be negative or positive. If one joint is a revolute joint and
the other joint is a prismatic joint, then the ratio will have units of
length or units of 1/length. Warning: You have to manually destroy the gear
joint if joint1 or joint2 is destroyed.
This definition requires two existing revolute or prismatic joints (any
combination will work).
## Hierarchy
* [Joint](joint.md)
↳ **GearJoint**
## Index
### Constructors
* [constructor](gearjoint.md#constructor)
### Properties
* [TYPE](gearjoint.md#static-type)
### Methods
* [getAnchorA](gearjoint.md#getanchora)
* [getAnchorB](gearjoint.md#getanchorb)
* [getBodyA](gearjoint.md#getbodya)
* [getBodyB](gearjoint.md#getbodyb)
* [getCollideConnected](gearjoint.md#getcollideconnected)
* [getJoint1](gearjoint.md#getjoint1)
* [getJoint2](gearjoint.md#getjoint2)
* [getNext](gearjoint.md#getnext)
* [getRatio](gearjoint.md#getratio)
* [getReactionForce](gearjoint.md#getreactionforce)
* [getReactionTorque](gearjoint.md#getreactiontorque)
* [getType](gearjoint.md#gettype)
* [getUserData](gearjoint.md#getuserdata)
* [initVelocityConstraints](gearjoint.md#initvelocityconstraints)
* [isActive](gearjoint.md#isactive)
* [setRatio](gearjoint.md#setratio)
* [setUserData](gearjoint.md#setuserdata)
* [shiftOrigin](gearjoint.md#shiftorigin)
* [solvePositionConstraints](gearjoint.md#solvepositionconstraints)
* [solveVelocityConstraints](gearjoint.md#solvevelocityconstraints)
## Constructors
### constructor
\+ **new GearJoint**(`def`: [GearJointDef](../interfaces/gearjointdef.md)): *[GearJoint](gearjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/GearJoint.ts:122](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L122)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [GearJointDef](../interfaces/gearjointdef.md) |
**Returns:** *[GearJoint](gearjoint.md)*
\+ **new GearJoint**(`def`: [GearJointOpt](../interfaces/gearjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `joint1`: [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md), `joint2`: [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md), `ratio?`: number): *[GearJoint](gearjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/GearJoint.ts:124](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L124)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [GearJointOpt](../interfaces/gearjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`joint1` | [RevoluteJoint](revolutejoint.md) &#124; [PrismaticJoint](prismaticjoint.md) |
`joint2` | [RevoluteJoint](revolutejoint.md) &#124; [PrismaticJoint](prismaticjoint.md) |
`ratio?` | number |
**Returns:** *[GearJoint](gearjoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"gear-joint"* = 'gear-joint' as 'gear-joint'
*Defined in [src/dynamics/joint/GearJoint.ts:82](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L82)*
## Methods
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
*Defined in [src/dynamics/joint/GearJoint.ts:302](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L302)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
*Defined in [src/dynamics/joint/GearJoint.ts:309](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L309)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getJoint1
▸ **getJoint1**(): *[Joint](joint.md)*
*Defined in [src/dynamics/joint/GearJoint.ts:273](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L273)*
Get the first joint.
**Returns:** *[Joint](joint.md)*
___
### getJoint2
▸ **getJoint2**(): *[Joint](joint.md)*
*Defined in [src/dynamics/joint/GearJoint.ts:280](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L280)*
Get the second joint.
**Returns:** *[Joint](joint.md)*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### getRatio
▸ **getRatio**(): *number*
*Defined in [src/dynamics/joint/GearJoint.ts:295](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L295)*
Get the gear ratio.
**Returns:** *number*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
*Defined in [src/dynamics/joint/GearJoint.ts:316](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L316)*
Get the reaction force on bodyB at the joint anchor in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
*Defined in [src/dynamics/joint/GearJoint.ts:323](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L323)*
Get the reaction torque on bodyB in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUserData
▸ **getUserData**(): *unknown*
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
*Defined in [src/dynamics/joint/GearJoint.ts:328](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L328)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### setRatio
▸ **setRatio**(`ratio`: number): *void*
*Defined in [src/dynamics/joint/GearJoint.ts:287](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L287)*
Set the gear ratio.
**Parameters:**
Name | Type |
------ | ------ |
`ratio` | number |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Inherited from [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
*Defined in [src/dynamics/Joint.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L217)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
*Defined in [src/dynamics/joint/GearJoint.ts:465](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L465)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
*Defined in [src/dynamics/joint/GearJoint.ts:425](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L425)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,76 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Iterator](iterator.md)
# Class: Iterator ‹**T**›
## Type parameters
▪ **T**
## Hierarchy
* **Iterator**
## Index
### Properties
* [parents](iterator.md#parents)
* [states](iterator.md#states)
### Methods
* [close](iterator.md#close)
* [next](iterator.md#next)
* [preorder](iterator.md#preorder)
## Properties
### parents
• **parents**: *Array‹[TreeNode](treenode.md)‹T››* = []
*Defined in [src/collision/DynamicTree.ts:889](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L889)*
___
### states
• **states**: *number[]* = []
*Defined in [src/collision/DynamicTree.ts:890](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L890)*
## Methods
### close
▸ **close**(): *void*
*Defined in [src/collision/DynamicTree.ts:926](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L926)*
**Returns:** *void*
___
### next
▸ **next**(): *[TreeNode](treenode.md)‹T›*
*Defined in [src/collision/DynamicTree.ts:898](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L898)*
**Returns:** *[TreeNode](treenode.md)‹T›*
___
### preorder
▸ **preorder**(`root`: [TreeNode](treenode.md)‹T›): *[Iterator](iterator.md)‹T›*
*Defined in [src/collision/DynamicTree.ts:891](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L891)*
**Parameters:**
Name | Type |
------ | ------ |
`root` | [TreeNode](treenode.md)‹T› |
**Returns:** *[Iterator](iterator.md)‹T›*

View File

@ -1,39 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Jacobian](jacobian.md)
# Class: Jacobian
## Hierarchy
* **Jacobian**
## Index
### Properties
* [angularA](jacobian.md#angulara)
* [angularB](jacobian.md#angularb)
* [linear](jacobian.md#linear)
## Properties
### angularA
• **angularA**: *number*
*Defined in [src/common/Jacobian.ts:29](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Jacobian.ts#L29)*
___
### angularB
• **angularB**: *number*
*Defined in [src/common/Jacobian.ts:30](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Jacobian.ts#L30)*
___
### linear
• **linear**: *[Vec2](vec2.md)*
*Defined in [src/common/Jacobian.ts:28](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Jacobian.ts#L28)*

View File

@ -1,315 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Joint](joint.md)
# Class: Joint
The base joint class. Joints are used to constraint two bodies together in
various fashions. Some joints also feature limits and motors.
## Hierarchy
* **Joint**
↳ [DistanceJoint](distancejoint.md)
↳ [FrictionJoint](frictionjoint.md)
↳ [RevoluteJoint](revolutejoint.md)
↳ [PrismaticJoint](prismaticjoint.md)
↳ [GearJoint](gearjoint.md)
↳ [MotorJoint](motorjoint.md)
↳ [MouseJoint](mousejoint.md)
↳ [PulleyJoint](pulleyjoint.md)
↳ [RopeJoint](ropejoint.md)
↳ [WeldJoint](weldjoint.md)
↳ [WheelJoint](wheeljoint.md)
## Index
### Constructors
* [constructor](joint.md#constructor)
### Methods
* [getAnchorA](joint.md#abstract-getanchora)
* [getAnchorB](joint.md#abstract-getanchorb)
* [getBodyA](joint.md#getbodya)
* [getBodyB](joint.md#getbodyb)
* [getCollideConnected](joint.md#getcollideconnected)
* [getNext](joint.md#getnext)
* [getReactionForce](joint.md#abstract-getreactionforce)
* [getReactionTorque](joint.md#abstract-getreactiontorque)
* [getType](joint.md#gettype)
* [getUserData](joint.md#getuserdata)
* [initVelocityConstraints](joint.md#abstract-initvelocityconstraints)
* [isActive](joint.md#isactive)
* [setUserData](joint.md#setuserdata)
* [shiftOrigin](joint.md#shiftorigin)
* [solvePositionConstraints](joint.md#abstract-solvepositionconstraints)
* [solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)
## Constructors
### constructor
\+ **new Joint**(`def`: [JointDef](../interfaces/jointdef.md)): *[Joint](joint.md)*
*Defined in [src/dynamics/Joint.ts:110](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L110)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [JointDef](../interfaces/jointdef.md) |
**Returns:** *[Joint](joint.md)*
\+ **new Joint**(`def`: [JointOpt](../interfaces/jointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md)): *[Joint](joint.md)*
*Defined in [src/dynamics/Joint.ts:112](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L112)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [JointOpt](../interfaces/jointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
**Returns:** *[Joint](joint.md)*
## Methods
### `Abstract` getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/Joint.ts:197](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L197)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### `Abstract` getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/Joint.ts:202](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L202)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### `Abstract` getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Defined in [src/dynamics/Joint.ts:207](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L207)*
Get the reaction force on bodyB at the joint anchor in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### `Abstract` getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Defined in [src/dynamics/Joint.ts:212](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L212)*
Get the reaction torque on bodyB in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUserData
▸ **getUserData**(): *unknown*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### `Abstract` initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Joint.ts:219](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L219)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Defined in [src/dynamics/Joint.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L217)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### `Abstract` solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Defined in [src/dynamics/Joint.ts:226](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L226)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### `Abstract` solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Joint.ts:221](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L221)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,61 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [JointEdge](jointedge.md)
# Class: JointEdge
A joint edge is used to connect bodies and joints together in a joint graph
where each body is a node and each joint is an edge. A joint edge belongs to
a doubly linked list maintained in each attached body. Each joint has two
joint nodes, one for each attached body.
## Hierarchy
* **JointEdge**
## Index
### Properties
* [joint](jointedge.md#joint)
* [next](jointedge.md#next)
* [other](jointedge.md#other)
* [prev](jointedge.md#prev)
## Properties
### joint
• **joint**: *[Joint](joint.md)‹›* = null as Joint | null
*Defined in [src/dynamics/Joint.ts:46](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L46)*
the joint
___
### next
• **next**: *[JointEdge](jointedge.md)‹›* = null as JointEdge | null
*Defined in [src/dynamics/Joint.ts:54](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L54)*
the next joint edge in the body's joint list
___
### other
• **other**: *[Body](body.md)‹›* = null as Body | null
*Defined in [src/dynamics/Joint.ts:42](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L42)*
provides quick access to the other body attached.
___
### prev
• **prev**: *[JointEdge](jointedge.md)‹›* = null as JointEdge | null
*Defined in [src/dynamics/Joint.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L50)*
prev the previous joint edge in the body's joint list

View File

@ -1,112 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Manifold](manifold.md)
# Class: Manifold
A manifold for two touching convex shapes. Manifolds are created in `evaluate`
method of Contact subclasses.
Supported manifold types are e_faceA or e_faceB for clip point versus plane
with radius and e_circles point versus point with radius.
We store contacts in this way so that position correction can account for
movement, which is critical for continuous physics. All contact scenarios
must be expressed in one of these types. This structure is stored across time
steps, so we keep it small.
**`prop`** type e_circle, e_faceA, e_faceB
**`prop`** localPoint Usage depends on manifold type:<br>
e_circles: the local center of circleA <br>
e_faceA: the center of faceA <br>
e_faceB: the center of faceB
**`prop`** localNormal Usage depends on manifold type:<br>
e_circles: not used <br>
e_faceA: the normal on polygonA <br>
e_faceB: the normal on polygonB
**`prop`** points The points of contact {ManifoldPoint[]}
**`prop`** pointCount The number of manifold points
## Hierarchy
* **Manifold**
## Index
### Properties
* [localNormal](manifold.md#localnormal)
* [localPoint](manifold.md#localpoint)
* [pointCount](manifold.md#pointcount)
* [points](manifold.md#points)
* [type](manifold.md#type)
### Methods
* [getWorldManifold](manifold.md#getworldmanifold)
## Properties
### localNormal
• **localNormal**: *[Vec2](vec2.md)* = Vec2.zero()
*Defined in [src/collision/Manifold.ts:67](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L67)*
___
### localPoint
• **localPoint**: *[Vec2](vec2.md)* = Vec2.zero()
*Defined in [src/collision/Manifold.ts:68](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L68)*
___
### pointCount
• **pointCount**: *number* = 0
*Defined in [src/collision/Manifold.ts:70](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L70)*
___
### points
• **points**: *[ManifoldPoint](manifoldpoint.md)[]* = [ new ManifoldPoint(), new ManifoldPoint() ]
*Defined in [src/collision/Manifold.ts:69](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L69)*
___
### type
• **type**: *[ManifoldType](../enums/manifoldtype.md)*
*Defined in [src/collision/Manifold.ts:66](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L66)*
## Methods
### getWorldManifold
▸ **getWorldManifold**(`wm`: [WorldManifold](worldmanifold.md) | undefined, `xfA`: [Transform](transform.md), `radiusA`: number, `xfB`: [Transform](transform.md), `radiusB`: number): *[WorldManifold](worldmanifold.md)*
*Defined in [src/collision/Manifold.ts:77](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L77)*
Evaluate the manifold with supplied transforms. This assumes modest motion
from the original state. This does not change the point count, impulses, etc.
The radii must come from the shapes that generated the manifold.
**Parameters:**
Name | Type |
------ | ------ |
`wm` | [WorldManifold](worldmanifold.md) &#124; undefined |
`xfA` | [Transform](transform.md) |
`radiusA` | number |
`xfB` | [Transform](transform.md) |
`radiusB` | number |
**Returns:** *[WorldManifold](worldmanifold.md)*

View File

@ -1,67 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ManifoldPoint](manifoldpoint.md)
# Class: ManifoldPoint
A manifold point is a contact point belonging to a contact manifold. It holds
details related to the geometry and dynamics of the contact points.
This structure is stored across time steps, so we keep it small.
Note: impulses are used for internal caching and may not provide reliable
contact forces, especially for high speed collisions.
## Hierarchy
* **ManifoldPoint**
## Index
### Properties
* [id](manifoldpoint.md#id)
* [localPoint](manifoldpoint.md#localpoint)
* [normalImpulse](manifoldpoint.md#normalimpulse)
* [tangentImpulse](manifoldpoint.md#tangentimpulse)
## Properties
### id
• **id**: *[ContactID](contactid.md)‹›* = new ContactID()
*Defined in [src/collision/Manifold.ts:178](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L178)*
Uniquely identifies a contact point between two shapes to facilatate warm starting
___
### localPoint
• **localPoint**: *[Vec2](vec2.md)‹›* = Vec2.zero()
*Defined in [src/collision/Manifold.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L166)*
Usage depends on manifold type.
e_circles: the local center of circleB,
e_faceA: the local center of cirlceB or the clip point of polygonB,
e_faceB: the clip point of polygonA.
___
### normalImpulse
• **normalImpulse**: *number* = 0
*Defined in [src/collision/Manifold.ts:170](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L170)*
The non-penetration impulse
___
### tangentImpulse
• **tangentImpulse**: *number* = 0
*Defined in [src/collision/Manifold.ts:174](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L174)*
The friction impulse

View File

@ -1,47 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [MassData](massdata.md)
# Class: MassData
MassData This holds the mass data computed for a shape.
## Hierarchy
* **MassData**
## Index
### Properties
* [I](massdata.md#i)
* [center](massdata.md#center)
* [mass](massdata.md#mass)
## Properties
### I
• **I**: *number* = 0
*Defined in [src/dynamics/Body.ts:140](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Body.ts#L140)*
The rotational inertia of the shape about the local origin.
___
### center
• **center**: *[Vec2](vec2.md)‹›* = Vec2.zero()
*Defined in [src/dynamics/Body.ts:138](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Body.ts#L138)*
The position of the shape's centroid relative to the shape's origin.
___
### mass
• **mass**: *number* = 0
*Defined in [src/dynamics/Body.ts:136](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Body.ts#L136)*
The mass of the shape, usually in kilograms.

View File

@ -1,405 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Mat22](mat22.md)
# Class: Mat22
A 2-by-2 matrix. Stored in column-major order.
## Hierarchy
* **Mat22**
## Index
### Constructors
* [constructor](mat22.md#constructor)
### Properties
* [ex](mat22.md#ex)
* [ey](mat22.md#ey)
### Methods
* [getInverse](mat22.md#getinverse)
* [set](mat22.md#set)
* [setIdentity](mat22.md#setidentity)
* [setZero](mat22.md#setzero)
* [solve](mat22.md#solve)
* [toString](mat22.md#tostring)
* [abs](mat22.md#static-abs)
* [add](mat22.md#static-add)
* [assert](mat22.md#static-assert)
* [isValid](mat22.md#static-isvalid)
* [mul](mat22.md#static-mul)
* [mulMat22](mat22.md#static-mulmat22)
* [mulT](mat22.md#static-mult)
* [mulTMat22](mat22.md#static-multmat22)
* [mulTVec2](mat22.md#static-multvec2)
* [mulVec2](mat22.md#static-mulvec2)
## Constructors
### constructor
\+ **new Mat22**(`a`: number, `b`: number, `c`: number, `d`: number): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L38)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`b` | number |
`c` | number |
`d` | number |
**Returns:** *[Mat22](mat22.md)*
\+ **new Mat22**(`a`: object, `b`: object): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:40](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L40)*
**Parameters:**
▪ **a**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
▪ **b**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Mat22](mat22.md)*
\+ **new Mat22**(): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:41](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L41)*
**Returns:** *[Mat22](mat22.md)*
## Properties
### ex
• **ex**: *[Vec2](vec2.md)*
*Defined in [src/common/Mat22.ts:37](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L37)*
___
### ey
• **ey**: *[Vec2](vec2.md)*
*Defined in [src/common/Mat22.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L38)*
## Methods
### getInverse
▸ **getInverse**(): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:111](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L111)*
**Returns:** *[Mat22](mat22.md)*
___
### set
▸ **set**(`a`: [Mat22](mat22.md)): *void*
*Defined in [src/common/Mat22.ts:73](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L73)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat22](mat22.md) |
**Returns:** *void*
▸ **set**(`a`: [Vec2](vec2.md), `b`: [Vec2](vec2.md)): *void*
*Defined in [src/common/Mat22.ts:74](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L74)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *void*
▸ **set**(`a`: number, `b`: number, `c`: number, `d`: number): *void*
*Defined in [src/common/Mat22.ts:75](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L75)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`b` | number |
`c` | number |
`d` | number |
**Returns:** *void*
___
### setIdentity
▸ **setIdentity**(): *void*
*Defined in [src/common/Mat22.ts:97](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L97)*
**Returns:** *void*
___
### setZero
▸ **setZero**(): *void*
*Defined in [src/common/Mat22.ts:104](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L104)*
**Returns:** *void*
___
### solve
▸ **solve**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Mat22.ts:132](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L132)*
Solve A * x = b, where b is a column vector. This is more efficient than
computing the inverse in one-shot cases.
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### toString
▸ **toString**(): *string*
*Defined in [src/common/Mat22.ts:57](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L57)*
**Returns:** *string*
___
### `Static` abs
▸ **abs**(`mx`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:229](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L229)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
___
### `Static` add
▸ **add**(`mx1`: [Mat22](mat22.md), `mx2`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:234](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L234)*
**Parameters:**
Name | Type |
------ | ------ |
`mx1` | [Mat22](mat22.md) |
`mx2` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [src/common/Mat22.ts:65](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L65)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` isValid
▸ **isValid**(`o`: any): *boolean*
*Defined in [src/common/Mat22.ts:61](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L61)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *boolean*
___
### `Static` mul
▸ **mul**(`mx`: [Mat22](mat22.md), `my`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L152)*
Multiply a matrix times a vector. If a rotation matrix is provided, then this
transforms the vector from one frame to another.
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`my` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
▸ **mul**(`mx`: [Mat22](mat22.md), `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Mat22.ts:153](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L153)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulMat22
▸ **mulMat22**(`mx`: [Mat22](mat22.md), `v`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:182](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L182)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`v` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
___
### `Static` mulT
▸ **mulT**(`mx`: [Mat22](mat22.md), `my`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:197](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L197)*
Multiply a matrix transpose times a vector. If a rotation matrix is provided,
then this transforms the vector from one frame to another (inverse
transform).
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`my` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
▸ **mulT**(`mx`: [Mat22](mat22.md), `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Mat22.ts:198](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L198)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulTMat22
▸ **mulTMat22**(`mx`: [Mat22](mat22.md), `v`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [src/common/Mat22.ts:221](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L221)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`v` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
___
### `Static` mulTVec2
▸ **mulTVec2**(`mx`: [Mat22](mat22.md), `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Mat22.ts:215](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L215)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulVec2
▸ **mulVec2**(`mx`: [Mat22](mat22.md), `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Mat22.ts:175](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat22.ts#L175)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*

View File

@ -1,298 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Mat33](mat33.md)
# Class: Mat33
A 3-by-3 matrix. Stored in column-major order.
## Hierarchy
* **Mat33**
## Index
### Constructors
* [constructor](mat33.md#constructor)
### Properties
* [ex](mat33.md#ex)
* [ey](mat33.md#ey)
* [ez](mat33.md#ez)
### Methods
* [getInverse22](mat33.md#getinverse22)
* [getSymInverse33](mat33.md#getsyminverse33)
* [setZero](mat33.md#setzero)
* [solve22](mat33.md#solve22)
* [solve33](mat33.md#solve33)
* [toString](mat33.md#tostring)
* [add](mat33.md#static-add)
* [assert](mat33.md#static-assert)
* [isValid](mat33.md#static-isvalid)
* [mul](mat33.md#static-mul)
* [mulVec2](mat33.md#static-mulvec2)
* [mulVec3](mat33.md#static-mulvec3)
## Constructors
### constructor
\+ **new Mat33**(`a`: [Vec3](vec3.md), `b`: [Vec3](vec3.md), `c`: [Vec3](vec3.md)): *[Mat33](mat33.md)*
*Defined in [src/common/Mat33.ts:40](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L40)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec3](vec3.md) |
`b` | [Vec3](vec3.md) |
`c` | [Vec3](vec3.md) |
**Returns:** *[Mat33](mat33.md)*
\+ **new Mat33**(): *[Mat33](mat33.md)*
*Defined in [src/common/Mat33.ts:42](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L42)*
**Returns:** *[Mat33](mat33.md)*
## Properties
### ex
• **ex**: *[Vec3](vec3.md)*
*Defined in [src/common/Mat33.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L38)*
___
### ey
• **ey**: *[Vec3](vec3.md)*
*Defined in [src/common/Mat33.ts:39](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L39)*
___
### ez
• **ez**: *[Vec3](vec3.md)*
*Defined in [src/common/Mat33.ts:40](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L40)*
## Methods
### getInverse22
▸ **getInverse22**(`M`: [Mat33](mat33.md)): *void*
*Defined in [src/common/Mat33.ts:122](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L122)*
Get the inverse of this matrix as a 2-by-2. Returns the zero matrix if
singular.
**Parameters:**
Name | Type |
------ | ------ |
`M` | [Mat33](mat33.md) |
**Returns:** *void*
___
### getSymInverse33
▸ **getSymInverse33**(`M`: [Mat33](mat33.md)): *void*
*Defined in [src/common/Mat33.ts:146](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L146)*
Get the symmetric inverse of this matrix as a 3-by-3. Returns the zero matrix
if singular.
**Parameters:**
Name | Type |
------ | ------ |
`M` | [Mat33](mat33.md) |
**Returns:** *void*
___
### setZero
▸ **setZero**(): *[Mat33](mat33.md)*
*Defined in [src/common/Mat33.ts:75](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L75)*
Set this matrix to all zeros.
**Returns:** *[Mat33](mat33.md)*
___
### solve22
▸ **solve22**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Mat33.ts:103](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L103)*
Solve A * x = b, where b is a column vector. This is more efficient than
computing the inverse in one-shot cases. Solve only the upper 2-by-2 matrix
equation.
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### solve33
▸ **solve33**(`v`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Mat33.ts:86](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L86)*
Solve A * x = b, where b is a column vector. This is more efficient than
computing the inverse in one-shot cases.
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### toString
▸ **toString**(): *string*
*Defined in [src/common/Mat33.ts:56](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L56)*
**Returns:** *string*
___
### `Static` add
▸ **add**(`a`: [Mat33](mat33.md), `b`: [Mat33](mat33.md)): *[Mat33](mat33.md)*
*Defined in [src/common/Mat33.ts:213](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L213)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Mat33](mat33.md) |
**Returns:** *[Mat33](mat33.md)*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [src/common/Mat33.ts:64](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L64)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` isValid
▸ **isValid**(`o`: any): *boolean*
*Defined in [src/common/Mat33.ts:60](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L60)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *boolean*
___
### `Static` mul
▸ **mul**(`a`: [Mat33](mat33.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Mat33.ts:174](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L174)*
Multiply a matrix times a vector.
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
▸ **mul**(`a`: [Mat33](mat33.md), `b`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Mat33.ts:175](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L175)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` mulVec2
▸ **mulVec2**(`a`: [Mat33](mat33.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Mat33.ts:205](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L205)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulVec3
▸ **mulVec3**(`a`: [Mat33](mat33.md), `b`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Mat33.ts:196](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Mat33.ts#L196)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*

View File

@ -1,500 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [MotorJoint](motorjoint.md)
# Class: MotorJoint
A motor joint is used to control the relative motion between two bodies. A
typical usage is to control the movement of a dynamic body with respect to
the ground.
## Hierarchy
* [Joint](joint.md)
↳ **MotorJoint**
## Index
### Constructors
* [constructor](motorjoint.md#constructor)
### Properties
* [TYPE](motorjoint.md#static-type)
### Methods
* [getAnchorA](motorjoint.md#getanchora)
* [getAnchorB](motorjoint.md#getanchorb)
* [getAngularOffset](motorjoint.md#getangularoffset)
* [getBodyA](motorjoint.md#getbodya)
* [getBodyB](motorjoint.md#getbodyb)
* [getCollideConnected](motorjoint.md#getcollideconnected)
* [getCorrectionFactor](motorjoint.md#getcorrectionfactor)
* [getLinearOffset](motorjoint.md#getlinearoffset)
* [getMaxForce](motorjoint.md#getmaxforce)
* [getMaxTorque](motorjoint.md#getmaxtorque)
* [getNext](motorjoint.md#getnext)
* [getReactionForce](motorjoint.md#getreactionforce)
* [getReactionTorque](motorjoint.md#getreactiontorque)
* [getType](motorjoint.md#gettype)
* [getUserData](motorjoint.md#getuserdata)
* [initVelocityConstraints](motorjoint.md#initvelocityconstraints)
* [isActive](motorjoint.md#isactive)
* [setAngularOffset](motorjoint.md#setangularoffset)
* [setCorrectionFactor](motorjoint.md#setcorrectionfactor)
* [setLinearOffset](motorjoint.md#setlinearoffset)
* [setMaxForce](motorjoint.md#setmaxforce)
* [setMaxTorque](motorjoint.md#setmaxtorque)
* [setUserData](motorjoint.md#setuserdata)
* [shiftOrigin](motorjoint.md#shiftorigin)
* [solvePositionConstraints](motorjoint.md#solvepositionconstraints)
* [solveVelocityConstraints](motorjoint.md#solvevelocityconstraints)
## Constructors
### constructor
\+ **new MotorJoint**(`def`: [MotorJointDef](../interfaces/motorjointdef.md)): *[MotorJoint](motorjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/MotorJoint.ts:104](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L104)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MotorJointDef](../interfaces/motorjointdef.md) |
**Returns:** *[MotorJoint](motorjoint.md)*
\+ **new MotorJoint**(`def`: [MotorJointOpt](../interfaces/motorjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md)): *[MotorJoint](motorjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/MotorJoint.ts:106](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L106)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MotorJointOpt](../interfaces/motorjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
**Returns:** *[MotorJoint](motorjoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"motor-joint"* = 'motor-joint' as 'motor-joint'
*Defined in [src/dynamics/joint/MotorJoint.ts:82](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L82)*
## Methods
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
*Defined in [src/dynamics/joint/MotorJoint.ts:254](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L254)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
*Defined in [src/dynamics/joint/MotorJoint.ts:261](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L261)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAngularOffset
▸ **getAngularOffset**(): *number*
*Defined in [src/dynamics/joint/MotorJoint.ts:247](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L247)*
**Returns:** *number*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getCorrectionFactor
▸ **getCorrectionFactor**(): *number*
*Defined in [src/dynamics/joint/MotorJoint.ts:216](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L216)*
Get the position correction factor in the range [0,1].
**Returns:** *number*
___
### getLinearOffset
▸ **getLinearOffset**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/MotorJoint.ts:232](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L232)*
**Returns:** *[Vec2](vec2.md)*
___
### getMaxForce
▸ **getMaxForce**(): *number*
*Defined in [src/dynamics/joint/MotorJoint.ts:186](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L186)*
Get the maximum friction force in N.
**Returns:** *number*
___
### getMaxTorque
▸ **getMaxTorque**(): *number*
*Defined in [src/dynamics/joint/MotorJoint.ts:201](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L201)*
Get the maximum friction torque in N*m.
**Returns:** *number*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
*Defined in [src/dynamics/joint/MotorJoint.ts:268](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L268)*
Get the reaction force on bodyB at the joint anchor in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
*Defined in [src/dynamics/joint/MotorJoint.ts:275](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L275)*
Get the reaction torque on bodyB in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUserData
▸ **getUserData**(): *unknown*
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
*Defined in [src/dynamics/joint/MotorJoint.ts:279](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L279)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### setAngularOffset
▸ **setAngularOffset**(`angularOffset`: number): *void*
*Defined in [src/dynamics/joint/MotorJoint.ts:239](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L239)*
Set/get the target angular offset, in radians.
**Parameters:**
Name | Type |
------ | ------ |
`angularOffset` | number |
**Returns:** *void*
___
### setCorrectionFactor
▸ **setCorrectionFactor**(`factor`: number): *void*
*Defined in [src/dynamics/joint/MotorJoint.ts:208](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L208)*
Set the position correction factor in the range [0,1].
**Parameters:**
Name | Type |
------ | ------ |
`factor` | number |
**Returns:** *void*
___
### setLinearOffset
▸ **setLinearOffset**(`linearOffset`: [Vec2](vec2.md)): *void*
*Defined in [src/dynamics/joint/MotorJoint.ts:223](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L223)*
Set/get the target linear offset, in frame A, in meters.
**Parameters:**
Name | Type |
------ | ------ |
`linearOffset` | [Vec2](vec2.md) |
**Returns:** *void*
___
### setMaxForce
▸ **setMaxForce**(`force`: number): *void*
*Defined in [src/dynamics/joint/MotorJoint.ts:178](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L178)*
Set the maximum friction force in N.
**Parameters:**
Name | Type |
------ | ------ |
`force` | number |
**Returns:** *void*
___
### setMaxTorque
▸ **setMaxTorque**(`torque`: number): *void*
*Defined in [src/dynamics/joint/MotorJoint.ts:193](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L193)*
Set the maximum friction torque in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`torque` | number |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Inherited from [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
*Defined in [src/dynamics/Joint.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L217)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
*Defined in [src/dynamics/joint/MotorJoint.ts:424](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L424)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
*Defined in [src/dynamics/joint/MotorJoint.ts:362](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MotorJoint.ts#L362)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,475 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [MouseJoint](mousejoint.md)
# Class: MouseJoint
A mouse joint is used to make a point on a body track a specified world
point. This a soft constraint with a maximum force. This allows the
constraint to stretch and without applying huge forces.
NOTE: this joint is not documented in the manual because it was developed to
be used in the testbed. If you want to learn how to use the mouse joint, look
at the testbed.
## Hierarchy
* [Joint](joint.md)
↳ **MouseJoint**
## Index
### Constructors
* [constructor](mousejoint.md#constructor)
### Properties
* [TYPE](mousejoint.md#static-type)
### Methods
* [getAnchorA](mousejoint.md#getanchora)
* [getAnchorB](mousejoint.md#getanchorb)
* [getBodyA](mousejoint.md#getbodya)
* [getBodyB](mousejoint.md#getbodyb)
* [getCollideConnected](mousejoint.md#getcollideconnected)
* [getDampingRatio](mousejoint.md#getdampingratio)
* [getFrequency](mousejoint.md#getfrequency)
* [getMaxForce](mousejoint.md#getmaxforce)
* [getNext](mousejoint.md#getnext)
* [getReactionForce](mousejoint.md#getreactionforce)
* [getReactionTorque](mousejoint.md#getreactiontorque)
* [getTarget](mousejoint.md#gettarget)
* [getType](mousejoint.md#gettype)
* [getUserData](mousejoint.md#getuserdata)
* [initVelocityConstraints](mousejoint.md#initvelocityconstraints)
* [isActive](mousejoint.md#isactive)
* [setDampingRatio](mousejoint.md#setdampingratio)
* [setFrequency](mousejoint.md#setfrequency)
* [setMaxForce](mousejoint.md#setmaxforce)
* [setTarget](mousejoint.md#settarget)
* [setUserData](mousejoint.md#setuserdata)
* [shiftOrigin](mousejoint.md#shiftorigin)
* [solvePositionConstraints](mousejoint.md#solvepositionconstraints)
* [solveVelocityConstraints](mousejoint.md#solvevelocityconstraints)
## Constructors
### constructor
\+ **new MouseJoint**(`def`: [MouseJointDef](../interfaces/mousejointdef.md)): *[MouseJoint](mousejoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/MouseJoint.ts:106](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L106)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MouseJointDef](../interfaces/mousejointdef.md) |
**Returns:** *[MouseJoint](mousejoint.md)*
\+ **new MouseJoint**(`def`: [MouseJointOpt](../interfaces/mousejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `target`: [Vec2](vec2.md)): *[MouseJoint](mousejoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/MouseJoint.ts:108](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L108)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MouseJointOpt](../interfaces/mousejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`target` | [Vec2](vec2.md) |
**Returns:** *[MouseJoint](mousejoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"mouse-joint"* = 'mouse-joint' as 'mouse-joint'
*Defined in [src/dynamics/joint/MouseJoint.ts:89](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L89)*
## Methods
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
*Defined in [src/dynamics/joint/MouseJoint.ts:246](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L246)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
*Defined in [src/dynamics/joint/MouseJoint.ts:253](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L253)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getDampingRatio
▸ **getDampingRatio**(): *number*
*Defined in [src/dynamics/joint/MouseJoint.ts:239](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L239)*
Get the damping ratio (dimensionless).
**Returns:** *number*
___
### getFrequency
▸ **getFrequency**(): *number*
*Defined in [src/dynamics/joint/MouseJoint.ts:225](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L225)*
Get the frequency in Hertz.
**Returns:** *number*
___
### getMaxForce
▸ **getMaxForce**(): *number*
*Defined in [src/dynamics/joint/MouseJoint.ts:211](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L211)*
Get the maximum force in Newtons.
**Returns:** *number*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
*Defined in [src/dynamics/joint/MouseJoint.ts:260](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L260)*
Get the reaction force on bodyB at the joint anchor in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
*Defined in [src/dynamics/joint/MouseJoint.ts:267](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L267)*
Get the reaction torque on bodyB in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getTarget
▸ **getTarget**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/MouseJoint.ts:197](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L197)*
**Returns:** *[Vec2](vec2.md)*
___
### getType
▸ **getType**(): *string*
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUserData
▸ **getUserData**(): *unknown*
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
*Defined in [src/dynamics/joint/MouseJoint.ts:278](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L278)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### setDampingRatio
▸ **setDampingRatio**(`ratio`: number): *void*
*Defined in [src/dynamics/joint/MouseJoint.ts:232](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L232)*
Set the damping ratio (dimensionless).
**Parameters:**
Name | Type |
------ | ------ |
`ratio` | number |
**Returns:** *void*
___
### setFrequency
▸ **setFrequency**(`hz`: number): *void*
*Defined in [src/dynamics/joint/MouseJoint.ts:218](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L218)*
Set the frequency in Hertz.
**Parameters:**
Name | Type |
------ | ------ |
`hz` | number |
**Returns:** *void*
___
### setMaxForce
▸ **setMaxForce**(`force`: number): *void*
*Defined in [src/dynamics/joint/MouseJoint.ts:204](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L204)*
Set the maximum force in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`force` | number |
**Returns:** *void*
___
### setTarget
▸ **setTarget**(`target`: [Vec2](vec2.md)): *void*
*Defined in [src/dynamics/joint/MouseJoint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L190)*
Use this to update the target point.
**Parameters:**
Name | Type |
------ | ------ |
`target` | [Vec2](vec2.md) |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Overrides [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
*Defined in [src/dynamics/joint/MouseJoint.ts:274](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L274)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
*Defined in [src/dynamics/joint/MouseJoint.ts:384](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L384)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
*Defined in [src/dynamics/joint/MouseJoint.ts:353](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/MouseJoint.ts#L353)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,321 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [PolygonShape](polygonshape.md)
# Class: PolygonShape
A convex polygon. It is assumed that the interior of the polygon is to the
left of each edge. Polygons have a maximum number of vertices equal to
Settings.maxPolygonVertices. In most cases you should not need many vertices
for a convex polygon. extends Shape
## Hierarchy
* [Shape](shape.md)
↳ **PolygonShape**
↳ [BoxShape](boxshape.md)
## Index
### Constructors
* [constructor](polygonshape.md#constructor)
### Properties
* [m_centroid](polygonshape.md#m_centroid)
* [m_count](polygonshape.md#m_count)
* [m_normals](polygonshape.md#m_normals)
* [m_radius](polygonshape.md#m_radius)
* [m_type](polygonshape.md#m_type)
* [m_vertices](polygonshape.md#m_vertices)
* [TYPE](polygonshape.md#static-type)
### Methods
* [computeAABB](polygonshape.md#computeaabb)
* [computeDistanceProxy](polygonshape.md#computedistanceproxy)
* [computeMass](polygonshape.md#computemass)
* [getChildCount](polygonshape.md#getchildcount)
* [getRadius](polygonshape.md#getradius)
* [getType](polygonshape.md#gettype)
* [getVertex](polygonshape.md#getvertex)
* [rayCast](polygonshape.md#raycast)
* [testPoint](polygonshape.md#testpoint)
* [validate](polygonshape.md#validate)
* [isValid](polygonshape.md#static-isvalid)
## Constructors
### constructor
\+ **new PolygonShape**(`vertices?`: [Vec2](vec2.md)[]): *[PolygonShape](polygonshape.md)*
*Defined in [src/collision/shape/PolygonShape.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L52)*
**Parameters:**
Name | Type |
------ | ------ |
`vertices?` | [Vec2](vec2.md)[] |
**Returns:** *[PolygonShape](polygonshape.md)*
## Properties
### m_centroid
• **m_centroid**: *[Vec2](vec2.md)*
*Defined in [src/collision/shape/PolygonShape.ts:49](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L49)*
___
### m_count
• **m_count**: *number*
*Defined in [src/collision/shape/PolygonShape.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L52)*
___
### m_normals
• **m_normals**: *[Vec2](vec2.md)[]*
*Defined in [src/collision/shape/PolygonShape.ts:51](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L51)*
___
### m_radius
• **m_radius**: *number*
*Inherited from [Shape](shape.md).[m_radius](shape.md#m_radius)*
*Defined in [src/collision/Shape.ts:39](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L39)*
___
### m_type
• **m_type**: *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[m_type](shape.md#m_type)*
*Defined in [src/collision/Shape.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L38)*
___
### m_vertices
• **m_vertices**: *[Vec2](vec2.md)[]*
*Defined in [src/collision/shape/PolygonShape.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L50)*
___
### `Static` TYPE
▪ **TYPE**: *"polygon"* = 'polygon' as 'polygon'
*Defined in [src/collision/shape/PolygonShape.ts:47](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L47)*
## Methods
### computeAABB
▸ **computeAABB**(`aabb`: [AABB](aabb.md), `xf`: [Transform](transform.md), `childIndex`: number): *void*
*Overrides [Shape](shape.md).[computeAABB](shape.md#abstract-computeaabb)*
*Defined in [src/collision/shape/PolygonShape.ts:388](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L388)*
Given a transform, compute the associated axis aligned bounding box for a
child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`aabb` | [AABB](aabb.md) | Returns the axis aligned box. |
`xf` | [Transform](transform.md) | The world transform of the shape. |
`childIndex` | number | The child shape |
**Returns:** *void*
___
### computeDistanceProxy
▸ **computeDistanceProxy**(`proxy`: [DistanceProxy](distanceproxy.md)): *void*
*Overrides [Shape](shape.md).[computeDistanceProxy](shape.md#abstract-computedistanceproxy)*
*Defined in [src/collision/shape/PolygonShape.ts:522](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L522)*
**Parameters:**
Name | Type |
------ | ------ |
`proxy` | [DistanceProxy](distanceproxy.md) |
**Returns:** *void*
___
### computeMass
▸ **computeMass**(`massData`: [MassData](massdata.md), `density`: number): *void*
*Overrides [Shape](shape.md).[computeMass](shape.md#abstract-computemass)*
*Defined in [src/collision/shape/PolygonShape.ts:413](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L413)*
Compute the mass properties of this shape using its dimensions and density.
The inertia tensor is computed about the local origin.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`massData` | [MassData](massdata.md) | Returns the mass data for this shape. |
`density` | number | The density in kilograms per meter squared. |
**Returns:** *void*
___
### getChildCount
▸ **getChildCount**(): *1*
*Overrides [Shape](shape.md).[getChildCount](shape.md#abstract-getchildcount)*
*Defined in [src/collision/shape/PolygonShape.ts:127](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L127)*
Get the number of child primitives.
**Returns:** *1*
___
### getRadius
▸ **getRadius**(): *number*
*Inherited from [Shape](shape.md).[getRadius](shape.md#getradius)*
*Defined in [src/collision/Shape.ts:62](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L62)*
**Returns:** *number*
___
### getType
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
*Inherited from [Shape](shape.md).[getType](shape.md#gettype)*
*Defined in [src/collision/Shape.ts:72](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L72)*
Get the type of this shape. You can use this to down cast to the concrete
shape.
**Returns:** *[ShapeType](../globals.md#shapetype)*
the shape type.
___
### getVertex
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
*Defined in [src/collision/shape/PolygonShape.ts:98](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L98)*
**Parameters:**
Name | Type |
------ | ------ |
`index` | number |
**Returns:** *[Vec2](vec2.md)*
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `xf`: [Transform](transform.md), `childIndex`: number): *boolean*
*Overrides [Shape](shape.md).[rayCast](shape.md#abstract-raycast)*
*Defined in [src/collision/shape/PolygonShape.ts:320](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L320)*
Cast a ray against a child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) | The ray-cast results. |
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input parameters. |
`xf` | [Transform](transform.md) | The transform to be applied to the shape. |
`childIndex` | number | The child shape index |
**Returns:** *boolean*
___
### testPoint
▸ **testPoint**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *boolean*
*Overrides [Shape](shape.md).[testPoint](shape.md#abstract-testpoint)*
*Defined in [src/collision/shape/PolygonShape.ts:299](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L299)*
Test a point for containment in this shape. This only works for convex
shapes.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`xf` | [Transform](transform.md) | The shape world transform. |
`p` | [Vec2](vec2.md) | A point in world coordinates. |
**Returns:** *boolean*
___
### validate
▸ **validate**(): *boolean*
*Defined in [src/collision/shape/PolygonShape.ts:499](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L499)*
Validate convexity. This is a very time consuming operation.
**Returns:** *boolean*
true if valid
___
### `Static` isValid
▸ **isValid**(`shape`: [Shape](shape.md) | null | undefined): *shape is Shape*
*Inherited from [Shape](shape.md).[isValid](shape.md#static-isvalid)*
*Defined in [src/collision/Shape.ts:58](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L58)*
**Parameters:**
Name | Type |
------ | ------ |
`shape` | [Shape](shape.md) &#124; null &#124; undefined |
**Returns:** *shape is Shape*

View File

@ -1,236 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Pool](pool.md)
# Class: Pool ‹**T**›
## Type parameters
▪ **T**
## Hierarchy
* **Pool**
## Index
### Constructors
* [constructor](pool.md#constructor)
### Properties
* [_createCount](pool.md#_createcount)
* [_createFn](pool.md#_createfn)
* [_discardCount](pool.md#_discardcount)
* [_discardFn](pool.md#_discardfn)
* [_inCount](pool.md#_incount)
* [_inFn](pool.md#_infn)
* [_list](pool.md#_list)
* [_max](pool.md#_max)
* [_outCount](pool.md#_outcount)
* [_outFn](pool.md#_outfn)
### Methods
* [allocate](pool.md#allocate)
* [max](pool.md#max)
* [release](pool.md#release)
* [size](pool.md#size)
* [toString](pool.md#tostring)
## Constructors
### constructor
\+ **new Pool**(`opts`: object): *[Pool](pool.md)*
*Defined in [src/util/Pool.ts:31](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L31)*
**Parameters:**
▪ **opts**: *object*
Name | Type |
------ | ------ |
`allocate?` | function |
`create?` | function |
`discard?` | function |
`max?` | number |
`release?` | function |
**Returns:** *[Pool](pool.md)*
## Properties
### _createCount
• **_createCount**: *number* = 0
*Defined in [src/util/Pool.ts:28](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L28)*
___
### _createFn
• **_createFn**: *function*
*Defined in [src/util/Pool.ts:23](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L23)*
#### Type declaration:
▸ (): *T*
___
### _discardCount
• **_discardCount**: *number* = 0
*Defined in [src/util/Pool.ts:31](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L31)*
___
### _discardFn
• **_discardFn**: *function*
*Defined in [src/util/Pool.ts:26](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L26)*
#### Type declaration:
▸ (`item`: T): *T*
**Parameters:**
Name | Type |
------ | ------ |
`item` | T |
___
### _inCount
• **_inCount**: *number* = 0
*Defined in [src/util/Pool.ts:30](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L30)*
___
### _inFn
• **_inFn**: *function*
*Defined in [src/util/Pool.ts:25](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L25)*
#### Type declaration:
▸ (`item`: T): *void*
**Parameters:**
Name | Type |
------ | ------ |
`item` | T |
___
### _list
• **_list**: *T[]* = []
*Defined in [src/util/Pool.ts:20](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L20)*
___
### _max
• **_max**: *number* = Infinity
*Defined in [src/util/Pool.ts:21](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L21)*
___
### _outCount
• **_outCount**: *number* = 0
*Defined in [src/util/Pool.ts:29](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L29)*
___
### _outFn
• **_outFn**: *function*
*Defined in [src/util/Pool.ts:24](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L24)*
#### Type declaration:
▸ (`item`: T): *void*
**Parameters:**
Name | Type |
------ | ------ |
`item` | T |
## Methods
### allocate
▸ **allocate**(): *T*
*Defined in [src/util/Pool.ts:61](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L61)*
**Returns:** *T*
___
### max
▸ **max**(`n?`: number): *number | [Pool](pool.md)‹T›*
*Defined in [src/util/Pool.ts:49](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L49)*
**Parameters:**
Name | Type |
------ | ------ |
`n?` | number |
**Returns:** *number | [Pool](pool.md)‹T›*
___
### release
▸ **release**(`item`: T): *void*
*Defined in [src/util/Pool.ts:81](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L81)*
**Parameters:**
Name | Type |
------ | ------ |
`item` | T |
**Returns:** *void*
___
### size
▸ **size**(): *number*
*Defined in [src/util/Pool.ts:57](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L57)*
**Returns:** *number*
___
### toString
▸ **toString**(): *string*
*Defined in [src/util/Pool.ts:96](https://github.com/shakiba/planck.js/blob/acc3bd8/src/util/Pool.ts#L96)*
**Returns:** *string*

View File

@ -1,69 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Position](position.md)
# Class: Position
## Hierarchy
* **Position**
## Index
### Constructors
* [constructor](position.md#constructor)
### Properties
* [a](position.md#a)
* [c](position.md#c)
### Methods
* [getTransform](position.md#gettransform)
## Constructors
### constructor
\+ **new Position**(): *[Position](position.md)*
*Defined in [src/dynamics/Position.ts:35](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Position.ts#L35)*
**Returns:** *[Position](position.md)*
## Properties
### a
• **a**: *number*
*Defined in [src/dynamics/Position.ts:35](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Position.ts#L35)*
angle
___
### c
• **c**: *[Vec2](vec2.md)*
*Defined in [src/dynamics/Position.ts:32](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Position.ts#L32)*
location
## Methods
### getTransform
▸ **getTransform**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *[Transform](transform.md)*
*Defined in [src/dynamics/Position.ts:42](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Position.ts#L42)*
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
`p` | [Vec2](vec2.md) |
**Returns:** *[Transform](transform.md)*

View File

@ -1,616 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [PrismaticJoint](prismaticjoint.md)
# Class: PrismaticJoint
A prismatic joint. This joint provides one degree of freedom: translation
along an axis fixed in bodyA. Relative rotation is prevented. You can use a
joint limit to restrict the range of motion and a joint motor to drive the
motion or to model joint friction.
## Hierarchy
* [Joint](joint.md)
↳ **PrismaticJoint**
## Index
### Constructors
* [constructor](prismaticjoint.md#constructor)
### Properties
* [TYPE](prismaticjoint.md#static-type)
### Methods
* [enableLimit](prismaticjoint.md#enablelimit)
* [enableMotor](prismaticjoint.md#enablemotor)
* [getAnchorA](prismaticjoint.md#getanchora)
* [getAnchorB](prismaticjoint.md#getanchorb)
* [getBodyA](prismaticjoint.md#getbodya)
* [getBodyB](prismaticjoint.md#getbodyb)
* [getCollideConnected](prismaticjoint.md#getcollideconnected)
* [getJointSpeed](prismaticjoint.md#getjointspeed)
* [getJointTranslation](prismaticjoint.md#getjointtranslation)
* [getLocalAnchorA](prismaticjoint.md#getlocalanchora)
* [getLocalAnchorB](prismaticjoint.md#getlocalanchorb)
* [getLocalAxisA](prismaticjoint.md#getlocalaxisa)
* [getLowerLimit](prismaticjoint.md#getlowerlimit)
* [getMaxMotorForce](prismaticjoint.md#getmaxmotorforce)
* [getMotorForce](prismaticjoint.md#getmotorforce)
* [getMotorSpeed](prismaticjoint.md#getmotorspeed)
* [getNext](prismaticjoint.md#getnext)
* [getReactionForce](prismaticjoint.md#getreactionforce)
* [getReactionTorque](prismaticjoint.md#getreactiontorque)
* [getReferenceAngle](prismaticjoint.md#getreferenceangle)
* [getType](prismaticjoint.md#gettype)
* [getUpperLimit](prismaticjoint.md#getupperlimit)
* [getUserData](prismaticjoint.md#getuserdata)
* [initVelocityConstraints](prismaticjoint.md#initvelocityconstraints)
* [isActive](prismaticjoint.md#isactive)
* [isLimitEnabled](prismaticjoint.md#islimitenabled)
* [isMotorEnabled](prismaticjoint.md#ismotorenabled)
* [setLimits](prismaticjoint.md#setlimits)
* [setMaxMotorForce](prismaticjoint.md#setmaxmotorforce)
* [setMotorSpeed](prismaticjoint.md#setmotorspeed)
* [setUserData](prismaticjoint.md#setuserdata)
* [shiftOrigin](prismaticjoint.md#shiftorigin)
* [solvePositionConstraints](prismaticjoint.md#solvepositionconstraints)
* [solveVelocityConstraints](prismaticjoint.md#solvevelocityconstraints)
## Constructors
### constructor
\+ **new PrismaticJoint**(`def`: [PrismaticJointDef](../interfaces/prismaticjointdef.md)): *[PrismaticJoint](prismaticjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:156](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L156)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PrismaticJointDef](../interfaces/prismaticjointdef.md) |
**Returns:** *[PrismaticJoint](prismaticjoint.md)*
\+ **new PrismaticJoint**(`def`: [PrismaticJointOpt](../interfaces/prismaticjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md), `axis`: [Vec2](vec2.md)): *[PrismaticJoint](prismaticjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:158](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L158)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PrismaticJointOpt](../interfaces/prismaticjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
`axis` | [Vec2](vec2.md) |
**Returns:** *[PrismaticJoint](prismaticjoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"prismatic-joint"* = 'prismatic-joint' as 'prismatic-joint'
*Defined in [src/dynamics/joint/PrismaticJoint.ts:125](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L125)*
## Methods
### enableLimit
▸ **enableLimit**(`flag`: boolean): *void*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:403](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L403)*
Enable/disable the joint limit.
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### enableMotor
▸ **enableMotor**(`flag`: boolean): *void*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:450](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L450)*
Enable/disable the joint motor.
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:495](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L495)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:502](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L502)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getJointSpeed
▸ **getJointSpeed**(): *number*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:372](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L372)*
Get the current joint translation speed, usually in meters per second.
**Returns:** *number*
___
### getJointTranslation
▸ **getJointTranslation**(): *number*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:359](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L359)*
Get the current joint translation, usually in meters.
**Returns:** *number*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:331](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L331)*
The local anchor point relative to bodyA's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:338](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L338)*
The local anchor point relative to bodyB's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAxisA
▸ **getLocalAxisA**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:345](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L345)*
The local joint axis relative to bodyA.
**Returns:** *[Vec2](vec2.md)*
___
### getLowerLimit
▸ **getLowerLimit**(): *number*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:415](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L415)*
Get the lower joint limit, usually in meters.
**Returns:** *number*
___
### getMaxMotorForce
▸ **getMaxMotorForce**(): *number*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:474](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L474)*
**Returns:** *number*
___
### getMotorForce
▸ **getMotorForce**(`inv_dt`: number): *number*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:488](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L488)*
Get the current motor force given the inverse time step, usually in N.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getMotorSpeed
▸ **getMotorSpeed**(): *number*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:481](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L481)*
Get the motor speed, usually in meters per second.
**Returns:** *number*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:509](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L509)*
Get the reaction force on bodyB at the joint anchor in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:516](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L516)*
Get the reaction torque on bodyB in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getReferenceAngle
▸ **getReferenceAngle**(): *number*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:352](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L352)*
Get the reference angle.
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUpperLimit
▸ **getUpperLimit**(): *number*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:422](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L422)*
Get the upper joint limit, usually in meters.
**Returns:** *number*
___
### getUserData
▸ **getUserData**(): *unknown*
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:520](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L520)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### isLimitEnabled
▸ **isLimitEnabled**(): *boolean*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:396](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L396)*
Is the joint limit enabled?
**Returns:** *boolean*
___
### isMotorEnabled
▸ **isMotorEnabled**(): *boolean*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:443](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L443)*
Is the joint motor enabled?
**Returns:** *boolean*
___
### setLimits
▸ **setLimits**(`lower`: number, `upper`: number): *void*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:429](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L429)*
Set the joint limits, usually in meters.
**Parameters:**
Name | Type |
------ | ------ |
`lower` | number |
`upper` | number |
**Returns:** *void*
___
### setMaxMotorForce
▸ **setMaxMotorForce**(`force`: number): *void*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:468](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L468)*
Set the maximum motor force, usually in N.
**Parameters:**
Name | Type |
------ | ------ |
`force` | number |
**Returns:** *void*
___
### setMotorSpeed
▸ **setMotorSpeed**(`speed`: number): *void*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:459](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L459)*
Set the motor speed, usually in meters per second.
**Parameters:**
Name | Type |
------ | ------ |
`speed` | number |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Inherited from [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
*Defined in [src/dynamics/Joint.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L217)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:752](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L752)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
*Defined in [src/dynamics/joint/PrismaticJoint.ts:652](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PrismaticJoint.ts#L652)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,468 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [PulleyJoint](pulleyjoint.md)
# Class: PulleyJoint
The pulley joint is connected to two bodies and two fixed ground points. The
pulley supports a ratio such that: length1 + ratio * length2 <= constant
Yes, the force transmitted is scaled by the ratio.
Warning: the pulley joint can get a bit squirrelly by itself. They often work
better when combined with prismatic joints. You should also cover the the
anchor points with static shapes to prevent one side from going to zero
length.
## Hierarchy
* [Joint](joint.md)
↳ **PulleyJoint**
## Index
### Constructors
* [constructor](pulleyjoint.md#constructor)
### Properties
* [MIN_PULLEY_LENGTH](pulleyjoint.md#static-min_pulley_length)
* [TYPE](pulleyjoint.md#static-type)
### Methods
* [_serialize](pulleyjoint.md#_serialize)
* [getAnchorA](pulleyjoint.md#getanchora)
* [getAnchorB](pulleyjoint.md#getanchorb)
* [getBodyA](pulleyjoint.md#getbodya)
* [getBodyB](pulleyjoint.md#getbodyb)
* [getCollideConnected](pulleyjoint.md#getcollideconnected)
* [getCurrentLengthA](pulleyjoint.md#getcurrentlengtha)
* [getCurrentLengthB](pulleyjoint.md#getcurrentlengthb)
* [getGroundAnchorA](pulleyjoint.md#getgroundanchora)
* [getGroundAnchorB](pulleyjoint.md#getgroundanchorb)
* [getLengthA](pulleyjoint.md#getlengtha)
* [getLengthB](pulleyjoint.md#getlengthb)
* [getNext](pulleyjoint.md#getnext)
* [getRatio](pulleyjoint.md#getratio)
* [getReactionForce](pulleyjoint.md#getreactionforce)
* [getReactionTorque](pulleyjoint.md#getreactiontorque)
* [getType](pulleyjoint.md#gettype)
* [getUserData](pulleyjoint.md#getuserdata)
* [initVelocityConstraints](pulleyjoint.md#initvelocityconstraints)
* [isActive](pulleyjoint.md#isactive)
* [setUserData](pulleyjoint.md#setuserdata)
* [shiftOrigin](pulleyjoint.md#shiftorigin)
* [solvePositionConstraints](pulleyjoint.md#solvepositionconstraints)
* [solveVelocityConstraints](pulleyjoint.md#solvevelocityconstraints)
## Constructors
### constructor
\+ **new PulleyJoint**(`def`: [PulleyJointDef](../interfaces/pulleyjointdef.md)): *[PulleyJoint](pulleyjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:121](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L121)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PulleyJointDef](../interfaces/pulleyjointdef.md) |
**Returns:** *[PulleyJoint](pulleyjoint.md)*
\+ **new PulleyJoint**(`def`: [PulleyJointOpt](../interfaces/pulleyjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `groundA`: [Vec2](vec2.md), `groundB`: [Vec2](vec2.md), `anchorA`: [Vec2](vec2.md), `anchorB`: [Vec2](vec2.md), `ratio`: number): *[PulleyJoint](pulleyjoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:123](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L123)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PulleyJointOpt](../interfaces/pulleyjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`groundA` | [Vec2](vec2.md) |
`groundB` | [Vec2](vec2.md) |
`anchorA` | [Vec2](vec2.md) |
`anchorB` | [Vec2](vec2.md) |
`ratio` | number |
**Returns:** *[PulleyJoint](pulleyjoint.md)*
## Properties
### `Static` MIN_PULLEY_LENGTH
▪ **MIN_PULLEY_LENGTH**: *number* = 2
*Defined in [src/dynamics/joint/PulleyJoint.ts:98](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L98)*
___
### `Static` TYPE
▪ **TYPE**: *"pulley-joint"* = 'pulley-joint' as 'pulley-joint'
*Defined in [src/dynamics/joint/PulleyJoint.ts:97](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L97)*
## Methods
### _serialize
▸ **_serialize**(): *object*
*Overrides void*
*Defined in [src/dynamics/joint/PulleyJoint.ts:178](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L178)*
**Returns:** *object*
___
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:271](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L271)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:278](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L278)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getCurrentLengthA
▸ **getCurrentLengthA**(): *number*
*Defined in [src/dynamics/joint/PulleyJoint.ts:243](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L243)*
Get the current length of the segment attached to bodyA.
**Returns:** *number*
___
### getCurrentLengthB
▸ **getCurrentLengthB**(): *number*
*Defined in [src/dynamics/joint/PulleyJoint.ts:252](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L252)*
Get the current length of the segment attached to bodyB.
**Returns:** *number*
___
### getGroundAnchorA
▸ **getGroundAnchorA**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:208](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L208)*
Get the first ground anchor.
**Returns:** *[Vec2](vec2.md)*
___
### getGroundAnchorB
▸ **getGroundAnchorB**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:215](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L215)*
Get the second ground anchor.
**Returns:** *[Vec2](vec2.md)*
___
### getLengthA
▸ **getLengthA**(): *number*
*Defined in [src/dynamics/joint/PulleyJoint.ts:222](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L222)*
Get the current length of the segment attached to bodyA.
**Returns:** *number*
___
### getLengthB
▸ **getLengthB**(): *number*
*Defined in [src/dynamics/joint/PulleyJoint.ts:229](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L229)*
Get the current length of the segment attached to bodyB.
**Returns:** *number*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### getRatio
▸ **getRatio**(): *number*
*Defined in [src/dynamics/joint/PulleyJoint.ts:236](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L236)*
Get the pulley ratio.
**Returns:** *number*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:285](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L285)*
Get the reaction force on bodyB at the joint anchor in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:292](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L292)*
Get the reaction torque on bodyB in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUserData
▸ **getUserData**(): *unknown*
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:296](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L296)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Overrides [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:263](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L263)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`newOrigin` | [Vec2](vec2.md) | |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:406](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L406)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
*Defined in [src/dynamics/joint/PulleyJoint.ts:376](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/PulleyJoint.ts#L376)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,95 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ReferenceFace](referenceface.md)
# Class: ReferenceFace
Reference face used for clipping
## Hierarchy
* **ReferenceFace**
## Index
### Properties
* [i1](referenceface.md#i1)
* [i2](referenceface.md#i2)
* [normal](referenceface.md#normal)
* [sideNormal1](referenceface.md#sidenormal1)
* [sideNormal2](referenceface.md#sidenormal2)
* [sideOffset1](referenceface.md#sideoffset1)
* [sideOffset2](referenceface.md#sideoffset2)
* [v1](referenceface.md#v1)
* [v2](referenceface.md#v2)
## Properties
### i1
• **i1**: *number*
*Defined in [src/collision/shape/CollideEdgePolygon.ts:98](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L98)*
___
### i2
• **i2**: *number*
*Defined in [src/collision/shape/CollideEdgePolygon.ts:99](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L99)*
___
### normal
• **normal**: *[Vec2](vec2.md)‹›* = Vec2.zero()
*Defined in [src/collision/shape/CollideEdgePolygon.ts:102](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L102)*
___
### sideNormal1
• **sideNormal1**: *[Vec2](vec2.md)‹›* = Vec2.zero()
*Defined in [src/collision/shape/CollideEdgePolygon.ts:103](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L103)*
___
### sideNormal2
• **sideNormal2**: *[Vec2](vec2.md)‹›* = Vec2.zero()
*Defined in [src/collision/shape/CollideEdgePolygon.ts:105](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L105)*
___
### sideOffset1
• **sideOffset1**: *number*
*Defined in [src/collision/shape/CollideEdgePolygon.ts:104](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L104)*
___
### sideOffset2
• **sideOffset2**: *number*
*Defined in [src/collision/shape/CollideEdgePolygon.ts:106](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L106)*
___
### v1
• **v1**: *[Vec2](vec2.md)*
*Defined in [src/collision/shape/CollideEdgePolygon.ts:100](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L100)*
___
### v2
• **v2**: *[Vec2](vec2.md)*
*Defined in [src/collision/shape/CollideEdgePolygon.ts:101](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L101)*

View File

@ -1,605 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [RevoluteJoint](revolutejoint.md)
# Class: RevoluteJoint
A revolute joint constrains two bodies to share a common point while they are
free to rotate about the point. The relative rotation about the shared point
is the joint angle. You can limit the relative rotation with a joint limit
that specifies a lower and upper angle. You can use a motor to drive the
relative rotation about the shared point. A maximum motor torque is provided
so that infinite forces are not generated.
## Hierarchy
* [Joint](joint.md)
↳ **RevoluteJoint**
## Index
### Constructors
* [constructor](revolutejoint.md#constructor)
### Properties
* [TYPE](revolutejoint.md#static-type)
### Methods
* [enableLimit](revolutejoint.md#enablelimit)
* [enableMotor](revolutejoint.md#enablemotor)
* [getAnchorA](revolutejoint.md#getanchora)
* [getAnchorB](revolutejoint.md#getanchorb)
* [getBodyA](revolutejoint.md#getbodya)
* [getBodyB](revolutejoint.md#getbodyb)
* [getCollideConnected](revolutejoint.md#getcollideconnected)
* [getJointAngle](revolutejoint.md#getjointangle)
* [getJointSpeed](revolutejoint.md#getjointspeed)
* [getLocalAnchorA](revolutejoint.md#getlocalanchora)
* [getLocalAnchorB](revolutejoint.md#getlocalanchorb)
* [getLowerLimit](revolutejoint.md#getlowerlimit)
* [getMaxMotorTorque](revolutejoint.md#getmaxmotortorque)
* [getMotorSpeed](revolutejoint.md#getmotorspeed)
* [getMotorTorque](revolutejoint.md#getmotortorque)
* [getNext](revolutejoint.md#getnext)
* [getReactionForce](revolutejoint.md#getreactionforce)
* [getReactionTorque](revolutejoint.md#getreactiontorque)
* [getReferenceAngle](revolutejoint.md#getreferenceangle)
* [getType](revolutejoint.md#gettype)
* [getUpperLimit](revolutejoint.md#getupperlimit)
* [getUserData](revolutejoint.md#getuserdata)
* [initVelocityConstraints](revolutejoint.md#initvelocityconstraints)
* [isActive](revolutejoint.md#isactive)
* [isLimitEnabled](revolutejoint.md#islimitenabled)
* [isMotorEnabled](revolutejoint.md#ismotorenabled)
* [setLimits](revolutejoint.md#setlimits)
* [setMaxMotorTorque](revolutejoint.md#setmaxmotortorque)
* [setMotorSpeed](revolutejoint.md#setmotorspeed)
* [setUserData](revolutejoint.md#setuserdata)
* [shiftOrigin](revolutejoint.md#shiftorigin)
* [solvePositionConstraints](revolutejoint.md#solvepositionconstraints)
* [solveVelocityConstraints](revolutejoint.md#solvevelocityconstraints)
## Constructors
### constructor
\+ **new RevoluteJoint**(`def`: [RevoluteJointDef](../interfaces/revolutejointdef.md)): *[RevoluteJoint](revolutejoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:156](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L156)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RevoluteJointDef](../interfaces/revolutejointdef.md) |
**Returns:** *[RevoluteJoint](revolutejoint.md)*
\+ **new RevoluteJoint**(`def`: [RevoluteJointOpt](../interfaces/revolutejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[RevoluteJoint](revolutejoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:158](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L158)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RevoluteJointOpt](../interfaces/revolutejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[RevoluteJoint](revolutejoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"revolute-joint"* = 'revolute-joint' as 'revolute-joint'
*Defined in [src/dynamics/joint/RevoluteJoint.ts:131](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L131)*
## Methods
### enableLimit
▸ **enableLimit**(`flag`: boolean): *void*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:368](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L368)*
Enable/disable the joint limit.
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### enableMotor
▸ **enableMotor**(`flag`: boolean): *void*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:316](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L316)*
Enable/disable the joint motor.
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:409](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L409)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:416](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L416)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getJointAngle
▸ **getJointAngle**(): *number*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:291](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L291)*
Get the current joint angle in radians.
**Returns:** *number*
___
### getJointSpeed
▸ **getJointSpeed**(): *number*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:300](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L300)*
Get the current joint angle speed in radians per second.
**Returns:** *number*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:270](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L270)*
The local anchor point relative to bodyA's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:277](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L277)*
The local anchor point relative to bodyB's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getLowerLimit
▸ **getLowerLimit**(): *number*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:380](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L380)*
Get the lower joint limit in radians.
**Returns:** *number*
___
### getMaxMotorTorque
▸ **getMaxMotorTorque**(): *number*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:354](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L354)*
**Returns:** *number*
___
### getMotorSpeed
▸ **getMotorSpeed**(): *number*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:341](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L341)*
Get the motor speed in radians per second.
**Returns:** *number*
___
### getMotorTorque
▸ **getMotorTorque**(`inv_dt`: number): *number*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:325](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L325)*
Get the current motor torque given the inverse time step. Unit is N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:423](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L423)*
Get the reaction force given the inverse time step. Unit is N.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:431](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L431)*
Get the reaction torque due to the joint limit given the inverse time step.
Unit is N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getReferenceAngle
▸ **getReferenceAngle**(): *number*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:284](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L284)*
Get the reference angle.
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUpperLimit
▸ **getUpperLimit**(): *number*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:387](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L387)*
Get the upper joint limit in radians.
**Returns:** *number*
___
### getUserData
▸ **getUserData**(): *unknown*
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:435](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L435)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### isLimitEnabled
▸ **isLimitEnabled**(): *boolean*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:361](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L361)*
Is the joint limit enabled?
**Returns:** *boolean*
___
### isMotorEnabled
▸ **isMotorEnabled**(): *boolean*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:309](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L309)*
Is the joint motor enabled?
**Returns:** *boolean*
___
### setLimits
▸ **setLimits**(`lower`: number, `upper`: number): *void*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:394](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L394)*
Set the joint limits in radians.
**Parameters:**
Name | Type |
------ | ------ |
`lower` | number |
`upper` | number |
**Returns:** *void*
___
### setMaxMotorTorque
▸ **setMaxMotorTorque**(`torque`: number): *void*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:348](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L348)*
Set the maximum motor torque, usually in N-m.
**Parameters:**
Name | Type |
------ | ------ |
`torque` | number |
**Returns:** *void*
___
### setMotorSpeed
▸ **setMotorSpeed**(`speed`: number): *void*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:332](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L332)*
Set the motor speed in radians per second.
**Parameters:**
Name | Type |
------ | ------ |
`speed` | number |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Inherited from [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
*Defined in [src/dynamics/Joint.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L217)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:657](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L657)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
*Defined in [src/dynamics/joint/RevoluteJoint.ts:546](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L546)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,420 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [RopeJoint](ropejoint.md)
# Class: RopeJoint
A rope joint enforces a maximum distance between two points on two bodies. It
has no other effect.
Warning: if you attempt to change the maximum length during the simulation
you will get some non-physical behavior.
A model that would allow you to dynamically modify the length would have some
sponginess, so I chose not to implement it that way. See [DistanceJoint](distancejoint.md) if you
want to dynamically control length.
## Hierarchy
* [Joint](joint.md)
↳ **RopeJoint**
## Index
### Constructors
* [constructor](ropejoint.md#constructor)
### Properties
* [TYPE](ropejoint.md#static-type)
### Methods
* [getAnchorA](ropejoint.md#getanchora)
* [getAnchorB](ropejoint.md#getanchorb)
* [getBodyA](ropejoint.md#getbodya)
* [getBodyB](ropejoint.md#getbodyb)
* [getCollideConnected](ropejoint.md#getcollideconnected)
* [getLimitState](ropejoint.md#getlimitstate)
* [getLocalAnchorA](ropejoint.md#getlocalanchora)
* [getLocalAnchorB](ropejoint.md#getlocalanchorb)
* [getMaxLength](ropejoint.md#getmaxlength)
* [getNext](ropejoint.md#getnext)
* [getReactionForce](ropejoint.md#getreactionforce)
* [getReactionTorque](ropejoint.md#getreactiontorque)
* [getType](ropejoint.md#gettype)
* [getUserData](ropejoint.md#getuserdata)
* [initVelocityConstraints](ropejoint.md#initvelocityconstraints)
* [isActive](ropejoint.md#isactive)
* [setMaxLength](ropejoint.md#setmaxlength)
* [setUserData](ropejoint.md#setuserdata)
* [shiftOrigin](ropejoint.md#shiftorigin)
* [solvePositionConstraints](ropejoint.md#solvepositionconstraints)
* [solveVelocityConstraints](ropejoint.md#solvevelocityconstraints)
## Constructors
### constructor
\+ **new RopeJoint**(`def`: [RopeJointDef](../interfaces/ropejointdef.md)): *[RopeJoint](ropejoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/RopeJoint.ts:105](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L105)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RopeJointDef](../interfaces/ropejointdef.md) |
**Returns:** *[RopeJoint](ropejoint.md)*
\+ **new RopeJoint**(`def`: [RopeJointOpt](../interfaces/ropejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[RopeJoint](ropejoint.md)*
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
*Defined in [src/dynamics/joint/RopeJoint.ts:107](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L107)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RopeJointOpt](../interfaces/ropejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[RopeJoint](ropejoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"rope-joint"* = 'rope-joint' as 'rope-joint'
*Defined in [src/dynamics/joint/RopeJoint.ts:83](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L83)*
## Methods
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
*Defined in [src/dynamics/joint/RopeJoint.ts:212](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L212)*
Get the anchor point on bodyA in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
*Defined in [src/dynamics/joint/RopeJoint.ts:219](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L219)*
Get the anchor point on bodyB in world coordinates.
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
Get the first body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
Get the second body attached to this joint.
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
Get collide connected. Note: modifying the collide connect flag won't work
correctly because the flag is only checked when fixture AABBs begin to
overlap.
**Returns:** *boolean*
___
### getLimitState
▸ **getLimitState**(): *number*
*Defined in [src/dynamics/joint/RopeJoint.ts:204](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L204)*
**Returns:** *number*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/RopeJoint.ts:179](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L179)*
The local anchor point relative to bodyA's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [src/dynamics/joint/RopeJoint.ts:186](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L186)*
The local anchor point relative to bodyB's origin.
**Returns:** *[Vec2](vec2.md)*
___
### getMaxLength
▸ **getMaxLength**(): *number*
*Defined in [src/dynamics/joint/RopeJoint.ts:200](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L200)*
Get the maximum length of the rope.
**Returns:** *number*
___
### getNext
▸ **getNext**(): *[Joint](joint.md)*
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
Get the next joint the world joint list.
**Returns:** *[Joint](joint.md)*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
*Defined in [src/dynamics/joint/RopeJoint.ts:226](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L226)*
Get the reaction force on bodyB at the joint anchor in Newtons.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
*Defined in [src/dynamics/joint/RopeJoint.ts:233](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L233)*
Get the reaction torque on bodyB in N*m.
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
Get the type of the concrete joint.
**Returns:** *string*
___
### getUserData
▸ **getUserData**(): *unknown*
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
*Defined in [src/dynamics/joint/RopeJoint.ts:237](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L237)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
Short-cut function to determine if either body is inactive.
**Returns:** *boolean*
___
### setMaxLength
▸ **setMaxLength**(`length`: number): *void*
*Defined in [src/dynamics/joint/RopeJoint.ts:193](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L193)*
Set the maximum length of the rope.
**Parameters:**
Name | Type |
------ | ------ |
`length` | number |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: unknown): *void*
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | unknown |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Inherited from [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
*Defined in [src/dynamics/Joint.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L217)*
Shift the origin for any points stored in world coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
*Defined in [src/dynamics/joint/RopeJoint.ts:349](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L349)*
This returns true if the position errors are within tolerance.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
*Defined in [src/dynamics/joint/RopeJoint.ts:312](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RopeJoint.ts#L312)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,366 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Rot](rot.md)
# Class: Rot
## Hierarchy
* **Rot**
## Index
### Constructors
* [constructor](rot.md#constructor)
### Properties
* [c](rot.md#c)
* [s](rot.md#s)
### Methods
* [getAngle](rot.md#getangle)
* [getXAxis](rot.md#getxaxis)
* [getYAxis](rot.md#getyaxis)
* [set](rot.md#set)
* [setAngle](rot.md#setangle)
* [setIdentity](rot.md#setidentity)
* [assert](rot.md#static-assert)
* [clone](rot.md#static-clone)
* [identity](rot.md#static-identity)
* [isValid](rot.md#static-isvalid)
* [mul](rot.md#static-mul)
* [mulRot](rot.md#static-mulrot)
* [mulSub](rot.md#static-mulsub)
* [mulT](rot.md#static-mult)
* [mulTRot](rot.md#static-multrot)
* [mulTVec2](rot.md#static-multvec2)
* [mulVec2](rot.md#static-mulvec2)
## Constructors
### constructor
\+ **new Rot**(`angle?`: number | [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [src/common/Rot.ts:36](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L36)*
Initialize from an angle in radians.
**Parameters:**
Name | Type |
------ | ------ |
`angle?` | number &#124; [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
## Properties
### c
• **c**: *number*
*Defined in [src/common/Rot.ts:36](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L36)*
___
### s
• **s**: *number*
*Defined in [src/common/Rot.ts:35](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L35)*
## Methods
### getAngle
▸ **getAngle**(): *number*
*Defined in [src/common/Rot.ts:115](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L115)*
Get the angle in radians.
**Returns:** *number*
___
### getXAxis
▸ **getXAxis**(): *[Vec2](vec2.md)*
*Defined in [src/common/Rot.ts:120](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L120)*
Get the x-axis.
**Returns:** *[Vec2](vec2.md)*
___
### getYAxis
▸ **getYAxis**(): *[Vec2](vec2.md)*
*Defined in [src/common/Rot.ts:125](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L125)*
Get the u-axis.
**Returns:** *[Vec2](vec2.md)*
___
### set
▸ **set**(`angle`: number | [Rot](rot.md)): *void*
*Defined in [src/common/Rot.ts:92](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L92)*
**Parameters:**
Name | Type |
------ | ------ |
`angle` | number &#124; [Rot](rot.md) |
**Returns:** *void*
___
### setAngle
▸ **setAngle**(`angle`: number): *void*
*Defined in [src/common/Rot.ts:107](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L107)*
Set using an angle in radians.
**Parameters:**
Name | Type |
------ | ------ |
`angle` | number |
**Returns:** *void*
___
### setIdentity
▸ **setIdentity**(): *void*
*Defined in [src/common/Rot.ts:87](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L87)*
Set to the identity rotation.
**Returns:** *void*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [src/common/Rot.ts:78](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L78)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` clone
▸ **clone**(`rot`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [src/common/Rot.ts:59](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L59)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
___
### `Static` identity
▸ **identity**(): *[Rot](rot.md)*
*Defined in [src/common/Rot.ts:67](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L67)*
**Returns:** *[Rot](rot.md)*
___
### `Static` isValid
▸ **isValid**(`o`: any): *boolean*
*Defined in [src/common/Rot.ts:74](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L74)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *boolean*
___
### `Static` mul
▸ **mul**(`rot`: [Rot](rot.md), `m`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [src/common/Rot.ts:130](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L130)*
Multiply two rotations: q * r
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
▸ **mul**(`rot`: [Rot](rot.md), `m`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Rot.ts:132](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L132)*
Rotate a vector
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulRot
▸ **mulRot**(`rot`: [Rot](rot.md), `m`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [src/common/Rot.ts:153](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L153)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
___
### `Static` mulSub
▸ **mulSub**(`rot`: [Rot](rot.md), `v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Rot.ts:172](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L172)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulT
▸ **mulT**(`rot`: [Rot](rot.md), `m`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [src/common/Rot.ts:179](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L179)*
Transpose multiply two rotations: qT * r
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
▸ **mulT**(`rot`: [Rot](rot.md), `m`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Rot.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L181)*
Inverse rotate a vector
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulTRot
▸ **mulTRot**(`rot`: [Rot](rot.md), `m`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [src/common/Rot.ts:201](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L201)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
___
### `Static` mulTVec2
▸ **mulTVec2**(`rot`: [Rot](rot.md), `m`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Rot.ts:213](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L213)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulVec2
▸ **mulVec2**(`rot`: [Rot](rot.md), `m`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Rot.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Rot.ts#L166)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*

View File

@ -1,170 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [SeparationFunction](separationfunction.md)
# Class: SeparationFunction
## Hierarchy
* **SeparationFunction**
## Index
### Properties
* [indexA](separationfunction.md#indexa)
* [indexB](separationfunction.md#indexb)
* [m_axis](separationfunction.md#m_axis)
* [m_localPoint](separationfunction.md#m_localpoint)
* [m_proxyA](separationfunction.md#m_proxya)
* [m_proxyB](separationfunction.md#m_proxyb)
* [m_sweepA](separationfunction.md#m_sweepa)
* [m_sweepB](separationfunction.md#m_sweepb)
* [m_type](separationfunction.md#m_type)
### Methods
* [compute](separationfunction.md#compute)
* [evaluate](separationfunction.md#evaluate)
* [findMinSeparation](separationfunction.md#findminseparation)
* [initialize](separationfunction.md#initialize)
## Properties
### indexA
• **indexA**: *number*
*Defined in [src/collision/TimeOfImpact.ts:316](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L316)*
___
### indexB
• **indexB**: *number*
*Defined in [src/collision/TimeOfImpact.ts:317](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L317)*
___
### m_axis
• **m_axis**: *[Vec2](vec2.md)‹›* = Vec2.zero()
*Defined in [src/collision/TimeOfImpact.ts:320](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L320)*
___
### m_localPoint
• **m_localPoint**: *[Vec2](vec2.md)‹›* = Vec2.zero()
*Defined in [src/collision/TimeOfImpact.ts:319](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L319)*
___
### m_proxyA
• **m_proxyA**: *[DistanceProxy](distanceproxy.md)‹›* = new DistanceProxy()
*Defined in [src/collision/TimeOfImpact.ts:312](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L312)*
___
### m_proxyB
• **m_proxyB**: *[DistanceProxy](distanceproxy.md)‹›* = new DistanceProxy()
*Defined in [src/collision/TimeOfImpact.ts:313](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L313)*
___
### m_sweepA
• **m_sweepA**: *[Sweep](sweep.md)*
*Defined in [src/collision/TimeOfImpact.ts:314](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L314)*
___
### m_sweepB
• **m_sweepB**: *[Sweep](sweep.md)*
*Defined in [src/collision/TimeOfImpact.ts:315](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L315)*
___
### m_type
• **m_type**: *[SeparationFunctionType](../enums/separationfunctiontype.md)*
*Defined in [src/collision/TimeOfImpact.ts:318](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L318)*
## Methods
### compute
▸ **compute**(`find`: boolean, `t`: number): *number*
*Defined in [src/collision/TimeOfImpact.ts:396](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L396)*
**Parameters:**
Name | Type |
------ | ------ |
`find` | boolean |
`t` | number |
**Returns:** *number*
___
### evaluate
▸ **evaluate**(`t`: number): *number*
*Defined in [src/collision/TimeOfImpact.ts:473](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L473)*
**Parameters:**
Name | Type |
------ | ------ |
`t` | number |
**Returns:** *number*
___
### findMinSeparation
▸ **findMinSeparation**(`t`: number): *number*
*Defined in [src/collision/TimeOfImpact.ts:469](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L469)*
**Parameters:**
Name | Type |
------ | ------ |
`t` | number |
**Returns:** *number*
___
### initialize
▸ **initialize**(`cache`: [SimplexCache](simplexcache.md), `proxyA`: [DistanceProxy](distanceproxy.md), `sweepA`: [Sweep](sweep.md), `proxyB`: [DistanceProxy](distanceproxy.md), `sweepB`: [Sweep](sweep.md), `t1`: number): *number*
*Defined in [src/collision/TimeOfImpact.ts:324](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L324)*
**Parameters:**
Name | Type |
------ | ------ |
`cache` | [SimplexCache](simplexcache.md) |
`proxyA` | [DistanceProxy](distanceproxy.md) |
`sweepA` | [Sweep](sweep.md) |
`proxyB` | [DistanceProxy](distanceproxy.md) |
`sweepB` | [Sweep](sweep.md) |
`t1` | number |
**Returns:** *number*

View File

@ -1,320 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Settings](settings.md)
# Class: Settings
Tuning constants based on meters-kilograms-seconds (MKS) units.
## Hierarchy
* **Settings**
## Index
### Properties
* [aabbExtension](settings.md#static-aabbextension)
* [aabbMultiplier](settings.md#static-aabbmultiplier)
* [angularSleepTolerance](settings.md#static-angularsleeptolerance)
* [angularSlop](settings.md#static-angularslop)
* [baumgarte](settings.md#static-baumgarte)
* [linearSleepTolerance](settings.md#static-linearsleeptolerance)
* [linearSlop](settings.md#static-linearslop)
* [maxAngularCorrection](settings.md#static-maxangularcorrection)
* [maxDistnceIterations](settings.md#static-maxdistnceiterations)
* [maxLinearCorrection](settings.md#static-maxlinearcorrection)
* [maxManifoldPoints](settings.md#static-maxmanifoldpoints)
* [maxPolygonVertices](settings.md#static-maxpolygonvertices)
* [maxRotation](settings.md#static-maxrotation)
* [maxSubSteps](settings.md#static-maxsubsteps)
* [maxTOIContacts](settings.md#static-maxtoicontacts)
* [maxTOIIterations](settings.md#static-maxtoiiterations)
* [maxTranslation](settings.md#static-maxtranslation)
* [timeToSleep](settings.md#static-timetosleep)
* [toiBaugarte](settings.md#static-toibaugarte)
* [velocityThreshold](settings.md#static-velocitythreshold)
### Accessors
* [angularSleepToleranceSqr](settings.md#static-angularsleeptolerancesqr)
* [linearSleepToleranceSqr](settings.md#static-linearsleeptolerancesqr)
* [linearSlopSquared](settings.md#static-linearslopsquared)
* [maxRotationSquared](settings.md#static-maxrotationsquared)
* [maxTranslationSquared](settings.md#static-maxtranslationsquared)
* [polygonRadius](settings.md#static-polygonradius)
## Properties
### `Static` aabbExtension
▪ **aabbExtension**: *number* = 0.1
*Defined in [src/Settings.ts:49](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L49)*
This is used to fatten AABBs in the dynamic tree. This allows proxies to move
by a small amount without triggering a tree adjustment. This is in meters.
___
### `Static` aabbMultiplier
▪ **aabbMultiplier**: *number* = 2
*Defined in [src/Settings.ts:56](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L56)*
This is used to fatten AABBs in the dynamic tree. This is used to predict the
future position based on the current displacement. This is a dimensionless
multiplier.
___
### `Static` angularSleepTolerance
▪ **angularSleepTolerance**: *number* = (2.0 / 180.0 * Math.PI)
*Defined in [src/Settings.ts:157](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L157)*
A body cannot sleep if its angular velocity is above this tolerance.
___
### `Static` angularSlop
▪ **angularSlop**: *number* = (2.0 / 180.0 * Math.PI)
*Defined in [src/Settings.ts:69](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L69)*
A small angle used as a collision and constraint tolerance. Usually it is
chosen to be numerically significant, but visually insignificant.
___
### `Static` baumgarte
▪ **baumgarte**: *number* = 0.2
*Defined in [src/Settings.ts:138](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L138)*
This scale factor controls how fast overlap is resolved. Ideally this would
be 1 so that overlap is removed in one time step. However using values close
to 1 often lead to overshoot.
___
### `Static` linearSleepTolerance
▪ **linearSleepTolerance**: *number* = 0.01
*Defined in [src/Settings.ts:151](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L151)*
A body cannot sleep if its linear velocity is above this tolerance.
___
### `Static` linearSlop
▪ **linearSlop**: *number* = 0.005
*Defined in [src/Settings.ts:62](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L62)*
A small length used as a collision and constraint tolerance. Usually it is
chosen to be numerically significant, but visually insignificant.
___
### `Static` maxAngularCorrection
▪ **maxAngularCorrection**: *number* = (8.0 / 180.0 * Math.PI)
*Defined in [src/Settings.ts:117](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L117)*
The maximum angular position correction used when solving constraints. This
helps to prevent overshoot.
___
### `Static` maxDistnceIterations
▪ **maxDistnceIterations**: *number* = 20
*Defined in [src/Settings.ts:99](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L99)*
Maximum iterations to find Distance.
___
### `Static` maxLinearCorrection
▪ **maxLinearCorrection**: *number* = 0.2
*Defined in [src/Settings.ts:111](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L111)*
The maximum linear position correction used when solving constraints. This
helps to prevent overshoot.
___
### `Static` maxManifoldPoints
▪ **maxManifoldPoints**: *number* = 2
*Defined in [src/Settings.ts:37](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L37)*
The maximum number of contact points between two convex shapes. Do not change
this value.
___
### `Static` maxPolygonVertices
▪ **maxPolygonVertices**: *number* = 12
*Defined in [src/Settings.ts:43](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L43)*
The maximum number of vertices on a convex polygon. You cannot increase this
too much because BlockAllocator has a maximum object size.
___
### `Static` maxRotation
▪ **maxRotation**: *number* = (0.5 * Math.PI)
*Defined in [src/Settings.ts:130](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L130)*
The maximum angular velocity of a body. This limit is very large and is used
to prevent numerical problems. You shouldn't need to adjust Settings.
___
### `Static` maxSubSteps
▪ **maxSubSteps**: *number* = 8
*Defined in [src/Settings.ts:82](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L82)*
Maximum number of sub-steps per contact in continuous physics simulation.
___
### `Static` maxTOIContacts
▪ **maxTOIContacts**: *number* = 32
*Defined in [src/Settings.ts:89](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L89)*
Maximum number of contacts to be handled to solve a TOI impact.
___
### `Static` maxTOIIterations
▪ **maxTOIIterations**: *number* = 20
*Defined in [src/Settings.ts:94](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L94)*
Maximum iterations to solve a TOI.
___
### `Static` maxTranslation
▪ **maxTranslation**: *number* = 2
*Defined in [src/Settings.ts:123](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L123)*
The maximum linear velocity of a body. This limit is very large and is used
to prevent numerical problems. You shouldn't need to adjust Settings.
___
### `Static` timeToSleep
▪ **timeToSleep**: *number* = 0.5
*Defined in [src/Settings.ts:146](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L146)*
The time that a body must be still before it will go to sleep.
___
### `Static` toiBaugarte
▪ **toiBaugarte**: *number* = 0.75
*Defined in [src/Settings.ts:139](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L139)*
___
### `Static` velocityThreshold
▪ **velocityThreshold**: *number* = 1
*Defined in [src/Settings.ts:105](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L105)*
A velocity threshold for elastic collisions. Any collision with a relative
linear velocity below this threshold will be treated as inelastic.
## Accessors
### `Static` angularSleepToleranceSqr
• **get angularSleepToleranceSqr**(): *number*
*Defined in [src/Settings.ts:158](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L158)*
**Returns:** *number*
___
### `Static` linearSleepToleranceSqr
• **get linearSleepToleranceSqr**(): *number*
*Defined in [src/Settings.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L152)*
**Returns:** *number*
___
### `Static` linearSlopSquared
• **get linearSlopSquared**(): *number*
*Defined in [src/Settings.ts:63](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L63)*
**Returns:** *number*
___
### `Static` maxRotationSquared
• **get maxRotationSquared**(): *number*
*Defined in [src/Settings.ts:131](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L131)*
**Returns:** *number*
___
### `Static` maxTranslationSquared
• **get maxTranslationSquared**(): *number*
*Defined in [src/Settings.ts:124](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L124)*
**Returns:** *number*
___
### `Static` polygonRadius
• **get polygonRadius**(): *number*
*Defined in [src/Settings.ts:77](https://github.com/shakiba/planck.js/blob/acc3bd8/src/Settings.ts#L77)*
The radius of the polygon/edge shape skin. This should not be modified.
Making this smaller means polygons will have an insufficient buffer for
continuous collision. Making it larger may create artifacts for vertex
collision.
**Returns:** *number*

View File

@ -1,206 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Shape](shape.md)
# Class: Shape
A shape is used for collision detection. You can create a shape however you
like. Shapes used for simulation in World are created automatically when a
Fixture is created. Shapes may encapsulate one or more child shapes.
## Hierarchy
* **Shape**
↳ [CircleShape](circleshape.md)
↳ [EdgeShape](edgeshape.md)
↳ [PolygonShape](polygonshape.md)
↳ [ChainShape](chainshape.md)
## Index
### Properties
* [m_radius](shape.md#m_radius)
* [m_type](shape.md#m_type)
### Methods
* [computeAABB](shape.md#abstract-computeaabb)
* [computeDistanceProxy](shape.md#abstract-computedistanceproxy)
* [computeMass](shape.md#abstract-computemass)
* [getChildCount](shape.md#abstract-getchildcount)
* [getRadius](shape.md#getradius)
* [getType](shape.md#gettype)
* [rayCast](shape.md#abstract-raycast)
* [testPoint](shape.md#abstract-testpoint)
* [isValid](shape.md#static-isvalid)
## Properties
### m_radius
• **m_radius**: *number*
*Defined in [src/collision/Shape.ts:39](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L39)*
___
### m_type
• **m_type**: *[ShapeType](../globals.md#shapetype)*
*Defined in [src/collision/Shape.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L38)*
## Methods
### `Abstract` computeAABB
▸ **computeAABB**(`aabb`: [AABB](aabb.md), `xf`: [Transform](transform.md), `childIndex`: number): *void*
*Defined in [src/collision/Shape.ts:116](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L116)*
Given a transform, compute the associated axis aligned bounding box for a
child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`aabb` | [AABB](aabb.md) | Returns the axis aligned box. |
`xf` | [Transform](transform.md) | The world transform of the shape. |
`childIndex` | number | The child shape |
**Returns:** *void*
___
### `Abstract` computeDistanceProxy
▸ **computeDistanceProxy**(`proxy`: [DistanceProxy](distanceproxy.md), `childIndex`: number): *void*
*Defined in [src/collision/Shape.ts:127](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L127)*
**Parameters:**
Name | Type |
------ | ------ |
`proxy` | [DistanceProxy](distanceproxy.md) |
`childIndex` | number |
**Returns:** *void*
___
### `Abstract` computeMass
▸ **computeMass**(`massData`: [MassData](massdata.md), `density?`: number): *void*
*Defined in [src/collision/Shape.ts:125](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L125)*
Compute the mass properties of this shape using its dimensions and density.
The inertia tensor is computed about the local origin.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`massData` | [MassData](massdata.md) | Returns the mass data for this shape. |
`density?` | number | The density in kilograms per meter squared. |
**Returns:** *void*
___
### `Abstract` getChildCount
▸ **getChildCount**(): *number*
*Defined in [src/collision/Shape.ts:87](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L87)*
Get the number of child primitives.
**Returns:** *number*
___
### getRadius
▸ **getRadius**(): *number*
*Defined in [src/collision/Shape.ts:62](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L62)*
**Returns:** *number*
___
### getType
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
*Defined in [src/collision/Shape.ts:72](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L72)*
Get the type of this shape. You can use this to down cast to the concrete
shape.
**Returns:** *[ShapeType](../globals.md#shapetype)*
the shape type.
___
### `Abstract` rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `xf`: [Transform](transform.md), `childIndex`: number): *boolean*
*Defined in [src/collision/Shape.ts:106](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L106)*
Cast a ray against a child shape.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) | The ray-cast results. |
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input parameters. |
`xf` | [Transform](transform.md) | The transform to be applied to the shape. |
`childIndex` | number | The child shape index |
**Returns:** *boolean*
___
### `Abstract` testPoint
▸ **testPoint**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *boolean*
*Defined in [src/collision/Shape.ts:96](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L96)*
Test a point for containment in this shape. This only works for convex
shapes.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`xf` | [Transform](transform.md) | The shape world transform. |
`p` | [Vec2](vec2.md) | A point in world coordinates. |
**Returns:** *boolean*
___
### `Static` isValid
▸ **isValid**(`shape`: [Shape](shape.md) | null | undefined): *shape is Shape*
*Defined in [src/collision/Shape.ts:58](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L58)*
**Parameters:**
Name | Type |
------ | ------ |
`shape` | [Shape](shape.md) &#124; null &#124; undefined |
**Returns:** *shape is Shape*

View File

@ -1,196 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Simplex](simplex.md)
# Class: Simplex
## Hierarchy
* **Simplex**
## Index
### Constructors
* [constructor](simplex.md#constructor)
### Properties
* [m_count](simplex.md#m_count)
* [m_v](simplex.md#m_v)
* [m_v1](simplex.md#m_v1)
* [m_v2](simplex.md#m_v2)
* [m_v3](simplex.md#m_v3)
### Methods
* [getClosestPoint](simplex.md#getclosestpoint)
* [getMetric](simplex.md#getmetric)
* [getSearchDirection](simplex.md#getsearchdirection)
* [getWitnessPoints](simplex.md#getwitnesspoints)
* [readCache](simplex.md#readcache)
* [solve](simplex.md#solve)
* [solve2](simplex.md#solve2)
* [solve3](simplex.md#solve3)
* [writeCache](simplex.md#writecache)
## Constructors
### constructor
\+ **new Simplex**(): *[Simplex](simplex.md)*
*Defined in [src/collision/Distance.ts:325](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L325)*
**Returns:** *[Simplex](simplex.md)*
## Properties
### m_count
• **m_count**: *number*
*Defined in [src/collision/Distance.ts:325](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L325)*
___
### m_v
• **m_v**: *[SimplexVertex](simplexvertex.md)[]*
*Defined in [src/collision/Distance.ts:324](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L324)*
___
### m_v1
• **m_v1**: *[SimplexVertex](simplexvertex.md)*
*Defined in [src/collision/Distance.ts:321](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L321)*
___
### m_v2
• **m_v2**: *[SimplexVertex](simplexvertex.md)*
*Defined in [src/collision/Distance.ts:322](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L322)*
___
### m_v3
• **m_v3**: *[SimplexVertex](simplexvertex.md)*
*Defined in [src/collision/Distance.ts:323](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L323)*
## Methods
### getClosestPoint
▸ **getClosestPoint**(): *[Vec2](vec2.md)*
*Defined in [src/collision/Distance.ts:436](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L436)*
**Returns:** *[Vec2](vec2.md)*
___
### getMetric
▸ **getMetric**(): *number*
*Defined in [src/collision/Distance.ts:485](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L485)*
**Returns:** *number*
___
### getSearchDirection
▸ **getSearchDirection**(): *[Vec2](vec2.md)*
*Defined in [src/collision/Distance.ts:413](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L413)*
**Returns:** *[Vec2](vec2.md)*
___
### getWitnessPoints
▸ **getWitnessPoints**(`pA`: [Vec2](vec2.md), `pB`: [Vec2](vec2.md)): *void*
*Defined in [src/collision/Distance.ts:457](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L457)*
**Parameters:**
Name | Type |
------ | ------ |
`pA` | [Vec2](vec2.md) |
`pB` | [Vec2](vec2.md) |
**Returns:** *void*
___
### readCache
▸ **readCache**(`cache`: [SimplexCache](simplexcache.md), `proxyA`: [DistanceProxy](distanceproxy.md), `transformA`: [Transform](transform.md), `proxyB`: [DistanceProxy](distanceproxy.md), `transformB`: [Transform](transform.md)): *void*
*Defined in [src/collision/Distance.ts:360](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L360)*
**Parameters:**
Name | Type |
------ | ------ |
`cache` | [SimplexCache](simplexcache.md) |
`proxyA` | [DistanceProxy](distanceproxy.md) |
`transformA` | [Transform](transform.md) |
`proxyB` | [DistanceProxy](distanceproxy.md) |
`transformB` | [Transform](transform.md) |
**Returns:** *void*
___
### solve
▸ **solve**(): *void*
*Defined in [src/collision/Distance.ts:507](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L507)*
**Returns:** *void*
___
### solve2
▸ **solve2**(): *void*
*Defined in [src/collision/Distance.ts:548](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L548)*
**Returns:** *void*
___
### solve3
▸ **solve3**(): *void*
*Defined in [src/collision/Distance.ts:584](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L584)*
**Returns:** *void*
___
### writeCache
▸ **writeCache**(`cache`: [SimplexCache](simplexcache.md)): *void*
*Defined in [src/collision/Distance.ts:404](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L404)*
**Parameters:**
Name | Type |
------ | ------ |
`cache` | [SimplexCache](simplexcache.md) |
**Returns:** *void*

View File

@ -1,58 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [SimplexCache](simplexcache.md)
# Class: SimplexCache
Used to warm start Distance. Set count to zero on first call.
**`prop`** {number} metric length or area
**`prop`** {array} indexA vertices on shape A
**`prop`** {array} indexB vertices on shape B
**`prop`** {number} count
## Hierarchy
* **SimplexCache**
## Index
### Properties
* [count](simplexcache.md#count)
* [indexA](simplexcache.md#indexa)
* [indexB](simplexcache.md#indexb)
* [metric](simplexcache.md#metric)
## Properties
### count
• **count**: *number* = 0
*Defined in [src/collision/Distance.ts:86](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L86)*
___
### indexA
• **indexA**: *number[]* = []
*Defined in [src/collision/Distance.ts:84](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L84)*
___
### indexB
• **indexB**: *number[]* = []
*Defined in [src/collision/Distance.ts:85](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L85)*
___
### metric
• **metric**: *number* = 0
*Defined in [src/collision/Distance.ts:83](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L83)*

View File

@ -1,98 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [SimplexVertex](simplexvertex.md)
# Class: SimplexVertex
## Hierarchy
* **SimplexVertex**
## Index
### Properties
* [a](simplexvertex.md#a)
* [indexA](simplexvertex.md#indexa)
* [indexB](simplexvertex.md#indexb)
* [w](simplexvertex.md#w)
* [wA](simplexvertex.md#wa)
* [wB](simplexvertex.md#wb)
### Methods
* [set](simplexvertex.md#set)
## Properties
### a
• **a**: *number*
*Defined in [src/collision/Distance.ts:308](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L308)*
barycentric coordinate for closest point
___
### indexA
• **indexA**: *number*
*Defined in [src/collision/Distance.ts:298](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L298)*
wA index
___
### indexB
• **indexB**: *number*
*Defined in [src/collision/Distance.ts:303](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L303)*
wB index
___
### w
• **w**: *[Vec2](vec2.md)* = Vec2.zero()
*Defined in [src/collision/Distance.ts:306](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L306)*
wB - wA;
___
### wA
• **wA**: *[Vec2](vec2.md)* = Vec2.zero()
*Defined in [src/collision/Distance.ts:296](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L296)*
support point in proxyA
___
### wB
• **wB**: *[Vec2](vec2.md)* = Vec2.zero()
*Defined in [src/collision/Distance.ts:301](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L301)*
support point in proxyB
## Methods
### set
▸ **set**(`v`: [SimplexVertex](simplexvertex.md)): *void*
*Defined in [src/collision/Distance.ts:310](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Distance.ts#L310)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [SimplexVertex](simplexvertex.md) |
**Returns:** *void*

View File

@ -1,216 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Solver](solver.md)
# Class: Solver
Finds and solves islands. An island is a connected subset of the world.
## Hierarchy
* **Solver**
## Index
### Constructors
* [constructor](solver.md#constructor)
### Properties
* [m_bodies](solver.md#m_bodies)
* [m_contacts](solver.md#m_contacts)
* [m_joints](solver.md#m_joints)
* [m_stack](solver.md#m_stack)
* [m_world](solver.md#m_world)
### Methods
* [addBody](solver.md#addbody)
* [addContact](solver.md#addcontact)
* [addJoint](solver.md#addjoint)
* [clear](solver.md#clear)
* [solveIsland](solver.md#solveisland)
* [solveIslandTOI](solver.md#solveislandtoi)
* [solveWorld](solver.md#solveworld)
* [solveWorldTOI](solver.md#solveworldtoi)
## Constructors
### constructor
\+ **new Solver**(`world`: [World](world.md)): *[Solver](solver.md)*
*Defined in [src/dynamics/Solver.ts:116](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L116)*
**Parameters:**
Name | Type |
------ | ------ |
`world` | [World](world.md) |
**Returns:** *[Solver](solver.md)*
## Properties
### m_bodies
• **m_bodies**: *[Body](body.md)[]*
*Defined in [src/dynamics/Solver.ts:114](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L114)*
___
### m_contacts
• **m_contacts**: *[Contact](contact.md)[]*
*Defined in [src/dynamics/Solver.ts:115](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L115)*
___
### m_joints
• **m_joints**: *[Joint](joint.md)[]*
*Defined in [src/dynamics/Solver.ts:116](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L116)*
___
### m_stack
• **m_stack**: *[Body](body.md)[]*
*Defined in [src/dynamics/Solver.ts:113](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L113)*
___
### m_world
• **m_world**: *[World](world.md)*
*Defined in [src/dynamics/Solver.ts:112](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L112)*
## Methods
### addBody
▸ **addBody**(`body`: [Body](body.md)): *void*
*Defined in [src/dynamics/Solver.ts:133](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L133)*
**Parameters:**
Name | Type |
------ | ------ |
`body` | [Body](body.md) |
**Returns:** *void*
___
### addContact
▸ **addContact**(`contact`: [Contact](contact.md)): *void*
*Defined in [src/dynamics/Solver.ts:143](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L143)*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
**Returns:** *void*
___
### addJoint
▸ **addJoint**(`joint`: [Joint](joint.md)): *void*
*Defined in [src/dynamics/Solver.ts:148](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L148)*
**Parameters:**
Name | Type |
------ | ------ |
`joint` | [Joint](joint.md) |
**Returns:** *void*
___
### clear
▸ **clear**(): *void*
*Defined in [src/dynamics/Solver.ts:126](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L126)*
**Returns:** *void*
___
### solveIsland
▸ **solveIsland**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Solver.ts:284](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L284)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### solveIslandTOI
▸ **solveIslandTOI**(`subStep`: [TimeStep](timestep.md), `toiA`: [Body](body.md), `toiB`: [Body](body.md)): *void*
*Defined in [src/dynamics/Solver.ts:782](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L782)*
**Parameters:**
Name | Type |
------ | ------ |
`subStep` | [TimeStep](timestep.md) |
`toiA` | [Body](body.md) |
`toiB` | [Body](body.md) |
**Returns:** *void*
___
### solveWorld
▸ **solveWorld**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Solver.ts:153](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L153)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*
___
### solveWorldTOI
▸ **solveWorldTOI**(`step`: [TimeStep](timestep.md)): *void*
*Defined in [src/dynamics/Solver.ts:504](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L504)*
Find TOI contacts and solve them.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
**Returns:** *void*

View File

@ -1,229 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Sweep](sweep.md)
# Class: Sweep
This describes the motion of a body/shape for TOI computation. Shapes are
defined with respect to the body origin, which may not coincide with the
center of mass. However, to support dynamics we must interpolate the center
of mass position.
## Hierarchy
* **Sweep**
## Index
### Constructors
* [constructor](sweep.md#constructor)
### Properties
* [a](sweep.md#a)
* [a0](sweep.md#a0)
* [alpha0](sweep.md#alpha0)
* [c](sweep.md#c)
* [c0](sweep.md#c0)
* [localCenter](sweep.md#localcenter)
### Methods
* [advance](sweep.md#advance)
* [clone](sweep.md#clone)
* [forward](sweep.md#forward)
* [getTransform](sweep.md#gettransform)
* [normalize](sweep.md#normalize)
* [set](sweep.md#set)
* [setLocalCenter](sweep.md#setlocalcenter)
* [setTransform](sweep.md#settransform)
## Constructors
### constructor
\+ **new Sweep**(`c?`: [Vec2](vec2.md), `a?`: number): *[Sweep](sweep.md)*
*Defined in [src/common/Sweep.ts:55](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L55)*
**Parameters:**
Name | Type |
------ | ------ |
`c?` | [Vec2](vec2.md) |
`a?` | number |
**Returns:** *[Sweep](sweep.md)*
## Properties
### a
• **a**: *number*
*Defined in [src/common/Sweep.ts:49](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L49)*
World angle
___
### a0
• **a0**: *number*
*Defined in [src/common/Sweep.ts:55](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L55)*
___
### alpha0
• **alpha0**: *number*
*Defined in [src/common/Sweep.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L52)*
Fraction of the current time step in the range [0,1], c0 and a0 are c and a at alpha0.
___
### c
• **c**: *[Vec2](vec2.md)*
*Defined in [src/common/Sweep.ts:46](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L46)*
World center position
___
### c0
• **c0**: *[Vec2](vec2.md)*
*Defined in [src/common/Sweep.ts:54](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L54)*
___
### localCenter
• **localCenter**: *[Vec2](vec2.md)*
*Defined in [src/common/Sweep.ts:43](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L43)*
Local center of mass position
## Methods
### advance
▸ **advance**(`alpha`: number): *void*
*Defined in [src/common/Sweep.ts:105](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L105)*
Advance the sweep forward, yielding a new initial state.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`alpha` | number | The new initial time |
**Returns:** *void*
___
### clone
▸ **clone**(): *[Sweep](sweep.md)*
*Defined in [src/common/Sweep.ts:127](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L127)*
**Returns:** *[Sweep](sweep.md)*
___
### forward
▸ **forward**(): *void*
*Defined in [src/common/Sweep.ts:113](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L113)*
**Returns:** *void*
___
### getTransform
▸ **getTransform**(`xf`: [Transform](transform.md), `beta`: number): *void*
*Defined in [src/common/Sweep.ts:91](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L91)*
Get the interpolated transform at a specific time.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`xf` | [Transform](transform.md) | - |
`beta` | number | A factor in [0,1], where 0 indicates alpha0 |
**Returns:** *void*
___
### normalize
▸ **normalize**(): *void*
*Defined in [src/common/Sweep.ts:121](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L121)*
normalize the angles in radians to be between -pi and pi.
**Returns:** *void*
___
### set
▸ **set**(`that`: [Sweep](sweep.md)): *void*
*Defined in [src/common/Sweep.ts:138](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L138)*
**Parameters:**
Name | Type |
------ | ------ |
`that` | [Sweep](sweep.md) |
**Returns:** *void*
___
### setLocalCenter
▸ **setLocalCenter**(`localCenter`: [Vec2](vec2.md), `xf`: [Transform](transform.md)): *void*
*Defined in [src/common/Sweep.ts:77](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L77)*
**Parameters:**
Name | Type |
------ | ------ |
`localCenter` | [Vec2](vec2.md) |
`xf` | [Transform](transform.md) |
**Returns:** *void*
___
### setTransform
▸ **setTransform**(`xf`: [Transform](transform.md)): *void*
*Defined in [src/common/Sweep.ts:68](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Sweep.ts#L68)*
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
**Returns:** *void*

View File

@ -1,41 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [TempPolygon](temppolygon.md)
# Class: TempPolygon
This holds polygon B expressed in frame A.
## Hierarchy
* **TempPolygon**
## Index
### Properties
* [count](temppolygon.md#count)
* [normals](temppolygon.md#normals)
* [vertices](temppolygon.md#vertices)
## Properties
### count
• **count**: *number* = 0
*Defined in [src/collision/shape/CollideEdgePolygon.ts:91](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L91)*
___
### normals
• **normals**: *[Vec2](vec2.md)[]* = []
*Defined in [src/collision/shape/CollideEdgePolygon.ts:90](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L90)*
___
### vertices
• **vertices**: *[Vec2](vec2.md)[]* = []
*Defined in [src/collision/shape/CollideEdgePolygon.ts:89](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/CollideEdgePolygon.ts#L89)*

View File

@ -1,112 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [TimeStep](timestep.md)
# Class: TimeStep
## Hierarchy
* **TimeStep**
## Index
### Properties
* [blockSolve](timestep.md#blocksolve)
* [dt](timestep.md#dt)
* [dtRatio](timestep.md#dtratio)
* [inv_dt](timestep.md#inv_dt)
* [inv_dt0](timestep.md#inv_dt0)
* [positionIterations](timestep.md#positioniterations)
* [velocityIterations](timestep.md#velocityiterations)
* [warmStarting](timestep.md#warmstarting)
### Methods
* [reset](timestep.md#reset)
## Properties
### blockSolve
• **blockSolve**: *boolean* = true
*Defined in [src/dynamics/Solver.ts:49](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L49)*
___
### dt
• **dt**: *number* = 0
*Defined in [src/dynamics/Solver.ts:43](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L43)*
time step
___
### dtRatio
• **dtRatio**: *number* = 1
*Defined in [src/dynamics/Solver.ts:54](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L54)*
dt * inv_dt0
___
### inv_dt
• **inv_dt**: *number* = 0
*Defined in [src/dynamics/Solver.ts:45](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L45)*
inverse time step (0 if dt == 0)
___
### inv_dt0
• **inv_dt0**: *number* = 0
*Defined in [src/dynamics/Solver.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L52)*
timestep ratio for variable timestep
___
### positionIterations
• **positionIterations**: *number* = 0
*Defined in [src/dynamics/Solver.ts:47](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L47)*
___
### velocityIterations
• **velocityIterations**: *number* = 0
*Defined in [src/dynamics/Solver.ts:46](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L46)*
___
### warmStarting
• **warmStarting**: *boolean* = false
*Defined in [src/dynamics/Solver.ts:48](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L48)*
## Methods
### reset
▸ **reset**(`dt`: number): *void*
*Defined in [src/dynamics/Solver.ts:56](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L56)*
**Parameters:**
Name | Type |
------ | ------ |
`dt` | number |
**Returns:** *void*

View File

@ -1,61 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [TOIInput](toiinput.md)
# Class: TOIInput
Input parameters for TimeOfImpact.
## Hierarchy
* **TOIInput**
## Index
### Properties
* [proxyA](toiinput.md#proxya)
* [proxyB](toiinput.md#proxyb)
* [sweepA](toiinput.md#sweepa)
* [sweepB](toiinput.md#sweepb)
* [tMax](toiinput.md#tmax)
## Properties
### proxyA
• **proxyA**: *[DistanceProxy](distanceproxy.md)* = new DistanceProxy()
*Defined in [src/collision/TimeOfImpact.ts:47](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L47)*
___
### proxyB
• **proxyB**: *[DistanceProxy](distanceproxy.md)* = new DistanceProxy()
*Defined in [src/collision/TimeOfImpact.ts:48](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L48)*
___
### sweepA
• **sweepA**: *[Sweep](sweep.md)* = new Sweep()
*Defined in [src/collision/TimeOfImpact.ts:49](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L49)*
___
### sweepB
• **sweepB**: *[Sweep](sweep.md)* = new Sweep()
*Defined in [src/collision/TimeOfImpact.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L50)*
___
### tMax
• **tMax**: *number | undefined*
*Defined in [src/collision/TimeOfImpact.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L52)*
defines sweep interval [0, tMax]

View File

@ -1,32 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [TOIOutput](toioutput.md)
# Class: TOIOutput
Output parameters for TimeOfImpact.
## Hierarchy
* **TOIOutput**
## Index
### Properties
* [state](toioutput.md#state)
* [t](toioutput.md#t)
## Properties
### state
• **state**: *[TOIOutputState](../enums/toioutputstate.md) | undefined*
*Defined in [src/collision/TimeOfImpact.ts:67](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L67)*
___
### t
• **t**: *number | undefined*
*Defined in [src/collision/TimeOfImpact.ts:68](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/TimeOfImpact.ts#L68)*

View File

@ -1,336 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Transform](transform.md)
# Class: Transform
A transform contains translation and rotation. It is used to represent the
position and orientation of rigid frames. Initialize using a position vector
and a rotation.
## Hierarchy
* **Transform**
## Index
### Constructors
* [constructor](transform.md#constructor)
### Properties
* [p](transform.md#p)
* [q](transform.md#q)
### Methods
* [set](transform.md#set)
* [setIdentity](transform.md#setidentity)
* [assert](transform.md#static-assert)
* [clone](transform.md#static-clone)
* [identity](transform.md#static-identity)
* [isValid](transform.md#static-isvalid)
* [mul](transform.md#static-mul)
* [mulAll](transform.md#static-mulall)
* [mulT](transform.md#static-mult)
* [mulTVec2](transform.md#static-multvec2)
* [mulTXf](transform.md#static-multxf)
* [mulVec2](transform.md#static-mulvec2)
* [mulXf](transform.md#static-mulxf)
## Constructors
### constructor
\+ **new Transform**(`position?`: [Vec2](vec2.md), `rotation?`: number): *[Transform](transform.md)*
*Defined in [src/common/Transform.ts:44](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L44)*
**Parameters:**
Name | Type |
------ | ------ |
`position?` | [Vec2](vec2.md) |
`rotation?` | number |
**Returns:** *[Transform](transform.md)*
## Properties
### p
• **p**: *[Vec2](vec2.md)*
*Defined in [src/common/Transform.ts:41](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L41)*
position
___
### q
• **q**: *[Rot](rot.md)*
*Defined in [src/common/Transform.ts:44](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L44)*
rotation
## Methods
### set
▸ **set**(`position`: [Vec2](vec2.md), `rotation`: number): *void*
*Defined in [src/common/Transform.ts:90](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L90)*
Set this based on the position and angle.
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`rotation` | number |
**Returns:** *void*
▸ **set**(`xf`: [Transform](transform.md)): *void*
*Defined in [src/common/Transform.ts:91](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L91)*
Set this based on the position and angle.
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
**Returns:** *void*
___
### setIdentity
▸ **setIdentity**(): *void*
*Defined in [src/common/Transform.ts:85](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L85)*
Set this to the identity transform.
**Returns:** *void*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [src/common/Transform.ts:110](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L110)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` clone
▸ **clone**(`xf`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [src/common/Transform.ts:60](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L60)*
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*
___
### `Static` identity
▸ **identity**(): *[Transform](transform.md)*
*Defined in [src/common/Transform.ts:75](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L75)*
**Returns:** *[Transform](transform.md)*
___
### `Static` isValid
▸ **isValid**(`o`: any): *boolean*
*Defined in [src/common/Transform.ts:106](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L106)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *boolean*
___
### `Static` mul
▸ **mul**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Transform.ts:118](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L118)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
▸ **mul**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [src/common/Transform.ts:119](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L119)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*
___
### `Static` mulAll
▸ **mulAll**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)[]): *[Vec2](vec2.md)[]*
*Defined in [src/common/Transform.ts:140](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L140)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md)[] |
**Returns:** *[Vec2](vec2.md)[]*
▸ **mulAll**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)[]): *[Transform](transform.md)[]*
*Defined in [src/common/Transform.ts:141](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L141)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md)[] |
**Returns:** *[Transform](transform.md)[]*
___
### `Static` mulT
▸ **mulT**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Transform.ts:180](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L180)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
▸ **mulT**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [src/common/Transform.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*
___
### `Static` mulTVec2
▸ **mulTVec2**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Transform.ts:192](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L192)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulTXf
▸ **mulTXf**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [src/common/Transform.ts:202](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L202)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*
___
### `Static` mulVec2
▸ **mulVec2**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Transform.ts:161](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L161)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulXf
▸ **mulXf**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [src/common/Transform.ts:169](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Transform.ts#L169)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*

View File

@ -1,130 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [TreeNode](treenode.md)
# Class: TreeNode ‹**T**›
A node in the dynamic tree. The client does not interact with this directly.
## Type parameters
▪ **T**
## Hierarchy
* **TreeNode**
## Index
### Constructors
* [constructor](treenode.md#constructor)
### Properties
* [aabb](treenode.md#aabb)
* [child1](treenode.md#child1)
* [child2](treenode.md#child2)
* [height](treenode.md#height)
* [id](treenode.md#id)
* [parent](treenode.md#parent)
* [userData](treenode.md#userdata)
### Methods
* [isLeaf](treenode.md#isleaf)
* [toString](treenode.md#tostring)
## Constructors
### constructor
\+ **new TreeNode**(`id?`: number): *[TreeNode](treenode.md)*
*Defined in [src/collision/DynamicTree.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L50)*
**Parameters:**
Name | Type |
------ | ------ |
`id?` | number |
**Returns:** *[TreeNode](treenode.md)*
## Properties
### aabb
• **aabb**: *[AABB](aabb.md)* = new AABB()
*Defined in [src/collision/DynamicTree.ts:44](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L44)*
Enlarged AABB
___
### child1
• **child1**: *[TreeNode](treenode.md)‹T›* = null
*Defined in [src/collision/DynamicTree.ts:47](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L47)*
___
### child2
• **child2**: *[TreeNode](treenode.md)‹T›* = null
*Defined in [src/collision/DynamicTree.ts:48](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L48)*
___
### height
• **height**: *number* = -1
*Defined in [src/collision/DynamicTree.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L50)*
0: leaf, -1: free node
___
### id
• **id**: *number*
*Defined in [src/collision/DynamicTree.ts:42](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L42)*
___
### parent
• **parent**: *[TreeNode](treenode.md)‹T›* = null
*Defined in [src/collision/DynamicTree.ts:46](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L46)*
___
### userData
• **userData**: *T* = null
*Defined in [src/collision/DynamicTree.ts:45](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L45)*
## Methods
### isLeaf
▸ **isLeaf**(): *boolean*
*Defined in [src/collision/DynamicTree.ts:60](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L60)*
**Returns:** *boolean*
___
### toString
▸ **toString**(): *string*
*Defined in [src/collision/DynamicTree.ts:56](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L56)*
**Returns:** *string*

View File

@ -1,912 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Vec2](vec2.md)
# Class: Vec2
## Hierarchy
* **Vec2**
## Index
### Constructors
* [constructor](vec2.md#constructor)
### Properties
* [x](vec2.md#x)
* [y](vec2.md#y)
### Methods
* [add](vec2.md#add)
* [addCombine](vec2.md#addcombine)
* [addMul](vec2.md#addmul)
* [clamp](vec2.md#clamp)
* [clone](vec2.md#clone)
* [length](vec2.md#length)
* [lengthSquared](vec2.md#lengthsquared)
* [mul](vec2.md#mul)
* [neg](vec2.md#neg)
* [normalize](vec2.md#normalize)
* [set](vec2.md#set)
* [setCombine](vec2.md#setcombine)
* [setMul](vec2.md#setmul)
* [setZero](vec2.md#setzero)
* [sub](vec2.md#sub)
* [subCombine](vec2.md#subcombine)
* [subMul](vec2.md#submul)
* [toString](vec2.md#tostring)
* [wSub](vec2.md#wsub)
* [abs](vec2.md#static-abs)
* [add](vec2.md#static-add)
* [addCross](vec2.md#static-addcross)
* [areEqual](vec2.md#static-areequal)
* [assert](vec2.md#static-assert)
* [clamp](vec2.md#static-clamp)
* [clone](vec2.md#static-clone)
* [combine](vec2.md#static-combine)
* [cross](vec2.md#static-cross)
* [distance](vec2.md#static-distance)
* [distanceSquared](vec2.md#static-distancesquared)
* [dot](vec2.md#static-dot)
* [isValid](vec2.md#static-isvalid)
* [lengthOf](vec2.md#static-lengthof)
* [lengthSquared](vec2.md#static-lengthsquared)
* [lower](vec2.md#static-lower)
* [mid](vec2.md#static-mid)
* [mul](vec2.md#static-mul)
* [neg](vec2.md#static-neg)
* [skew](vec2.md#static-skew)
* [sub](vec2.md#static-sub)
* [upper](vec2.md#static-upper)
* [zero](vec2.md#static-zero)
## Constructors
### constructor
\+ **new Vec2**(`x`: number, `y`: number): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:35](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L35)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Vec2](vec2.md)*
\+ **new Vec2**(`obj`: object): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:37](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L37)*
**Parameters:**
▪ **obj**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Vec2](vec2.md)*
\+ **new Vec2**(): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L38)*
**Returns:** *[Vec2](vec2.md)*
## Properties
### x
• **x**: *number*
*Defined in [src/common/Vec2.ts:34](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L34)*
___
### y
• **y**: *number*
*Defined in [src/common/Vec2.ts:35](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L35)*
## Methods
### add
▸ **add**(`w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:196](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L196)*
Add a vector to this vector.
**Parameters:**
Name | Type |
------ | ------ |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
this
___
### addCombine
▸ **addCombine**(`a`: number, `v`: [Vec2](vec2.md), `b`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:218](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L218)*
Add linear combination of v and w: `a * v + b * w`
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
`b` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### addMul
▸ **addMul**(`a`: number, `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:233](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L233)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### clamp
▸ **clamp**(`max`: number): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:519](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L519)*
**Parameters:**
Name | Type |
------ | ------ |
`max` | number |
**Returns:** *[Vec2](vec2.md)*
___
### clone
▸ **clone**(): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:114](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L114)*
**Returns:** *[Vec2](vec2.md)*
___
### length
▸ **length**(): *number*
*Defined in [src/common/Vec2.ts:311](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L311)*
Get the length of this vector (the norm).
For performance, use this instead of lengthSquared (if possible).
**Returns:** *number*
___
### lengthSquared
▸ **lengthSquared**(): *number*
*Defined in [src/common/Vec2.ts:318](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L318)*
Get the length squared.
**Returns:** *number*
___
### mul
▸ **mul**(`m`: number): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:299](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L299)*
Multiply this vector by a scalar.
**Parameters:**
Name | Type |
------ | ------ |
`m` | number |
**Returns:** *[Vec2](vec2.md)*
this
___
### neg
▸ **neg**(): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:485](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L485)*
**Returns:** *[Vec2](vec2.md)*
___
### normalize
▸ **normalize**(): *number*
*Defined in [src/common/Vec2.ts:327](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L327)*
Convert this vector into a unit vector.
**Returns:** *number*
old length
___
### set
▸ **set**(`x`: number, `y`: number): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:129](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L129)*
Set this vector to some specified coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Vec2](vec2.md)*
this
▸ **set**(`value`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:130](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L130)*
Set this vector to some specified coordinates.
**Parameters:**
Name | Type |
------ | ------ |
`value` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
this
___
### setCombine
▸ **setCombine**(`a`: number, `v`: [Vec2](vec2.md), `b`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L166)*
Set linear combination of v and w: `a * v + b * w`
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
`b` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### setMul
▸ **setMul**(`a`: number, `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:180](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L180)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### setZero
▸ **setZero**(): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:123](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L123)*
Set this vector to all zeros.
**Returns:** *[Vec2](vec2.md)*
this
___
### sub
▸ **sub**(`w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:287](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L287)*
Subtract a vector from this vector
**Parameters:**
Name | Type |
------ | ------ |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
this
___
### subCombine
▸ **subCombine**(`a`: number, `v`: [Vec2](vec2.md), `b`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:257](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L257)*
Subtract linear combination of v and w: `a * v + b * w`
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
`b` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### subMul
▸ **subMul**(`a`: number, `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:271](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L271)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### toString
▸ **toString**(): *string*
*Defined in [src/common/Vec2.ts:95](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L95)*
**Returns:** *string*
___
### wSub
▸ **wSub**(`a`: number, `v`: [Vec2](vec2.md), `b?`: number, `w?`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:247](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L247)*
**`deprecated`** Use subCombine or subMul
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
`b?` | number |
`w?` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` abs
▸ **abs**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:496](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L496)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` add
▸ **add**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:444](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L444)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` addCross
▸ **addCross**(`a`: [Vec2](vec2.md), `v`: [Vec2](vec2.md), `w`: number): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:423](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L423)*
Returns `a + (v x w)`
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`v` | [Vec2](vec2.md) |
`w` | number |
**Returns:** *[Vec2](vec2.md)*
▸ **addCross**(`a`: [Vec2](vec2.md), `v`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:424](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L424)*
Returns `a + (v x w)`
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`v` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` areEqual
▸ **areEqual**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *boolean*
*Defined in [src/common/Vec2.ts:372](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L372)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *boolean*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [src/common/Vec2.ts:106](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L106)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` clamp
▸ **clamp**(`v`: [Vec2](vec2.md), `max`: number): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:529](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L529)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`max` | number |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` clone
▸ **clone**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:90](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L90)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` combine
▸ **combine**(`a`: number, `v`: [Vec2](vec2.md), `b`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:459](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L459)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
`b` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` cross
▸ **cross**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *number*
*Defined in [src/common/Vec2.ts:395](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L395)*
Perform the cross product on two vectors. In 2D this produces a scalar.
Perform the cross product on a vector and a scalar. In 2D this produces a
vector.
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *number*
▸ **cross**(`v`: [Vec2](vec2.md), `w`: number): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:396](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L396)*
Perform the cross product on two vectors. In 2D this produces a scalar.
Perform the cross product on a vector and a scalar. In 2D this produces a
vector.
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | number |
**Returns:** *[Vec2](vec2.md)*
▸ **cross**(`v`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:397](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L397)*
Perform the cross product on two vectors. In 2D this produces a scalar.
Perform the cross product on a vector and a scalar. In 2D this produces a
vector.
**Parameters:**
Name | Type |
------ | ------ |
`v` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` distance
▸ **distance**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *number*
*Defined in [src/common/Vec2.ts:356](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L356)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` distanceSquared
▸ **distanceSquared**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *number*
*Defined in [src/common/Vec2.ts:364](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L364)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` dot
▸ **dot**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *number*
*Defined in [src/common/Vec2.ts:389](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L389)*
Perform the dot product on two vectors.
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` isValid
▸ **isValid**(`v`: any): *boolean*
*Defined in [src/common/Vec2.ts:102](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L102)*
Does this vector contain finite coordinates?
**Parameters:**
Name | Type |
------ | ------ |
`v` | any |
**Returns:** *boolean*
___
### `Static` lengthOf
▸ **lengthOf**(`v`: [Vec2](vec2.md)): *number*
*Defined in [src/common/Vec2.ts:343](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L343)*
Get the length of this vector (the norm).
For performance, use this instead of lengthSquared (if possible).
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` lengthSquared
▸ **lengthSquared**(`v`: [Vec2](vec2.md)): *number*
*Defined in [src/common/Vec2.ts:351](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L351)*
Get the length squared.
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` lower
▸ **lower**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:513](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L513)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mid
▸ **mid**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:501](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L501)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mul
▸ **mul**(`a`: [Vec2](vec2.md), `b`: number): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:469](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L469)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`b` | number |
**Returns:** *[Vec2](vec2.md)*
▸ **mul**(`a`: number, `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:470](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L470)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` neg
▸ **neg**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:491](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L491)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` skew
▸ **skew**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:381](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L381)*
Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` sub
▸ **sub**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:463](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L463)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` upper
▸ **upper**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:507](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L507)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` zero
▸ **zero**(): *[Vec2](vec2.md)*
*Defined in [src/common/Vec2.ts:75](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec2.ts#L75)*
**Returns:** *[Vec2](vec2.md)*

View File

@ -1,382 +0,0 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Vec3](vec3.md)
# Class: Vec3
## Hierarchy
* **Vec3**
## Index
### Constructors
* [constructor](vec3.md#constructor)
### Properties
* [x](vec3.md#x)
* [y](vec3.md#y)
* [z](vec3.md#z)
### Methods
* [add](vec3.md#add)
* [mul](vec3.md#mul)
* [neg](vec3.md#neg)
* [set](vec3.md#set)
* [setZero](vec3.md#setzero)
* [sub](vec3.md#sub)
* [toString](vec3.md#tostring)
* [add](vec3.md#static-add)
* [areEqual](vec3.md#static-areequal)
* [assert](vec3.md#static-assert)
* [clone](vec3.md#static-clone)
* [cross](vec3.md#static-cross)
* [dot](vec3.md#static-dot)
* [isValid](vec3.md#static-isvalid)
* [mul](vec3.md#static-mul)
* [neg](vec3.md#static-neg)
* [sub](vec3.md#static-sub)
* [zero](vec3.md#static-zero)
## Constructors
### constructor
\+ **new Vec3**(`x`: number, `y`: number, `z`: number): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:36](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L36)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
`z` | number |
**Returns:** *[Vec3](vec3.md)*
\+ **new Vec3**(`obj`: object): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L38)*
**Parameters:**
▪ **obj**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
`z` | number |
**Returns:** *[Vec3](vec3.md)*
\+ **new Vec3**(): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:39](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L39)*
**Returns:** *[Vec3](vec3.md)*
## Properties
### x
• **x**: *number*
*Defined in [src/common/Vec3.ts:34](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L34)*
___
### y
• **y**: *number*
*Defined in [src/common/Vec3.ts:35](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L35)*
___
### z
• **z**: *number*
*Defined in [src/common/Vec3.ts:36](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L36)*
## Methods
### add
▸ **add**(`w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:136](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L136)*
**Parameters:**
Name | Type |
------ | ------ |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### mul
▸ **mul**(`m`: number): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:150](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L150)*
**Parameters:**
Name | Type |
------ | ------ |
`m` | number |
**Returns:** *[Vec3](vec3.md)*
___
### neg
▸ **neg**(): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:196](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L196)*
**Returns:** *[Vec3](vec3.md)*
___
### set
▸ **set**(`x`: number, `y`: number, `z`: number): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:129](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L129)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
`z` | number |
**Returns:** *[Vec3](vec3.md)*
___
### setZero
▸ **setZero**(): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:122](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L122)*
**Returns:** *[Vec3](vec3.md)*
___
### sub
▸ **sub**(`w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:143](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L143)*
**Parameters:**
Name | Type |
------ | ------ |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### toString
▸ **toString**(): *string*
*Defined in [src/common/Vec3.ts:103](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L103)*
**Returns:** *string*
___
### `Static` add
▸ **add**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:184](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L184)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` areEqual
▸ **areEqual**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *boolean*
*Defined in [src/common/Vec3.ts:157](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L157)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *boolean*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [src/common/Vec3.ts:114](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L114)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` clone
▸ **clone**(`v`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:98](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L98)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` cross
▸ **cross**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:176](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L176)*
Perform the cross product on two vectors. In 2D this produces a scalar.
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` dot
▸ **dot**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *number*
*Defined in [src/common/Vec3.ts:169](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L169)*
Perform the dot product on two vectors.
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *number*
___
### `Static` isValid
▸ **isValid**(`v`: any): *boolean*
*Defined in [src/common/Vec3.ts:110](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L110)*
Does this vector contain finite coordinates?
**Parameters:**
Name | Type |
------ | ------ |
`v` | any |
**Returns:** *boolean*
___
### `Static` mul
▸ **mul**(`v`: [Vec3](vec3.md), `m`: number): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:192](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L192)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`m` | number |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` neg
▸ **neg**(`v`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:203](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L203)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` sub
▸ **sub**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:188](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L188)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` zero
▸ **zero**(): *[Vec3](vec3.md)*
*Defined in [src/common/Vec3.ts:90](https://github.com/shakiba/planck.js/blob/acc3bd8/src/common/Vec3.ts#L90)*
**Returns:** *[Vec3](vec3.md)*

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