Skip to content
Snippets Groups Projects
Commit db0abcac authored by Alexander Rose's avatar Alexander Rose
Browse files

use epsilon comparison for VolumeIsoValue.areEqual

parent 71a44e51
No related branches found
No related tags found
No related merge requests found
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import { SpacegroupCell, Box3D } from 'mol-math/geometry'
import { Tensor, Mat4, Vec3 } from 'mol-math/linear-algebra'
import { equalEps } from 'mol-math/linear-algebra/3d/common';
/** The basic unit cell that contains the data. */
interface VolumeData {
......@@ -48,7 +50,7 @@ namespace VolumeIsoValue {
export type Absolute = Readonly<{ kind: 'absolute', absoluteValue: number }>
export function areSame(a: VolumeIsoValue, b: VolumeIsoValue, stats: VolumeData['dataStats']) {
return toAbsolute(a, stats).absoluteValue === toAbsolute(b, stats).absoluteValue
return equalEps(toAbsolute(a, stats).absoluteValue, toAbsolute(b, stats).absoluteValue, stats.sigma / 100)
}
export function absolute(value: number): Absolute { return { kind: 'absolute', absoluteValue: value }; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment