-
Notifications
You must be signed in to change notification settings - Fork 21
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
Conversation
📙 Documentation preview is available from |
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.
Looks good - just a comment
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; | ||
} |
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.
Why is this moved?
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.