Пример #1
0
 public void addAtom(Atom.AtomType t)
 {
     if (atom == null)
     {
         this.atom = new Atom(t);
     }
 }
Пример #2
0
        public bool intersect(Atom a)
        {
            float dx = pos_[0] - a.pos_[0];
            float dy = pos_[1] - a.pos_[1];
            float dz = pos_[2] - a.pos_[2];

            float d = (float) Math.Sqrt(dx * dx + dy * dy + dz * dz);

            if (d > (a.r() + r()))
            {
                return false;
            }
            else
            {
                return true;
            }
        }
Пример #3
0
 public void dropAtom()
 {
     if (atom != null)
     {
         this.atomsdb.addAtom(this.atom);
         this.atom = null;
     }
 }
Пример #4
0
        void OpenGLWin_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.O)
            {
                addAtom(Atom.AtomType.O);
            }

            if (e.Key == System.Windows.Input.Key.H)
            {
                addAtom(Atom.AtomType.H);
            }

            if (e.Key == System.Windows.Input.Key.D)
            {
                dropAtom();
            }

            if (e.Key == System.Windows.Input.Key.Left)
            {
                incAngle(0, -3, 0);
            }

            if (e.Key == System.Windows.Input.Key.Right)
            {
                incAngle(0, 3, 0);
            }

            if (e.Key == System.Windows.Input.Key.R)
            {
                this.atomsdb.atomlist.Clear();
                atom = null;
            }
            this.glc.Refresh();
        }
Пример #5
0
 public StatusType checkIntersection(Atom a)
 {
     foreach (Atom atm in atomlist)
     {
         if (a.intersect(atm))
         {
             if (atm.type() == a.type())
             {
                 return StatusType.REPEL;
             }
             else
             {
                 return StatusType.ATTRACT;
             }
         }
     }
     return StatusType.OK;
 }
Пример #6
0
 public void addAtom(Atom atm)
 {
     atomlist.Add(atm);
 }