fix(viewer-lib): Added relative epsilon to section outlines. Added constant epsilon to setting orbit controls position and target (#4781)
This commit is contained in:
committed by
GitHub
parent
3b08570f57
commit
daefbbf2a3
@@ -532,6 +532,9 @@ const getStream = () => {
|
||||
|
||||
// Large topological stuff
|
||||
// 'https://app.speckle.systems/projects/7a489ac0d4/models/146d5fbe27,3e481c9a58,65b4cf97d5,6d07577256,903850fa6f'
|
||||
|
||||
// Small (microscopic) building
|
||||
// 'https://app.speckle.systems/projects/26e4c4aab5/models/7d5ff72f5b'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -316,7 +316,11 @@ export class SmoothOrbitControls extends SpeckleControls {
|
||||
*/
|
||||
const targetPosition = this.getPosition()
|
||||
const targetTarget = this.getTarget()
|
||||
if (position.equals(targetPosition) && target.equals(targetTarget)) return
|
||||
const deltaTarget = vector3.subVectors(target, targetTarget).length()
|
||||
const deltaPosition = vector3.subVectors(position, targetPosition).length()
|
||||
const epsilon = 1e-7
|
||||
if (deltaPosition < epsilon) return
|
||||
if (deltaTarget < epsilon) return
|
||||
|
||||
const v0 = new Vector3().copy(position)
|
||||
const v1 = new Vector3().copy(target)
|
||||
|
||||
@@ -356,12 +356,13 @@ export class SectionOutlines extends Extension {
|
||||
|
||||
private setSectionPlaneChanged(planes: Plane[]) {
|
||||
this.sectionPlanesChanged.length = 0
|
||||
const epsilon = this.viewer.World.getRelativeOffset(0.0001)
|
||||
for (let k = 0; k < planes.length; k++) {
|
||||
if (
|
||||
Math.abs(this.lastSectionPlanes[k].constant - planes[k].constant) > 0.0001 ||
|
||||
Math.abs(this.lastSectionPlanes[k].constant - planes[k].constant) > epsilon ||
|
||||
Math.abs(
|
||||
this.lastSectionPlanes[k].normal.length() - planes[k].normal.length()
|
||||
) > 0.0001
|
||||
) > epsilon
|
||||
)
|
||||
this.sectionPlanesChanged.push(planes[k])
|
||||
this.lastSectionPlanes[k].copy(planes[k])
|
||||
|
||||
Reference in New Issue
Block a user