8000 Add gl-matrix to editor by elalish · Pull Request #332 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add gl-matrix to editor #332

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

Merged
merged 8 commits into from
Feb 23, 2023
Merged

Add gl-matrix to editor #332

merged 8 commits into from
Feb 23, 2023

Conversation

elalish
Copy link
Owner
@elalish elalish commented Feb 21, 2023

Fixes #238
Fixes #324

This does simplify some of the examples nicely, and it feels pretty easy to use.

Also, I switched manifold.js from using 3x4 to 4x4 matrices, since that seems to be what all the other libraries use (we're still only using the affine portion).

@elalish elalish requested a review from pca006132 February 21, 2023 20:43
@elalish elalish self-assigned this Feb 21, 2023
type Matrix3x4 = [Vec3, Vec3, Vec3, Vec3];
type Vec2 = number[2];
type Vec3 = number[3];
type Mat4 = number[16];
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, pretty sure this is wrong.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should do this: https://stackoverflow.com/a/59906630

It is interesting that typescript did not put this in their type definitions even though this should be a rather common usecase...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe we should explicitly say that the matrix is column-major? Otherwise users may be confused about this.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back mostly to what we had before with tuple types. They seem to work the best and give pretty good type safety. The only drawback is I had to use vec2.fromValues(1, 1) instead of [1, 2] whenever I wanted to save the variable, but that doesn't seem too bad - and that's just because I can't cast it in our JS tests like users can in the editor.

@codecov
Copy link
codecov bot commented Feb 21, 2023

Codecov Report

Base: 91.50% // Head: 91.50% // No change to project coverage 👍

Coverage data is based on head (6288568) compared to base (c4bf392).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #332   +/-   ##
=======================================
  Coverage   91.50%   91.50%           
=======================================
  Files          32       32           
  Lines        3730     3730           
=======================================
  Hits         3413     3413           
  Misses        317      317           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator
@pca006132 pca006132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from the array issue.

@elalish elalish merged commit 5041c38 into master Feb 23, 2023
@elalish elalish deleted the glMatrix branch February 23, 2023 16:00
cartesian-theatrics pushed a commit to cartesian-theatrics/manifold that referenced this pull request Mar 11, 2024
* switch JS to Mat4

* added glMatrix to editor

* added glMatrix types

* type cleanup

* fixed type names

* updated examples

* fixed types and examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate glMatrix into manifold.js Vector library for JS
2 participants
0