Class CoordinateConverter#

Class Documentation#

class CoordinateConverter#

Converter between polar and cartesian coordinates.

CoordinateConverter simulates a fixed width/height coordinate system. It can convert polar and cartesian coordinates.

Public Functions

inline CoordinateConverter(size_t width, size_t height)#

a converter for coordinates

Creates a new coordinate system with given width and height. The center coordinate is at (width / 2, height / 2).

Parameters:
  • width – the coordinate system width

  • height – the coordinate system system

inline void convert(const Cartesian &from, Polar &to) const#

Converts a Cartesian coordinate to a Polar coordinate.

Parameters:
inline void convert(const Polar &from, Cartesian &to) const#

Converts a Polar coordinate to a Cartesian coordinate.

Parameters:
  • from – the Polar to convert

  • to – the Polar to store

inline double get_center_x() const#

Returns the x value of the center coordinate.

Returns:

the center’s x value

inline double get_center_y() const#

Returns the y value of the center coordinate.

Returns:

the center’s y value