8000 JS bindings: convert mesh.triVerts to array of arrays by jirihon · Pull Request #271 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JS bindings: convert mesh.triVerts to array of arrays #271

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bindings/wasm/bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ Module.setup = function() {
const oldHalfedgeTangent = result.halfedgeTangent;
const conversion1 = v => ['x', 'y', 'z'].map(f => v[f]);
const conversion2 = v => ['x', 'y', 'z', 'w'].map(f => v[f]);
const conversion3 = v => [v[0], v[1], v[2]];
Copy link
Owner

Choose a reason for hiding this comment

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

Hmm, I must be missing something; this looks like a no-op, doesn't it? What does this change?

Copy link
Contributor Author
@jirihon jirihon Nov 8, 2022

Choose a reason for hiding this comment

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

This is intended to convert elements of type {0: number, 1: number, 2: number} to elements of type [number, number, number]. If this patch is not applied, the elements of result.triVerts would be generic javascript objects. With this patch, the elements will be javascript arrays. I understand the function looks like no-op, as indexing object has the same syntax as indexing array.

result.vertPos = fromVec(oldVertPos, conversion1);
result.triVerts = fromVec(oldTriVerts);
result.triVerts = fromVec(oldTriVerts, conversion3);
result.vertNormal = fromVec(oldVertNormal, conversion1);
result.halfedgeTangent = fromVec(oldHalfedgeTangent, conversion2);
oldVertPos.delete();
Expand Down
0