From 50e98776693b327eb296b6f966abdc63b7c80dde Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Sat, 24 Nov 2018 20:42:43 -0800 Subject: [PATCH] trace iterator tweak --- .../visual/util/polymer/trace-iterator.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/mol-repr/structure/visual/util/polymer/trace-iterator.ts b/src/mol-repr/structure/visual/util/polymer/trace-iterator.ts index d64b49076..08a47b5ae 100644 --- a/src/mol-repr/structure/visual/util/polymer/trace-iterator.ts +++ b/src/mol-repr/structure/visual/util/polymer/trace-iterator.ts @@ -98,7 +98,7 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement> this.residueSegmentMax = index[this.unit.elements[polymerSegment.end - 1]] } - private getResidueIndex(residueIndex: ResidueIndex) { + private getElementIndex(residueIndex: ResidueIndex, atomRole: AtomRole) { if (residueIndex < this.residueSegmentMin) { const cyclicIndex = this.cyclicPolymerMap.get(this.residueSegmentMin) if (cyclicIndex !== undefined) { @@ -114,10 +114,6 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement> residueIndex = this.residueSegmentMax } } - return residueIndex - } - - private getElementIndex(residueIndex: ResidueIndex, atomRole: AtomRole) { const elementIndex = getElementIndexForAtomRole(this.unit.model, residueIndex, atomRole) return elementIndex === -1 ? this.residueAtomSegments.offsets[residueIndex] : elementIndex } @@ -163,12 +159,12 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement> value.moleculeType = getAtomicMoleculeType(this.unit.model, residueIndex) if (value.first) { - this.pos(this.p0, this.getElementIndex(this.getResidueIndex(residueIndex - 3 as ResidueIndex), 'trace')) - this.pos(this.p1, this.getElementIndex(this.getResidueIndex(residueIndex - 2 as ResidueIndex), 'trace')) - this.pos(this.p2, this.getElementIndex(this.getResidueIndex(residueIndex - 1 as ResidueIndex), 'trace')) + this.pos(this.p0, this.getElementIndex(residueIndex - 3 as ResidueIndex, 'trace')) + this.pos(this.p1, this.getElementIndex(residueIndex - 2 as ResidueIndex, 'trace')) + this.pos(this.p2, this.getElementIndex(residueIndex - 1 as ResidueIndex, 'trace')) this.pos(this.p3, value.center.element) - this.pos(this.p4, this.getElementIndex(this.getResidueIndex(residueIndex + 1 as ResidueIndex), 'trace')) - this.pos(this.p5, this.getElementIndex(this.getResidueIndex(residueIndex + 2 as ResidueIndex), 'trace')) + this.pos(this.p4, this.getElementIndex(residueIndex + 1 as ResidueIndex, 'trace')) + this.pos(this.p5, this.getElementIndex(residueIndex + 2 as ResidueIndex, 'trace')) this.pos(this.v12, this.getElementIndex(residueIndex - 1 as ResidueIndex, 'direction')) } else { @@ -181,7 +177,7 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement> Vec3.copy(this.v12, this.v23) } - this.pos(this.p6, this.getElementIndex(this.getResidueIndex(residueIndex + 3 as ResidueIndex), 'trace')) + this.pos(this.p6, this.getElementIndex(residueIndex + 3 as ResidueIndex, 'trace')) this.pos(this.v23, this.getElementIndex(residueIndex, 'direction')) this.setControlPoint(value.p0, this.p0, this.p1, this.p2, residueIndex - 2 as ResidueIndex) -- GitLab