//
// Created by zx on 2020/9/9.
//

#ifndef CAN_TEST_TRAJECTORY_Pose2d_H_
#define CAN_TEST_TRAJECTORY_Pose2d_H_
#include <iostream>
#include <atomic>
/*
 * 带direction的二维点,与x轴正方向逆时针为正方向
 */

class Pose2d
{
 public:
    Pose2d();
    Pose2d(float x,float y,float theta);
    Pose2d(const Pose2d& point)
    {
        m_x=point.x();
        m_y=point.y();
        m_theta=point.theta();
    }
    ~Pose2d();
    Pose2d& operator=(const Pose2d& point)
    {
        m_x=point.x();
        m_y=point.y();
        m_theta=point.theta();
        return *this;
    }

    friend std::ostream& operator<<(std::ostream &out,const Pose2d& point);


    float x() const {return m_x;};
    float y() const {return m_y;};
    float theta() const {return m_theta;}

    float gridient()const;

 protected:
    std::atomic<float>                      m_x;
    std::atomic<float>                      m_y;
    std::atomic<float>                      m_theta;        //梯度角，与x轴正方形逆时针为正，单位弧度
};


#endif //CAN_TEST_TRAJECTORY_Pose2d_H_
