Skip to content
Snippets Groups Projects
Commit 50ebd546 authored by David Sehnal's avatar David Sehnal
Browse files

state interpolation proof of concept

parent 2f08c241
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,12 @@ namespace StructureSymmetry { ...@@ -83,7 +83,12 @@ namespace StructureSymmetry {
export function areTransformGroupsEquivalent(a: ReadonlyArray<Unit.SymmetryGroup>, b: ReadonlyArray<Unit.SymmetryGroup>) { export function areTransformGroupsEquivalent(a: ReadonlyArray<Unit.SymmetryGroup>, b: ReadonlyArray<Unit.SymmetryGroup>) {
if (a.length !== b.length) return false if (a.length !== b.length) return false
for (let i = 0, il = a.length; i < il; ++i) { for (let i = 0, il = a.length; i < il; ++i) {
const au = a[i].units, bu = b[i].units;
if (au.length !== bu.length) return false;
if (a[i].hashCode !== b[i].hashCode) return false if (a[i].hashCode !== b[i].hashCode) return false
for (let j = 0, _j = au.length; j < _j; j++) {
if (au[j].conformation !== bu[j].conformation) return false;
}
} }
return true return true
} }
......
...@@ -65,7 +65,6 @@ export function UnitsRepresentation<P extends UnitsParams>(label: string, ctx: R ...@@ -65,7 +65,6 @@ export function UnitsRepresentation<P extends UnitsParams>(label: string, ctx: R
if (runtime.shouldUpdate) await runtime.update({ message: 'Creating or updating UnitsVisual', current: i, max: _groups.length }) if (runtime.shouldUpdate) await runtime.update({ message: 'Creating or updating UnitsVisual', current: i, max: _groups.length })
} }
} else if (structure && !Structure.areEquivalent(structure, _structure)) { } else if (structure && !Structure.areEquivalent(structure, _structure)) {
// console.log(label, 'structure not equivalent')
// Tries to re-use existing visuals for the groups of the new structure. // Tries to re-use existing visuals for the groups of the new structure.
// Creates additional visuals if needed, destroys left-over visuals. // Creates additional visuals if needed, destroys left-over visuals.
_groups = structure.unitSymmetryGroups; _groups = structure.unitSymmetryGroups;
......
...@@ -120,8 +120,12 @@ export function UnitsVisual<G extends Geometry, P extends UnitsParams & Geometry ...@@ -120,8 +120,12 @@ export function UnitsVisual<G extends Geometry, P extends UnitsParams & Geometry
} }
// check if the conformation of unit.model has changed // check if the conformation of unit.model has changed
if (Unit.conformationId(newStructureGroup.group.units[0]) !== Unit.conformationId(currentStructureGroup.group.units[0])) { // if (Unit.conformationId(newStructureGroup.group.units[0]) !== Unit.conformationId(currentStructureGroup.group.units[0])) {
if (Unit.conformationId(newStructureGroup.group.units[0]) !== Unit.conformationId(currentStructureGroup.group.units[0])
// TODO: this needs more attention
|| newStructureGroup.group.units[0].conformation !== currentStructureGroup.group.units[0].conformation) {
// console.log('new conformation') // console.log('new conformation')
updateState.updateTransform = true;
updateState.createGeometry = true updateState.createGeometry = true
} }
......
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