Exemplo n.º 1
0
 /// <summary> Constructs an Atom from a String containing an element symbol.
 ///
 /// </summary>
 /// <param name="elementSymbol"> The String describing the element for the Atom
 /// </param>
 public Atom(System.String elementSymbol)
     : base(elementSymbol)
 {
     this.fractionalPoint3d = null;
     this.point3d           = null;
     this.point2d           = null;
 }
Exemplo n.º 2
0
 /// <summary> Constructs an Atom from a String containing an element symbol.
 /// 
 /// </summary>
 /// <param name="elementSymbol"> The String describing the element for the Atom
 /// </param>
 public Atom(System.String elementSymbol)
     : base(elementSymbol)
 {
     this.fractionalPoint3d = null;
     this.point3d = null;
     this.point2d = null;
 }
Exemplo n.º 3
0
 /// <summary> Constructs an Atom from an Element and a Point2d.
 ///
 /// </summary>
 /// <param name="elementSymbol">  The Element
 /// </param>
 /// <param name="point2d">        The Point
 /// </param>
 public Atom(System.String elementSymbol, Point2d point2d)
     : this(elementSymbol)
 {
     this.point2d = point2d;
 }
Exemplo n.º 4
0
 /// <summary>  Translates the geometric 2DCenter of the given
 /// AtomContainer container to the specified Point2d p.
 /// 
 /// </summary>
 /// <param name="container"> AtomContainer which should be translated.
 /// </param>
 /// <param name="p">         New Location of the geometric 2D Center.
 /// </param>
 /// <seealso cref="get2DCenter">
 /// </seealso>
 /// <seealso cref="translate2DCentreOfMassTo">
 /// </seealso>
 public static void translate2DCenterTo(IAtomContainer container, Point2d p)
 {
     Point2d com = get2DCenter(container);
     Vector2d translation = new Vector2d(p.x - com.x, p.y - com.y);
     IAtom[] atoms = container.Atoms;
     for (int i = 0; i < atoms.Length; i++)
     {
         if (atoms[i].getPoint2d() != null)
         {
             atoms[i].getPoint2d().add(translation);
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>  Returns the geometric center of all the atoms in the atomContainer.
 /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
 /// 
 /// </summary>
 /// <param name="container"> Description of the Parameter
 /// </param>
 /// <returns>            the geometric center of the atoms in this atomContainer
 /// </returns>
 public static Point2d get2DCenter(IAtomContainer container)
 {
     double centerX = 0;
     double centerY = 0;
     double counter = 0;
     IAtom[] atoms = container.Atoms;
     for (int i = 0; i < atoms.Length; i++)
     {
         if (atoms[i].getPoint2d() != null)
         {
             centerX += atoms[i].getPoint2d().x;
             centerY += atoms[i].getPoint2d().y;
             counter++;
         }
     }
     Point2d point = new Point2d(centerX / (counter), centerY / (counter));
     return point;
 }
Exemplo n.º 6
0
        //UPGRADE_NOTE: The initialization of  '//logger' was moved to static method 'org.openscience.cdk.geometry.GeometryTools'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
        //private static LoggingTool //logger;


        /// <summary>  Adds an automatically calculated offset to the coordinates of all atoms
        /// such that all coordinates are positive and the smallest x or y coordinate
        /// is exactly zero, using an external set of coordinates.
        /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
        /// 
        /// </summary>
        /// <param name="atomCon"> AtomContainer for which all the atoms are translated to
        /// positive coordinates
        /// </param>
        /// <param name="renderingCoordinates"> The set of coordinates to use coming from RendererModel2D
        /// </param>
        //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
        public static void translateAllPositive(IAtomContainer atomCon, System.Collections.Hashtable renderingCoordinates)
        {
            //UPGRADE_TODO: The equivalent in .NET for field 'java.lang.Double.MAX_VALUE' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
            double minX = System.Double.MaxValue;
            //UPGRADE_TODO: The equivalent in .NET for field 'java.lang.Double.MAX_VALUE' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
            double minY = System.Double.MaxValue;
            IAtom[] atoms = atomCon.Atoms;
            for (int i = 0; i < atoms.Length; i++)
            {
                //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                if (renderingCoordinates[atoms[i]] == null && atoms[i].getPoint2d() != null)
                {
                    renderingCoordinates[atoms[i]] = new Point2d(atoms[i].getPoint2d().x, atoms[i].getPoint2d().y);
                }
                //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                if (renderingCoordinates[atoms[i]] != null)
                {
                    //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                    if (((Point2d)renderingCoordinates[atoms[i]]).x < minX)
                    {
                        //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                        minX = ((Point2d)renderingCoordinates[atoms[i]]).x;
                    }
                    //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                    if (((Point2d)renderingCoordinates[atoms[i]]).y < minY)
                    {
                        //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                        minY = ((Point2d)renderingCoordinates[atoms[i]]).y;
                    }
                }
            }
            //logger.debug("Translating: minx=" + minX + ", minY=" + minY);
            translate2D(atomCon, minX * (-1), minY * (-1), renderingCoordinates);
        }
Exemplo n.º 7
0
 /// <summary>  Rotates a molecule around a given center by a given angle
 /// 
 /// </summary>
 /// <param name="atomCon"> The molecule to be rotated
 /// </param>
 /// <param name="center">  A point giving the rotation center
 /// </param>
 /// <param name="angle">   The angle by which to rotate the molecule
 /// </param>
 public static void rotate(IAtomContainer atomCon, Point2d center, double angle)
 {
     Point2d p = null;
     double distance;
     double offsetAngle;
     IAtom atom = null;
     for (int i = 0; i < atomCon.AtomCount; i++)
     {
         atom = atomCon.getAtomAt(i);
         p = atom.getPoint2d();
         offsetAngle = GeometryTools.getAngle(p.x - center.x, p.y - center.y);
         distance = p.distance(center);
         p.x = center.x + (System.Math.Sin(angle + offsetAngle) * distance);
         p.y = center.y - (System.Math.Cos(angle + offsetAngle) * distance);
     }
 }
Exemplo n.º 8
0
        /// <summary>  Determines the scale factor for displaying a structure loaded from disk in
        /// a frame, using an external set of coordinates. An average of all bond length values is produced and a scale
        /// factor is determined which would scale the given molecule such that its
        /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
        /// 
        /// </summary>
        /// <param name="ac">         The AtomContainer for which the ScaleFactor is to be
        /// calculated
        /// </param>
        /// <param name="bondLength"> The target bond length
        /// </param>
        /// <param name="renderingCoordinates"> The set of coordinates to use coming from RendererModel2D
        /// </param>
        /// <returns>             The ScaleFactor with which the AtomContainer must be
        /// scaled to have the target bond length
        /// </returns>

        //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
        public static double getScaleFactor(IAtomContainer ac, double bondLength, System.Collections.Hashtable renderingCoordinates)
        {
            IAtom[] atoms = ac.Atoms;
            for (int i = 0; i < atoms.Length; i++)
            {
                //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                if (renderingCoordinates[atoms[i]] == null && atoms[i].getPoint2d() != null)
                {
                    renderingCoordinates[atoms[i]] = new Point2d(atoms[i].getPoint2d().x, atoms[i].getPoint2d().y);
                }
            }
            double currentAverageBondLength = getBondLengthAverage(ac, renderingCoordinates);
            if (currentAverageBondLength == 0 || System.Double.IsNaN(currentAverageBondLength))
                return 1;
            return bondLength / currentAverageBondLength;
        }
Exemplo n.º 9
0
 /// <summary> Constructs and initializes a Point2f from the specified Point2d.</summary>
 /// <param name="p1">the Point2d containing the initialization x y data
 /// </param>
 public Point2f(Point2d p1) : base(p1)
 {
 }
Exemplo n.º 10
0
 /// <summary> Computes the L-infinite distance between this point and point p1.
 /// The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].
 /// </summary>
 /// <param name="p1">the other point
 /// </param>
 public double distanceLinf(Point2d p1)
 {
     return(System.Math.Max(System.Math.Abs(x - p1.x), System.Math.Abs(y - p1.y)));
 }
Exemplo n.º 11
0
 /// <summary> Computes the L-1 (Manhattan) distance between this point and point p1.
 /// The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).
 /// </summary>
 /// <param name="p1">the other point
 /// </param>
 public double distanceL1(Point2d p1)
 {
     return(System.Math.Abs(x - p1.x) + System.Math.Abs(y - p1.y));
 }
Exemplo n.º 12
0
 /// <summary> Computes the distance between this point and point p1.</summary>
 /// <param name="p1">the other point
 /// </param>
 public double distance(Point2d p1)
 {
     return(System.Math.Sqrt(distanceSquared(p1)));
 }
Exemplo n.º 13
0
 /// <summary> 
 /// Sets a point specifying the location of this
 /// atom in a 2D space.
 /// 
 /// </summary>
 /// <param name="point2d"> A point in a 2D plane
 /// 
 /// </param>
 /// <seealso cref="getPoint2d">
 /// </seealso>
 public virtual void setPoint2d(javax.vecmath.Point2d point2d)
 {
     this.point2d = point2d;
     notifyChanged();
 }
Exemplo n.º 14
0
 /// <summary> Constructs an Atom from an Element and a Point2d.
 /// 
 /// </summary>
 /// <param name="elementSymbol">  The Element
 /// </param>
 /// <param name="point2d">        The Point
 /// </param>
 public Atom(System.String elementSymbol, Point2d point2d)
     : this(elementSymbol)
 {
     this.point2d = point2d;
 }
Exemplo n.º 15
0
 /// <summary>  Returns the atom of the given molecule that is closest to the given
 /// coordinates, using an external set of coordinates.
 /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
 /// 
 /// </summary>
 /// <param name="xPosition"> The x coordinate
 /// </param>
 /// <param name="yPosition"> The y coordinate
 /// </param>
 /// <param name="renderingCoordinates"> The set of coordinates to use coming from RendererModel2D
 /// </param>
 /// <returns>            The atom that is closest to the given coordinates
 /// </returns>
 //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
 public static IAtom getClosestAtom(int xPosition, int yPosition, IChemModel model, IAtom ignore, System.Collections.Hashtable renderingCoordinates)
 {
     IAtom closestAtom = null;
     IAtom currentAtom;
     double smallestMouseDistance = -1;
     double mouseDistance;
     double atomX;
     double atomY;
     IAtomContainer all = ChemModelManipulator.getAllInOneContainer(model);
     for (int i = 0; i < all.AtomCount; i++)
     {
         currentAtom = all.getAtomAt(i);
         //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
         if (renderingCoordinates[currentAtom] == null && currentAtom.getPoint2d() != null)
         {
             renderingCoordinates[currentAtom] = new Point2d(currentAtom.getPoint2d().x, currentAtom.getPoint2d().y);
         }
         //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
         if (currentAtom != ignore && renderingCoordinates[currentAtom] != null)
         {
             //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
             atomX = ((Point2d)renderingCoordinates[currentAtom]).x;
             //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
             atomY = ((Point2d)renderingCoordinates[currentAtom]).y;
             mouseDistance = System.Math.Sqrt(System.Math.Pow(atomX - xPosition, 2) + System.Math.Pow(atomY - yPosition, 2));
             if (mouseDistance < smallestMouseDistance || smallestMouseDistance == -1)
             {
                 smallestMouseDistance = mouseDistance;
                 closestAtom = currentAtom;
             }
         }
     }
     return closestAtom;
 }
Exemplo n.º 16
0
 /// <summary>  Sorts a Vector of atoms such that the 2D distances of the atom locations
 /// from a given point are smallest for the first atoms in the vector
 /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
 /// 
 /// </summary>
 /// <param name="point"> The point from which the distances to the atoms are measured
 /// </param>
 /// <param name="atoms"> The atoms for which the distances to point are measured
 /// </param>
 public static void sortBy2DDistance(IAtom[] atoms, Point2d point)
 {
     double distance1;
     double distance2;
     IAtom atom1 = null;
     IAtom atom2 = null;
     bool doneSomething = false;
     do
     {
         doneSomething = false;
         for (int f = 0; f < atoms.Length - 1; f++)
         {
             atom1 = atoms[f];
             atom2 = atoms[f + 1];
             distance1 = point.distance(atom1.getPoint2d());
             distance2 = point.distance(atom2.getPoint2d());
             if (distance2 < distance1)
             {
                 atoms[f] = atom2;
                 atoms[f + 1] = atom1;
                 doneSomething = true;
             }
         }
     }
     while (doneSomething);
 }
Exemplo n.º 17
0
		/// <summary> Computes the square of the distance between this point and point p1.</summary>
		/// <param name="p1">the other point
		/// </param>
		public double distanceSquared(Point2d p1)
		{
			double dx = x - p1.x;
			double dy = y - p1.y;
			return dx * dx + dy * dy;
		}
Exemplo n.º 18
0
        /// <summary>  Determines the normalized vector orthogonal on the vector p1->p2.
        /// 
        /// </summary>
        /// <param name="p1"> Description of the Parameter
        /// </param>
        /// <param name="p2"> Description of the Parameter
        /// </param>
        /// <returns>     Description of the Return Value
        /// </returns>
        public static Vector2d calculatePerpendicularUnitVector(Point2d p1, Point2d p2)
        {
            Vector2d v = new Vector2d();
            v.sub(p2, p1);
            v.normalize();

            // Return the perpendicular vector
            return new Vector2d((-1.0) * v.y, v.x);
        }
Exemplo n.º 19
0
		/// <summary> Computes the distance between this point and point p1.</summary>
		/// <param name="p1">the other point
		/// </param>
		public double distance(Point2d p1)
		{
			return System.Math.Sqrt(distanceSquared(p1));
		}
Exemplo n.º 20
0
 /// <summary>  Translates a molecule from the origin to a new point denoted by a vector, using an external set of coordinates.
 /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
 /// 
 /// </summary>
 /// <param name="atomCon"> molecule to be translated
 /// </param>
 /// <param name="vector">  dimension that represents the translation vector
 /// </param>
 /// <param name="renderingCoordinates"> The set of coordinates to use coming from RendererModel2D
 /// </param>
 //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
 public static void translate2D(IAtomContainer atomCon, Vector2d vector, System.Collections.Hashtable renderingCoordinates)
 {
     IAtom[] atoms = atomCon.Atoms;
     for (int i = 0; i < atoms.Length; i++)
     {
         //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
         if (renderingCoordinates[atoms[i]] == null && atoms[i].getPoint2d() != null)
         {
             renderingCoordinates[atoms[i]] = new Point2d(atoms[i].getPoint2d().x, atoms[i].getPoint2d().y);
         }
         //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
         if (((Point2d)renderingCoordinates[atoms[i]]) != null)
         {
             //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
             ((Point2d)renderingCoordinates[atoms[i]]).add(vector);
         }
         else
         {
             //logger.warn("Could not translate atom in 2D space");
         }
     }
 }
Exemplo n.º 21
0
		/// <summary> Computes the L-1 (Manhattan) distance between this point and point p1.
		/// The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).
		/// </summary>
		/// <param name="p1">the other point
		/// </param>
		public double distanceL1(Point2d p1)
		{
			return System.Math.Abs(x - p1.x) + System.Math.Abs(y - p1.y);
		}
Exemplo n.º 22
0
 /// <summary>  Returns the geometric center of all the rings in this ringset.
 /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
 /// 
 /// </summary>
 /// <param name="ringSet"> Description of the Parameter
 /// </param>
 /// <returns>          the geometric center of the rings in this ringset
 /// </returns>
 public static Point2d get2DCenter(IRingSet ringSet)
 {
     double centerX = 0;
     double centerY = 0;
     for (int i = 0; i < ringSet.AtomContainerCount; i++)
     {
         Point2d centerPoint = GeometryTools.get2DCenter((IRing)ringSet.getAtomContainer(i));
         centerX += centerPoint.x;
         centerY += centerPoint.y;
     }
     Point2d point = new Point2d(centerX / ((double)ringSet.AtomContainerCount), centerY / ((double)ringSet.AtomContainerCount));
     return point;
 }
Exemplo n.º 23
0
		/// <summary> Computes the L-infinite distance between this point and point p1.
		/// The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].
		/// </summary>
		/// <param name="p1">the other point
		/// </param>
		public double distanceLinf(Point2d p1)
		{
			return System.Math.Max(System.Math.Abs(x - p1.x), System.Math.Abs(y - p1.y));
		}
Exemplo n.º 24
0
 /// <summary>  Returns the geometric center of all the atoms in the atomContainer.
 /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
 /// 
 /// </summary>
 /// <param name="container"> Description of the Parameter
 /// </param>
 /// <param name="renderingCoordinates"> The set of coordinates to use coming from RendererModel2D
 /// </param>
 /// <returns>            the geometric center of the atoms in this atomContainer
 /// </returns>
 //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
 public static Point2d get2DCenter(IAtomContainer container, System.Collections.Hashtable renderingCoordinates)
 {
     double centerX = 0;
     double centerY = 0;
     double counter = 0;
     IAtom[] atoms = container.Atoms;
     for (int i = 0; i < atoms.Length; i++)
     {
         if (atoms[i].getPoint2d() != null)
         {
             //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
             centerX += ((Point2d)renderingCoordinates[atoms[i]]).x;
             //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
             centerY += ((Point2d)renderingCoordinates[atoms[i]]).y;
             counter++;
         }
     }
     Point2d point = new Point2d(centerX / (counter), centerY / (counter));
     return point;
 }
Exemplo n.º 25
0
		/// <summary> Constructs and initializes a Point2d from the specified Point2d.</summary>
		/// <param name="p1">the Point2d containing the initialization x y data
		/// </param>
		public Point2d(Point2d p1):base(p1)
		{
		}
 public virtual IPseudoAtom newPseudoAtom(String label, Point2d point2d)
 {
     return new PseudoAtom(label, point2d);
 }
 public virtual IAtom newAtom(String elementSymbol, Point2d point2d)
 {
     return new Atom(elementSymbol, point2d);
 }
Exemplo n.º 28
0
 /// <summary>
 /// Sets a point specifying the location of this
 /// atom in a 2D space.
 ///
 /// </summary>
 /// <param name="point2d"> A point in a 2D plane
 ///
 /// </param>
 /// <seealso cref="getPoint2d">
 /// </seealso>
 public virtual void setPoint2d(javax.vecmath.Point2d point2d)
 {
     this.point2d = point2d;
     notifyChanged();
 }
Exemplo n.º 29
0
 public static double giveAngleBothMethods(Point2d from, Point2d to1, Point2d to2, bool bool_Renamed)
 {
     double[] A = new double[2];
     from.get_Renamed(A);
     double[] B = new double[2];
     to1.get_Renamed(B);
     double[] C = new double[2];
     to2.get_Renamed(C);
     double angle1 = System.Math.Atan2((B[1] - A[1]), (B[0] - A[0]));
     double angle2 = System.Math.Atan2((C[1] - A[1]), (C[0] - A[0]));
     double angle = angle2 - angle1;
     if (angle2 < 0 && angle1 > 0 && angle2 < -(System.Math.PI / 2))
     {
         angle = System.Math.PI + angle2 + System.Math.PI - angle1;
     }
     if (angle2 > 0 && angle1 < 0 && angle1 < -(System.Math.PI / 2))
     {
         angle = -System.Math.PI + angle2 - System.Math.PI - angle1;
     }
     if (bool_Renamed && angle < 0)
     {
         return (2 * System.Math.PI + angle);
     }
     else
     {
         return (angle);
     }
 }