8000 wasm: transform accepts mat4 by pca006132 · Pull Request #329 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wasm: transform accepts mat4 #329

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 1 commit into from
Feb 20, 2023
Merged

wasm: transform accepts mat4 #329

merged 1 commit into from
Feb 20, 2023

Conversation

pca006132
Copy link
Collaborator

This is for #324, it seems that we only need to change transform to accept glMatrix mat4 type. This also fixes a silly bug in the existing transform code.

I tried adding the type definition for glMatrix to the editor. However, the typescript file they provide only contains type declaration but no function declaration, and typescript engine doesn't evaluate the minified js file so it cannot get the definitions.

@codecov
Copy link
codecov bot commented Feb 18, 2023

Codecov Report

Base: 91.51% // Head: 91.48% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (f6052ce) compared to base (02affd5).
Patch coverage: 86.15% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #329      +/-   ##
==========================================
- Coverage   91.51%   91.48%   -0.03%     
==========================================
  Files          32       32              
  Lines        3723     3724       +1     
==========================================
  Hits         3407     3407              
- Misses        316      317       +1     
Impacted Files Coverage Δ
src/manifold/src/csg_tree.h 100.00% <ø> (ø)
src/manifold/src/impl.h 70.00% <ø> (ø)
src/sdf/include/sdf.h 94.11% <0.00%> (-0.62%) ⬇️
src/utilities/include/par.h 93.75% <0.00%> (ø)
src/manifold/src/impl.cpp 95.36% <61.53%> (ø)
src/manifold/src/boolean3.cpp 99.59% <100.00%> (ø)
src/manifold/src/boolean_result.cpp 97.41% <100.00%> (ø)
src/manifold/src/constructors.cpp 96.08% <100.00%> (ø)
src/manifold/src/csg_tree.cpp 91.50% <100.00%> (ø)
src/manifold/src/manifold.cpp 88.70% <100.00%> (ø)
... and 2 more

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
Owner
@elalish elalish left a comment

Choose a reason for hiding this comment

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

Thanks, do you want to try adding glMatrix to the editor too, so we can test it?

@@ -92,7 +92,7 @@ declare class Manifold {
*
* @param m The affine transform matrix to apply to all the vertices.
*/
transform(m: Matrix3x4): Manifold;
transform(m: Matrix3x4 | number[16]): Manifold;
Copy link
Owner

Choose a reason for hiding this comment

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

How would you feel about converting all our matrix & vector types to SealedFloat32Array? It looks like they'll be more efficient in glMatrix, and I like the idea of only supporting one format.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This requires a more verbose constructor, not sure if users will want this. For example, when you do translation you have to do translate(new Float32Array([1, 2, 3])). I don't think performance matter so much in this case, users can decide on their own if they are doing computationally intensive things with js.

I don't see the problem in supporting multiple types here considering we are just treating them the same as plain arrays.

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, that's a good point. Actually I think I really just want to replace Matrix3x4 with number[12] to match the output of Mesh.transform. I can do that next.

}

Manifold IntersectionN(const std::vector<Manifold>& manifolds) {
return Manifold::BatchBoolean(manifolds, Manifold::OpType::Intersect);
;
Copy link
Owner

Choose a reason for hiding this comment

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

Regarding glMatrix types, this is an interesting thread on how they think about types.

I also found this more complete set of types - it's officially deprecated, but I think it's still pretty good, at least as a place to start.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I think maybe we should just add the deprecated type definitions to the editor for now, the official typescript file is missing a lot of things and not very useful in our case. Hope that their API did not evolve too much.

Copy link
Owner
@elalish elalish left a comment

Choose a reason for hiding this comment

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

Should we go ahead and merge this and work on the rest in follow-on PRs?

@pca006132
Copy link
Collaborator Author
pca006132 commented Feb 20, 2023 via email

@elalish elalish merged commit 376a7c6 into elalish:master Feb 20, 2023
pca006132 added a commit to pca006132/manifold that referenced this pull request Feb 21, 2023
@pca006132 pca006132 deleted the glmatrix branch August 15, 2023 12:53
cartesian-theatrics pushed a commit to cartesian-theatrics/manifold that referenced this pull request Mar 11, 2024
Sign up for free to join this conv 5E28 ersation 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.

2 participants
0