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

OneEuroFilter feature #24

Merged
merged 13 commits into from
Nov 17, 2021
Merged

OneEuroFilter feature #24

merged 13 commits into from
Nov 17, 2021

Conversation

kalwalt
Copy link
Member

@kalwalt kalwalt commented Oct 12, 2021

This will solve the issue with the mesh displayed that are not well "anchored" to the NFT marker. This is still a WIP but i hope to merge soon.
The problem come form the interpolation routine used here:

static interpolate (world: any) {
const interpolationFactor = 24
// interpolate matrix
for (let i = 0; i < 16; i++) {
this.trackedMatrix.delta[i] = world[i] - this.trackedMatrix.interpolated[i]
this.trackedMatrix.interpolated[i] =
this.trackedMatrix.interpolated[i] +
this.trackedMatrix.delta[i] / interpolationFactor
}
return this.trackedMatrix.interpolated
}

interpolating is very slow instead better to use a Filter. In this PR i'm testing the OneEuroFilter. The original code come from @eddiecarbin. I'm converting that code from Babylon.js to Three.js. 95% of the conversion is done but remain that 5%...
@ThorstenBux if you can help me a bit i will appreciate!

Final consideration

I finally implemented correctly the OEF (at least i think), probably is one types of possible uses/impl. Probably it can be improved. I added to all the methods inside NFTaddTJS class. But you should be enabled with the new setter oef, supposed that you create an instance of NFTaddTJS:

let nftAddTJS = new ARnftThreejs.NFTaddTJS(nft.uuid);
nftAddTJS.oef = true;
nftAddTJS.add(cube, 'pinball', false);

if you not set will be used the standard interpolation routine.

Notes

updated some packages

@kalwalt kalwalt added enhancement New feature or request code-design labels Oct 12, 2021
@kalwalt kalwalt self-assigned this Oct 12, 2021
@kalwalt kalwalt added the WIP label Oct 12, 2021
@kalwalt kalwalt marked this pull request as draft October 12, 2021 18:32
@kalwalt kalwalt linked an issue Oct 12, 2021 that may be closed by this pull request
@kalwalt
Copy link
Member Author

kalwalt commented Oct 14, 2021

root.matrixAutoUpdate = false; is not needed! removing that line will make display the mesh, that's a progress but i get some errors in the console and the mesh sometimes disappear.

@kalwalt kalwalt marked this pull request as ready for review October 14, 2021 23:06
@kalwalt kalwalt added the OEF in regards of OneEuroFilter label Nov 17, 2021
@kalwalt kalwalt merged commit b40cc04 into dev Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-design enhancement New feature or request OEF in regards of OneEuroFilter WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementing a better filtering matrix
1 participant