// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0.If a copy of the MPL was not distributed with this
// file, You can obtain one at https ://mozilla.org/MPL/2.0/.
#ifndef POLAR_H
#define POLAR_H
#include "Angle.h"
namespace Passer {
struct Vector2;
struct Spherical;
/// 
/// A polar vector
/// 
/// This will use the polar coordinate system consisting of a angle from a
/// reference direction and a distance.
struct Polar {
public:
  /// 
  /// The angle in degrees, clockwise rotation
  /// 
  /// The angle is normalized to -180 .. 180
  Angle angle;
  /// 
  /// The distance in meters
  /// 
  /// The distance should never be negative
  float distance;
  /// 
  /// Create a new polar vector with zero degrees and distance
  /// 
  Polar();
  /// 
  /// Create a new polar vector
  /// 
  /// The angle in degrees, clockwise rotation
  /// The distance in meters
  // Polar(float angle, float distance);
  Polar(float distance, Angle angle);
  /// 
  /// Convert a Vector2 to a Polar coordinate
  /// 
  /// The 2D carthesian vector
  Polar(Vector2 v);
  /// 
  /// Convert a Spherical coordinate to a Polar coordinate
  /// 
  /// The spherical coordinate
  Polar(Spherical s);
  /// 
  /// A polar vector with zero degrees and distance
  /// 
  const static Polar zero;
  /// 
  /// Negate the polar vector.
  /// 
  /// This will rotate the vector by 180 degrees. Distance will stay the same.
  /// The negated vector
  Polar operator-();
  /// 
  /// Substract a polar vector from this coordinate
  /// 
  /// The vector to subtract from this vector
  /// The result of the subtraction
  Polar operator-(Polar &v);
  /// 
  /// Add another polar vector to this polar vector
  /// 
  /// The vector to add
  /// The result of adding the vector
  Polar operator+(Polar &v);
  /// 
  /// Scale the vector uniformly up
  /// 
  /// The scaling factor
  /// The scaled vector
  /// This operation will scale the distance of the vector. The angle will be
  /// unaffected.
  Polar operator*(float factor) const;
  /// 
  /// Scale the vector uniformly down
  /// 
  /// The scaling factor
  /// The scaled vector
  /// This operation will scale the distance of the vector. The angle will be
  /// unaffected.
  Polar operator/(const float &factor);
  /// 
  /// The distance between two vectors
  /// 
  /// The first vector
  /// The second vector
  /// The distance between the two vectors
  static float Distance(Polar &v1, Polar &v2);
  /// 
  /// Rotate the vector
  /// 
  /// The vector to rotate
  /// Angle in radias to rotate
  /// The rotated vector
  static Polar Rotate(Polar v, Angle angle);
};
} // namespace Passer
using namespace Passer;
#include "Spherical.h"
#include "Vector2.h"
#endif