public virtual void render2StrandSegment(int monomerCount, Monomer monomer, short colix, short[] mads, Point3i[] ribbonTopScreens, Point3i[] ribbonBottomScreens, int i) { int iLast = monomerCount; int iPrev = i - 1; if (iPrev < 0) { iPrev = 0; } int iNext = i + 1; if (iNext > iLast) { iNext = iLast; } int iNext2 = i + 2; if (iNext2 > iLast) { iNext2 = iLast; } //colix = Graphics3D.inheritColix(colix, monomer.LeadAtom.colixAtom); g3d.drawHermite(true, ribbonBorder, colix, isNucleic?4:7, ribbonTopScreens[iPrev], ribbonTopScreens[i], ribbonTopScreens[iNext], ribbonTopScreens[iNext2], ribbonBottomScreens[iPrev], ribbonBottomScreens[i], ribbonBottomScreens[iNext], ribbonBottomScreens[iNext2]); }
public virtual void render2StrandSegment(int monomerCount, Monomer group, short colix, short[] mads, int i) { int iLast = monomerCount; int iPrev = i - 1; if (iPrev < 0) { iPrev = 0; } int iNext = i + 1; if (iNext > iLast) { iNext = iLast; } int iNext2 = i + 2; if (iNext2 > iLast) { iNext2 = iLast; } //change false -> true to fill in mesh g3d.drawHermite(true, ribbonBorder, colix, isNucleicPolymer ? 4 : 7, ribbonTopScreens[iPrev], ribbonTopScreens[i], ribbonTopScreens[iNext], ribbonTopScreens[iNext2], ribbonBottomScreens[iPrev], ribbonBottomScreens[i], ribbonBottomScreens[iNext], ribbonBottomScreens[iNext2]); //g3d.drawHermite(true, ribbonBorder, colix, isNucleicPolymer?4:7, ribbonTopScreens[iPrev], ribbonTopScreens[i], ribbonTopScreens[iNext], ribbonTopScreens[iNext2], ribbonBottomScreens[iPrev], ribbonBottomScreens[i], ribbonBottomScreens[iNext], ribbonBottomScreens[iNext2]); }
public virtual void render2StrandArrowhead(int monomerCount, Monomer group, short colix, short[] mads, int i) { int iLast = monomerCount; int iPrev = i - 1; if (iPrev < 0) { iPrev = 0; } int iNext = i + 1; if (iNext > iLast) { iNext = iLast; } int iNext2 = i + 2; if (iNext2 > iLast) { iNext2 = iLast; } calc1Screen(leadMidpoints[i], wingVectors[i], mads[i], .7f / 1000, screenArrowTop); calc1Screen(leadMidpoints[iPrev], wingVectors[iPrev], mads[iPrev], 1.0f / 1000, screenArrowTopPrev); calc1Screen(leadMidpoints[i], wingVectors[i], mads[i], (-.7f) / 1000, screenArrowBot); calc1Screen(leadMidpoints[i], wingVectors[i], mads[i], (-1.0f) / 1000, screenArrowBotPrev); //if (ribbonBorder) //g3d.fillCylinder(colix, colix, Graphics3D.ENDCAPS_SPHERICAL, 3, screenArrowTop.x, screenArrowTop.y, screenArrowTop.z, screenArrowBot.x, screenArrowBot.y, screenArrowBot.z); g3d.drawHermite(true, ribbonBorder, colix, isNucleicPolymer?4:7, screenArrowTopPrev, screenArrowTop, leadMidpointScreens[iNext], leadMidpointScreens[iNext2], screenArrowBotPrev, screenArrowBot, leadMidpointScreens[iNext], leadMidpointScreens[iNext2]); }
public void renderRopeSegment(short colix, short[] mads, int i, int monomerCount, Monomer[] monomers, Point3i[] leadMidpointScreens, bool[] isSpecials) { int iPrev1 = i - 1; if (iPrev1 < 0) iPrev1 = 0; int iNext1 = i + 1; if (iNext1 > monomerCount) iNext1 = monomerCount; int iNext2 = i + 2; if (iNext2 > monomerCount) iNext2 = monomerCount; int madThis, madBeg, madEnd; madThis = madBeg = madEnd = mads[i]; if (isSpecials != null) { if (!isSpecials[iPrev1]) madBeg = (mads[iPrev1] + madThis) / 2; if (!isSpecials[iNext1]) madEnd = (mads[iNext1] + madThis) / 2; } int diameterBeg = leadMidpointScreens[i].z;//viewer.scaleToScreen(leadMidpointScreens[i].z, madBeg); int diameterEnd = leadMidpointScreens[iNext1].z;//viewer.scaleToScreen(leadMidpointScreens[iNext1].z, madEnd); int diameterMid = monomers[i].LeadAtom.ScreenZ;//viewer.scaleToScreen(monomers[i].LeadAtom.ScreenZ, madThis); g3d.fillHermite(colix, monomers[i].Nucleic?4:7, diameterBeg, diameterMid, diameterEnd, leadMidpointScreens[iPrev1], leadMidpointScreens[i], leadMidpointScreens[iNext1], leadMidpointScreens[iNext2]); }
public static Monomer[] getNucleicMonomers(Group[] groups, int firstGroupIndex) { NucleicMonomer previous = null; int count = 0; for (int i = firstGroupIndex; i < groups.Length; ++i, ++count) { Group group = groups[i]; if (!(group is NucleicMonomer)) { break; } NucleicMonomer current = (NucleicMonomer)group; if (current.polymer != null) { break; } if (!current.isConnectedAfter(previous)) { break; } previous = current; } if (count == 0) { return(null); } Monomer[] monomers = new Monomer[count]; for (int j = 0; j < count; ++j) { monomers[j] = (NucleicMonomer)groups[firstGroupIndex + j]; } return(monomers); }
//////////////////////////////////////////////////////////////// // some utilities public bool[] calcIsSpecials(int monomerCount, Monomer[] monomers) { bool[] isSpecials = new bool[monomerCount + 1];// null;// viewer.allocTempBooleans(monomerCount + 1); for (int i = monomerCount; --i >= 0; ) isSpecials[i] = monomers[i].HelixOrSheet; isSpecials[monomerCount] = isSpecials[monomerCount - 1]; return isSpecials; }
public override bool isConnectedAfter(Monomer possiblyPreviousMonomer) { if (possiblyPreviousMonomer == null) return true; if (!(possiblyPreviousMonomer is PhosphorusMonomer)) return false; // 1PN8 73:d and 74:d are 7.001 angstroms apart float distance = LeadAtomPoint.distance(possiblyPreviousMonomer.LeadAtomPoint); return distance <= 7.1f; }
public virtual void render1Chain(int monomerCount, Monomer[] monomers, Point3f[] centers, Vector3f[] vectors, short[] mads, short[] colixes) { Point3i[] ribbonTopScreens; Point3i[] ribbonBottomScreens; ribbonTopScreens = calcScreens(centers, vectors, mads, isNucleic?1f:0.5f); ribbonBottomScreens = calcScreens(centers, vectors, mads, isNucleic?0f:- 0.5f); render2Strand(monomerCount, monomers, mads, colixes, ribbonTopScreens, ribbonBottomScreens); //viewer.freeTempScreens(ribbonTopScreens); //viewer.freeTempScreens(ribbonBottomScreens); }
public virtual int getIndex(Monomer monomer) { int i; for (i = monomerCount; --i >= 0;) { if (monomers[i] == monomer) { break; } } return(i); }
public virtual int getIndex(Monomer monomer) { Monomer[] monomers = apolymer.monomers; int i; for (i = monomerCount; --i >= 0;) { if (monomers[monomerIndex + i] == monomer) { break; } } return(i); }
//////////////////////////////////////////////////////////////// public override bool isConnectedAfter(Monomer possiblyPreviousMonomer) { if (possiblyPreviousMonomer == null) { return(true); } if (!(possiblyPreviousMonomer is AminoMonomer)) { return(false); } AminoMonomer other = (AminoMonomer)possiblyPreviousMonomer; return(other.CarbonylCarbonAtom.isBonded(NitrogenAtom)); }
public virtual void render1Chain() { isSpecials = calcIsSpecials(monomerCount, monomers); leadMidpointScreens = calcScreenLeadMidpoints(monomerCount, leadMidpoints); ribbonTopScreens = calcScreens(leadMidpoints, wingVectors, mads, isNucleicPolymer?1f / 1000:0.5f / 1000); ribbonBottomScreens = calcScreens(leadMidpoints, wingVectors, mads, isNucleicPolymer?0f:(-0.5f) / 1000); bool lastWasSpecial = false; for (int i = monomerCount; --i >= 0;) { if (mads[i] > 0) { Monomer group = monomers[i]; short colix = 0;// Graphics3D.inheritColix(colixes[i], group.LeadAtom.colixAtom); bool isSpecial = isSpecials[i]; if (isSpecial) { if (lastWasSpecial) { render2StrandSegment(monomerCount, group, colix, mads, i); } else { render2StrandArrowhead(monomerCount, group, colix, mads, i); } } else { renderRopeSegment(colix, mads, i, monomerCount, monomers, leadMidpointScreens, isSpecials); //if (isNucleicPolymer) // renderNucleicBaseStep((NucleicMonomer) group, colix, mads[i], leadMidpointScreens[i + 1]); } lastWasSpecial = isSpecial; } else { // miguel 2004 12 13 // bug [ 1014874 ] Beta pleated sheet arrowheads // if a segment is not being rendered then we need to // reset our flag so that the arrowhead will be drawn // for the next segment lastWasSpecial = false; } } //viewer.freeTempScreens(ribbonTopScreens); //viewer.freeTempScreens(ribbonBottomScreens); //viewer.freeTempScreens(leadMidpointScreens); //viewer.freeTempBooleans(isSpecials); }
private void BuildPolymers() { for (int i = 0; i < groupCount; ++i) { Group group = groups[i]; if (group is Monomer) { Monomer monomer = (Monomer)group; if (monomer.polymer == null) { Polymer.allocatePolymer(groups, i); } } } }
public override bool isConnectedAfter(Monomer possiblyPreviousMonomer) { if (possiblyPreviousMonomer == null) { return(true); } if (!(possiblyPreviousMonomer is AlphaMonomer)) { return(false); } float distance = LeadAtomPoint.distance(possiblyPreviousMonomer.LeadAtomPoint); // jan reichert in email to miguel on 10 May 2004 said 4.2 looked good return(distance <= 4.2f); }
public override bool isConnectedAfter(Monomer possiblyPreviousMonomer) { if (possiblyPreviousMonomer == null) { return(true); } if (!(possiblyPreviousMonomer is PhosphorusMonomer)) { return(false); } // 1PN8 73:d and 74:d are 7.001 angstroms apart float distance = LeadAtomPoint.distance(possiblyPreviousMonomer.LeadAtomPoint); return(distance <= 7.1f); }
public virtual int getSelectedMonomerIndex(Monomer monomer) { int selectedMonomerIndex = 0; for (int i = 0; i < monomerCount; ++i) { if (bsSelectedMonomers.Get(i)) { if (monomers[i] == monomer) { return(selectedMonomerIndex); } ++selectedMonomerIndex; } } return(-1); }
//////////////////////////////////////////////////////////////// public override bool isConnectedAfter(Monomer possiblyPreviousMonomer) { if (possiblyPreviousMonomer == null) { return(true); } Atom myPhosphorusAtom = PhosphorusAtom; if (myPhosphorusAtom == null) { return(false); } if (!(possiblyPreviousMonomer is NucleicMonomer)) { return(false); } NucleicMonomer other = (NucleicMonomer)possiblyPreviousMonomer; return(other.O3PrimeAtom.isBonded(myPhosphorusAtom)); }
public virtual int getIndex(Monomer monomer) { Monomer[] monomers = apolymer.monomers; int i; for (i = monomerCount; --i >= 0; ) if (monomers[monomerIndex + i] == monomer) break; return i; }
public virtual void render2Strand(int monomerCount, Monomer[] monomers, short[] mads, short[] colixes, Point3i[] ribbonTopScreens, Point3i[] ribbonBottomScreens) { for (int i = monomerCount; --i >= 0; ) if (mads[i] > 0) render2StrandSegment(monomerCount, monomers[i], colixes[i], mads, ribbonTopScreens, ribbonBottomScreens, i); }
public virtual int getIndex(Monomer monomer) { int i; for (i = monomerCount; --i >= 0; ) if (monomers[i] == monomer) break; return i; }
public virtual void render2StrandSegment(int monomerCount, Monomer monomer, short colix, short[] mads, Point3i[] ribbonTopScreens, Point3i[] ribbonBottomScreens, int i) { int iLast = monomerCount; int iPrev = i - 1; if (iPrev < 0) iPrev = 0; int iNext = i + 1; if (iNext > iLast) iNext = iLast; int iNext2 = i + 2; if (iNext2 > iLast) iNext2 = iLast; //colix = Graphics3D.inheritColix(colix, monomer.LeadAtom.colixAtom); g3d.drawHermite(true, ribbonBorder, colix, isNucleic?4:7, ribbonTopScreens[iPrev], ribbonTopScreens[i], ribbonTopScreens[iNext], ribbonTopScreens[iNext2], ribbonBottomScreens[iPrev], ribbonBottomScreens[i], ribbonBottomScreens[iNext], ribbonBottomScreens[iNext2]); }
public AminoPolymer(Monomer[] monomers) : base(monomers) { }
public abstract bool isConnectedAfter(Monomer possiblyPreviousMonomer);
//////////////////////////////////////////////////////////////// public override bool isConnectedAfter(Monomer possiblyPreviousMonomer) { if (possiblyPreviousMonomer == null) return true; if (!(possiblyPreviousMonomer is AminoMonomer)) return false; AminoMonomer other = (AminoMonomer) possiblyPreviousMonomer; return other.CarbonylCarbonAtom.isBonded(NitrogenAtom); }
public virtual int getSelectedMonomerIndex(Monomer monomer) { int selectedMonomerIndex = 0; for (int i = 0; i < monomerCount; ++i) { if (bsSelectedMonomers.Get(i)) { if (monomers[i] == monomer) return selectedMonomerIndex; ++selectedMonomerIndex; } } return - 1; }
public NucleicPolymer(Monomer[] monomers) : base(monomers) { }
public static Monomer[] getNucleicMonomers(Group[] groups, int firstGroupIndex) { NucleicMonomer previous = null; int count = 0; for (int i = firstGroupIndex; i < groups.Length; ++i, ++count) { Group group = groups[i]; if (!(group is NucleicMonomer)) break; NucleicMonomer current = (NucleicMonomer) group; if (current.polymer != null) break; if (!current.isConnectedAfter(previous)) break; previous = current; } if (count == 0) return null; Monomer[] monomers = new Monomer[count]; for (int j = 0; j < count; ++j) monomers[j] = (NucleicMonomer) groups[firstGroupIndex + j]; return monomers; }
public virtual void render2StrandSegment(int monomerCount, Monomer group, short colix, short[] mads, int i) { int iLast = monomerCount; int iPrev = i - 1; if (iPrev < 0) iPrev = 0; int iNext = i + 1; if (iNext > iLast) iNext = iLast; int iNext2 = i + 2; if (iNext2 > iLast) iNext2 = iLast; //change false -> true to fill in mesh g3d.drawHermite(true, ribbonBorder, colix, isNucleicPolymer ? 4 : 7, ribbonTopScreens[iPrev], ribbonTopScreens[i], ribbonTopScreens[iNext], ribbonTopScreens[iNext2], ribbonBottomScreens[iPrev], ribbonBottomScreens[i], ribbonBottomScreens[iNext], ribbonBottomScreens[iNext2]); //g3d.drawHermite(true, ribbonBorder, colix, isNucleicPolymer?4:7, ribbonTopScreens[iPrev], ribbonTopScreens[i], ribbonTopScreens[iNext], ribbonTopScreens[iNext2], ribbonBottomScreens[iPrev], ribbonBottomScreens[i], ribbonBottomScreens[iNext], ribbonBottomScreens[iNext2]); }
public virtual void render2StrandArrowhead(int monomerCount, Monomer group, short colix, short[] mads, int i) { int iLast = monomerCount; int iPrev = i - 1; if (iPrev < 0) iPrev = 0; int iNext = i + 1; if (iNext > iLast) iNext = iLast; int iNext2 = i + 2; if (iNext2 > iLast) iNext2 = iLast; calc1Screen(leadMidpoints[i], wingVectors[i], mads[i], .7f / 1000, screenArrowTop); calc1Screen(leadMidpoints[iPrev], wingVectors[iPrev], mads[iPrev], 1.0f / 1000, screenArrowTopPrev); calc1Screen(leadMidpoints[i], wingVectors[i], mads[i], (- .7f) / 1000, screenArrowBot); calc1Screen(leadMidpoints[i], wingVectors[i], mads[i], (- 1.0f) / 1000, screenArrowBotPrev); //if (ribbonBorder) //g3d.fillCylinder(colix, colix, Graphics3D.ENDCAPS_SPHERICAL, 3, screenArrowTop.x, screenArrowTop.y, screenArrowTop.z, screenArrowBot.x, screenArrowBot.y, screenArrowBot.z); g3d.drawHermite(true, ribbonBorder, colix, isNucleicPolymer?4:7, screenArrowTopPrev, screenArrowTop, leadMidpointScreens[iNext], leadMidpointScreens[iNext2], screenArrowBotPrev, screenArrowBot, leadMidpointScreens[iNext], leadMidpointScreens[iNext2]); }
//////////////////////////////////////////////////////////////// public override bool isConnectedAfter(Monomer possiblyPreviousMonomer) { if (possiblyPreviousMonomer == null) return true; Atom myPhosphorusAtom = PhosphorusAtom; if (myPhosphorusAtom == null) return false; if (!(possiblyPreviousMonomer is NucleicMonomer)) return false; NucleicMonomer other = (NucleicMonomer) possiblyPreviousMonomer; return other.O3PrimeAtom.isBonded(myPhosphorusAtom); }
public Polymer(Monomer[] monomers) { this.monomers = monomers; this.monomerCount = monomers.Length; for (int i = monomerCount; --i >= 0; ) monomers[i].Polymer = this; model = monomers[0].chain.model; model.addPolymer(this); }
public AlphaPolymer(Monomer[] monomers) : base(monomers) { }
public override bool isConnectedAfter(Monomer possiblyPreviousMonomer) { if (possiblyPreviousMonomer == null) return true; if (!(possiblyPreviousMonomer is AlphaMonomer)) return false; float distance = LeadAtomPoint.distance(possiblyPreviousMonomer.LeadAtomPoint); // jan reichert in email to miguel on 10 May 2004 said 4.2 looked good return distance <= 4.2f; }