File indexing completed on 2024-04-06 12:20:16
0001 #ifndef Cordic_H
0002 #define Cordic_H
0003
0004 #include <vector>
0005 #include <cstdint>
0006
0007 class Cordic {
0008 public:
0009 Cordic(const uint32_t& aPhiScale, const uint32_t& aMagnitudeBits, const uint32_t& aSteps);
0010 virtual ~Cordic();
0011
0012 void operator()(int32_t aX, int32_t aY, int32_t& aPhi, uint32_t& aMagnitude) const;
0013
0014 double NormalizePhi(const uint32_t& aPhi) const;
0015 double NormalizeMagnitude(const uint32_t& aMagnitude) const;
0016 int32_t IntegerizeMagnitude(const double& aMagnitude) const;
0017
0018 private:
0019 uint32_t tower(const double& aRadians) const;
0020
0021 private:
0022 uint32_t mPhiScale;
0023 uint32_t mMagnitudeScale;
0024 uint32_t mMagnitudeBits;
0025 uint32_t mSteps;
0026 uint64_t mMagnitudeRenormalization;
0027 std::vector<uint32_t> mRotations;
0028
0029 const double mPi;
0030 };
0031
0032 #endif