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

fix: cache result of "compute bounds of most geometry" to force deterministic results #1890

Merged
merged 7 commits into from
Feb 23, 2022

Conversation

christjt
Copy link
Contributor

Fixes issue reported by Aize where certain models would "bounce around" when clicking fit camera to model. Reason for this is that skmeans, which we use to compute the bounding box of the model without noise, is not deterministic. The rubberband fix for this (since sadly it doesn't support seed solzimer/skmeans#18) is to only compute once and cache the result.

@christjt christjt requested a review from a team as a code owner February 23, 2022 12:19
@christjt christjt enabled auto-merge (squash) February 23, 2022 12:19
@christjt christjt added the auto-update Makes bulldozer automatically update this PR when there are changes to the target branch label Feb 23, 2022
@github-actions
Copy link

📙 Documentation preview is available from
https://cognitedata.github.io/reveal-docs-preview/1890/docs/next/.

@christjt christjt changed the title fix: cache result compute bounds of most geometry to force deterministic results fix: cache result of "compute bounds of most geometry" to force deterministic results Feb 23, 2022
Copy link
Contributor

@haakonflatval-cognite haakonflatval-cognite left a comment

Choose a reason for hiding this comment

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

Looks good - just a comment

Comment on lines +74 to +89
getSectorsIntersectingFrustum(
projectionMatrix: THREE.Matrix4,
inverseCameraModelMatrix: THREE.Matrix4
): SectorMetadata[] {
const frustumMatrix = new THREE.Matrix4().multiplyMatrices(projectionMatrix, inverseCameraModelMatrix);
const frustum = new THREE.Frustum().setFromProjectionMatrix(frustumMatrix);
const accepted: SectorMetadata[] = [];
traverseDepthFirst(this.root, x => {
if (frustum.intersectsBox(x.subtreeBoundingBox)) {
accepted.push(x);
return true;
}
return false;
});
return accepted;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this moved?

@christjt christjt merged commit 2de968f into master Feb 23, 2022
@christjt christjt deleted the christjt/deterministic-most-geometry-bb branch February 23, 2022 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-update Makes bulldozer automatically update this PR when there are changes to the target branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants