Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4 #27

Merged
merged 70 commits into from
Feb 5, 2024
Merged

V4 #27

merged 70 commits into from
Feb 5, 2024

Conversation

dmnsgn
Copy link
Member

@dmnsgn dmnsgn commented Feb 11, 2022

Changes:

  • refactor: convert to esm
  • feat: export _fromMat39 in quat
  • refactor: replace mat3 let with const
  • refactor: replace mat4 _rotate3 let with const
  • perf: remove assert (performance gain)
  • refactor: remove 1.0 and 0.0
  • feat: add EPSILON
  • perf: replace slice(0) with slice()
  • perf: _rotate3 has useless multiplication by zero
  • refactor: mat4._lookAt9 is duplicate of mat4.lookAt
  • refactor: mat4._lookAt9 return identity if < epsilon
  • perf: mat4._lookAt9 has early let declarations
  • perf: divide by 2
  • refactor: reorder functions
  • docs: auto-generate
  • test: add all mat4 methods to bemchmark
  • perf: mat4 mult / invert caching
  • perf: inline mat4.fromTranslationRotationScale
  • refactor: prevent duplicate copy and vec4 methods

To test:

  • perf: use Math.hypot (quat.length, vec2/3.length, vec2/3.distance)
  • perf: / 2 or * 0.5 ? (quat.fromEuler)
  • perf: copy
  • test: quat benchmarks
  • perf: quat.fromTo wrapped function

Implementation:

TBD:

  • use new Float32Array by default
  • rename _methods (_set9(), _rotate3, _lookAt9)
  • implement quat.targetTo
  • remove toString

Closes #9
Closes #10
Closes #14
Closes #16
Closes #25
Closes #26
Closes #30
Closes #31

dmnsgn added 20 commits February 8, 2022 09:31
- convert require to import and module.exports to exports
- export _fromMat39 in quat
- replace var/let with const
- use console.assert over assert
- add contributors

Closes #9

BREAKING CHANGE: switch to type module
- add math benchmarks
- run benchmark over n iterations
- scale matrix components to avoid useless multiplication
- reorder
- add mat3.copy and remove mat3._set9
- add mat3x3.copy and mat3x3.equals
- ~500% gain
- translate matrix components to avoid useless multiplication
- rotate matrix components to avoid useless multiplication
@dmnsgn dmnsgn added this to the v4 milestone Feb 11, 2022
@vorg
Copy link
Member

vorg commented Feb 11, 2022

Thanks for the work so far. Yes let's discuss TBD items one by one below.

@dmnsgn
Copy link
Member Author

dmnsgn commented Feb 24, 2022

use new Float32Array by default

Benchmark lean towards keeping array

@dmnsgn
Copy link
Member Author

dmnsgn commented Feb 9, 2023

  • add avec3.multMat4
  • add avec3.multQuat

@dmnsgn
Copy link
Member Author

dmnsgn commented Feb 9, 2023

Should we default avec j parameter to 0 if it is last in arguments list?

+ export function add(a, i, b, j = 0) {
- export function add(a, i, b, j) {
  a[i * 3] += b[j * 3];
  a[i * 3 + 1] += b[j * 3 + 1];
  a[i * 3 + 2] += b[j * 3 + 2];
}

This would help when transforming an avec by a regular vec3 eg.:

import { avec3 } from "pex-math";
const myVec3 = [1,0,0];
const myGeom = plane();

for (let i = 0; i < myGeom.positions.length /3; i++) {
  avec3.add(myGeom.positions, i, myVec3);
  // instead of avec3.add(myGeom.positions, i, myVec3, 0);
}

@vorg
Copy link
Member

vorg commented Feb 9, 2023

I would say no defaults. I like to see the 0

dmnsgn and others added 6 commits August 1, 2023 10:52
* 'v4' of github.com:pex-gl/pex-math:
  docs: fix vec2 comment
  chore(release): 4.0.0-alpha.5
  feat: add forEach/map to avec
  build: use builtin code coverage
  feat: add avec2
  chore(release): 4.0.0-alpha.4
  fix: remove array returns in avec
feat: add quat/mat4. fromPointToPoint
@dmnsgn dmnsgn marked this pull request as ready for review February 5, 2024 10:03
@dmnsgn dmnsgn merged commit f8f0631 into master Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants