Exemple #1
0
        public static void ToPolar_Converts_Cartesian_Coordinate_to_Polar_Coordinate(double x, double y, double expectedRadius, double expectedAngleRadians)
        {
            CartesianCoordinate coordinate = new CartesianCoordinate(x, y);

            PolarCoordinate coordinateConverted = Cartesian2DPolarConverter.ToPolar(coordinate);

            Assert.AreEqual(expectedRadius, coordinateConverted.Radius, Tolerance);
            Assert.AreEqual(expectedAngleRadians, coordinateConverted.Azimuth.Radians, Tolerance);
        }
Exemple #2
0
        public static void ToCartesian_Converts_Polar_Coordinate_to_Cartesian_Coordinate(double radius, double angleRadians, double expectedX, double expectedY)
        {
            PolarCoordinate coordinate = new PolarCoordinate(radius, angleRadians);

            CartesianCoordinate coordinateConverted = Cartesian2DPolarConverter.ToCartesian(coordinate);

            Assert.AreEqual(expectedX, coordinateConverted.X, Tolerance);
            Assert.AreEqual(expectedY, coordinateConverted.Y, Tolerance);
        }
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same ICoordinate interface.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public bool Equals(ICoordinate other)
 {
     if (other is PolarCoordinate)
     {
         return(Equals((PolarCoordinate)other));
     }
     if (other is CartesianCoordinate)
     {
         return(Equals(Cartesian2DPolarConverter.ToPolar((CartesianCoordinate)other)));
     }
     return(Equals((object)other));
 }
 /// <summary>
 /// Converts the polar coordinate to a cartesian coordinate.
 /// </summary>
 /// <returns>PolarCoordinate.</returns>
 public CartesianCoordinate ToCartesian()
 {
     return(Cartesian2DPolarConverter.ToCartesian(this));
 }
Exemple #5
0
 /// <summary>
 /// Converts the cartesian coordinate to a polar coordinate.
 /// </summary>
 /// <returns>PolarCoordinate.</returns>
 public PolarCoordinate ToPolar()
 {
     return(Cartesian2DPolarConverter.ToPolar(this));
 }