-
-
Notifications
You must be signed in to change notification settings - Fork 401
fix(ImageMarchingSquares): use indexToWorld function, rather than separate calculation #3362
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
base: master
Are you sure you want to change the base?
Conversation
finetjul
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reformat your commit message to match semantic release.
…arate calculation
| // pixelPts = a flattened world coordinates array of [ (i,j,k), (i+1,j,k), (i,j+1,k), (i+1,j+1,k)] | ||
|
|
||
| // 0: i, j, k | ||
| let worldPos = indexToWorld(ijk); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the indexToWorld aout parameter for better performance (to avoid instantiating a new array each time)
| pixelPts[2] = worldPos[2]; | ||
|
|
||
| // 1: i+1, j, k | ||
| const ijk1 = [...ijk]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you could do something like the following to avoid instantiating many arrays:
const neighborIJK = [...ijk];
indexToWorld()
neighborIJK[kernelX] += 1;
indexToWorld()
neighborIJK[kernelY] += 1;
indexToWorld()
neighborIJK[kernelX] -= 1;
indexToWorld()
Current:
direction missing.
#3355
PR:
Input image has indexToWorld function. Reuse it.