001         package com.croftsoft.core.math;
002    
003         import java.io.Serializable;
004    
005         /*********************************************************************
006         * A point in the standard Cartesian coordinate system using doubles.
007         *
008         * <p>
009         * This positive x-axis is to the right and the positive y-axis is up.
010         * </p>
011         *
012         * @version
013         *   2003-03-20
014         *
015         * @since
016         *   1998-05-29
017         *
018         * @author
019         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
020         *
021         * @deprecated
022         *   Use Point2DD or java.awt.geom.Point2D.Double instead.
023         *********************************************************************/
024    
025         public final class  Point2D
026           implements Serializable
027         //////////////////////////////////////////////////////////////////////
028         //////////////////////////////////////////////////////////////////////
029         {
030    
031         private static final long  serialVersionUID = 0L;
032    
033         //
034    
035         public double  x;
036    
037         public double  y;
038    
039         //////////////////////////////////////////////////////////////////////
040         //////////////////////////////////////////////////////////////////////
041    
042         public  Point2D (
043           double  x,
044           double  y )
045         //////////////////////////////////////////////////////////////////////
046         {
047           this.x = x;
048    
049           this.y = y;
050         }
051    
052         public  Point2D ( )
053         //////////////////////////////////////////////////////////////////////
054         {
055           this ( 0.0, 0.0 );
056         }
057    
058         //////////////////////////////////////////////////////////////////////
059         //////////////////////////////////////////////////////////////////////
060    
061         /*********************************************************************
062         * The angle, in radians, from this point to the target point.
063         * Note that the direction of 0 radians is along the positive x-axis
064         * and PI/2 radians is along the positive y-axis.
065         *********************************************************************/
066         public double  angleTo ( Point2D  target )
067         //////////////////////////////////////////////////////////////////////
068         {
069           return Math.atan2 ( target.y - this.y, target.x - this.x );
070         }
071    
072         //////////////////////////////////////////////////////////////////////
073         //////////////////////////////////////////////////////////////////////
074         }
075