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

trace iterator tweak

parent be7d6cfb
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,7 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement> ...@@ -98,7 +98,7 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
this.residueSegmentMax = index[this.unit.elements[polymerSegment.end - 1]] this.residueSegmentMax = index[this.unit.elements[polymerSegment.end - 1]]
} }
private getResidueIndex(residueIndex: ResidueIndex) { private getElementIndex(residueIndex: ResidueIndex, atomRole: AtomRole) {
if (residueIndex < this.residueSegmentMin) { if (residueIndex < this.residueSegmentMin) {
const cyclicIndex = this.cyclicPolymerMap.get(this.residueSegmentMin) const cyclicIndex = this.cyclicPolymerMap.get(this.residueSegmentMin)
if (cyclicIndex !== undefined) { if (cyclicIndex !== undefined) {
...@@ -114,10 +114,6 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement> ...@@ -114,10 +114,6 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
residueIndex = this.residueSegmentMax residueIndex = this.residueSegmentMax
} }
} }
return residueIndex
}
private getElementIndex(residueIndex: ResidueIndex, atomRole: AtomRole) {
const elementIndex = getElementIndexForAtomRole(this.unit.model, residueIndex, atomRole) const elementIndex = getElementIndexForAtomRole(this.unit.model, residueIndex, atomRole)
return elementIndex === -1 ? this.residueAtomSegments.offsets[residueIndex] : elementIndex return elementIndex === -1 ? this.residueAtomSegments.offsets[residueIndex] : elementIndex
} }
...@@ -163,12 +159,12 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement> ...@@ -163,12 +159,12 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
value.moleculeType = getAtomicMoleculeType(this.unit.model, residueIndex) value.moleculeType = getAtomicMoleculeType(this.unit.model, residueIndex)
if (value.first) { if (value.first) {
this.pos(this.p0, this.getElementIndex(this.getResidueIndex(residueIndex - 3 as ResidueIndex), 'trace')) this.pos(this.p0, this.getElementIndex(residueIndex - 3 as ResidueIndex, 'trace'))
this.pos(this.p1, this.getElementIndex(this.getResidueIndex(residueIndex - 2 as ResidueIndex), 'trace')) this.pos(this.p1, this.getElementIndex(residueIndex - 2 as ResidueIndex, 'trace'))
this.pos(this.p2, this.getElementIndex(this.getResidueIndex(residueIndex - 1 as ResidueIndex), 'trace')) this.pos(this.p2, this.getElementIndex(residueIndex - 1 as ResidueIndex, 'trace'))
this.pos(this.p3, value.center.element) this.pos(this.p3, value.center.element)
this.pos(this.p4, this.getElementIndex(this.getResidueIndex(residueIndex + 1 as ResidueIndex), 'trace')) this.pos(this.p4, this.getElementIndex(residueIndex + 1 as ResidueIndex, 'trace'))
this.pos(this.p5, this.getElementIndex(this.getResidueIndex(residueIndex + 2 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')) this.pos(this.v12, this.getElementIndex(residueIndex - 1 as ResidueIndex, 'direction'))
} else { } else {
...@@ -181,7 +177,7 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement> ...@@ -181,7 +177,7 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
Vec3.copy(this.v12, this.v23) 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.pos(this.v23, this.getElementIndex(residueIndex, 'direction'))
this.setControlPoint(value.p0, this.p0, this.p1, this.p2, residueIndex - 2 as ResidueIndex) this.setControlPoint(value.p0, this.p0, this.p1, this.p2, residueIndex - 2 as ResidueIndex)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment