Browse Source

Check for discontinuities when buiilding Confal pyramids mesh

Michal Malý 2 years ago
parent
commit
5d269fd77c

+ 2 - 0
src/extensions/dnatco/confal-pyramids/representation.ts

@@ -88,6 +88,8 @@ function createConfalPyramidsMesh(ctx: VisualContext, unit: Unit, structure: Str
     const it = new ConfalPyramidsIterator(structure, unit);
     while (it.hasNext) {
         const allPoints = it.move();
+        if (!allPoints)
+            continue;
 
         for (const points of allPoints) {
             const { O3, P, OP1, OP2, O5, confalScore } = points;

+ 5 - 1
src/extensions/dnatco/confal-pyramids/util.ts

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2018-2023 mol* contributors, licensed under MIT, See LICENSE file for more info.
  *
  * @author Michal Malý <michal.maly@ibt.cas.cz>
  * @author Jiří Černý <jiri.cerny@ibt.cas.cz>
@@ -48,6 +48,10 @@ export class ConfalPyramidsIterator {
         this.residueOne = DnatcoUtil.copyResidue(this.residueTwo);
         this.residueTwo = DnatcoUtil.copyResidue(this.residueIt.move())!;
 
+        // Check for discontinuity
+        if (this.residueTwo.index !== (this.residueOne!.index + 1))
+            return void 0;
+
         return this.toPyramids(this.residueOne!, this.residueTwo);
     }