Esempio n. 1
0
        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]);
        }
Esempio n. 2
0
        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]);
        }
Esempio n. 3
0
        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]);
        }
Esempio n. 4
0
        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]);
		}
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
		////////////////////////////////////////////////////////////////
		// 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;
		}
Esempio n. 8
0
        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);
		}
Esempio n. 9
0
        public virtual int getIndex(Monomer monomer)
        {
            int i;

            for (i = monomerCount; --i >= 0;)
            {
                if (monomers[i] == monomer)
                {
                    break;
                }
            }
            return(i);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        ////////////////////////////////////////////////////////////////

        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));
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
 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);
             }
         }
     }
 }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        ////////////////////////////////////////////////////////////////

        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));
        }
Esempio n. 18
0
        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;
		}
Esempio n. 19
0
        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);
		}
Esempio n. 20
0
		public virtual int getIndex(Monomer monomer)
		{
			int i;
			for (i = monomerCount; --i >= 0; )
				if (monomers[i] == monomer)
					break;
			return i;
		}
Esempio n. 21
0
        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]);
		}
Esempio n. 22
0
        public AminoPolymer(Monomer[] monomers)
            : base(monomers)
		{ }
Esempio n. 23
0
 public abstract bool isConnectedAfter(Monomer possiblyPreviousMonomer);
Esempio n. 24
0
		////////////////////////////////////////////////////////////////

        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);
		}
Esempio n. 25
0
        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;
		}
Esempio n. 26
0
        public NucleicPolymer(Monomer[] monomers)
            : base(monomers)
		{ }
Esempio n. 27
0
		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;
		}
Esempio n. 28
0
 public abstract bool isConnectedAfter(Monomer possiblyPreviousMonomer);
Esempio n. 29
0
        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]);
		}
Esempio n. 30
0
        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]);
		}
Esempio n. 31
0
		////////////////////////////////////////////////////////////////

        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);
		}
Esempio n. 32
0
		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);
		}
Esempio n. 33
0
        public AlphaPolymer(Monomer[] monomers)
            : base(monomers)
		{ }
Esempio n. 34
0
        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;
		}