mirror of
https://github.com/modelec/MarcelMoteurSTM32.git
synced 2026-01-18 16:47:23 +01:00
ajout de la classe point
This commit is contained in:
51
Core/Inc/point.h
Normal file
51
Core/Inc/point.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* point.h
|
||||
*
|
||||
* Created on: Mar 24, 2025
|
||||
* Author: CHAUVEAU Maxime
|
||||
*/
|
||||
|
||||
#ifndef INC_POINT_H_
|
||||
#define INC_POINT_H_
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
enum class StatePoint {
|
||||
UNKNOWN,
|
||||
START,
|
||||
END,
|
||||
INTERMEDIATE
|
||||
};
|
||||
|
||||
class Point {
|
||||
private:
|
||||
float x;
|
||||
float y;
|
||||
float theta;
|
||||
uint32_t id;
|
||||
StatePoint state;
|
||||
|
||||
public:
|
||||
// Constructeur
|
||||
Point(float x = 0.0, float y = 0.0, float theta = 0.0, StatePoint state = StatePoint::UNKNOWN);
|
||||
|
||||
// Setters
|
||||
void setX(float x);
|
||||
void setY(float y);
|
||||
void setTheta(float theta);
|
||||
void setState(StatePoint s);
|
||||
void setID(uint32_t id);
|
||||
|
||||
// Getters
|
||||
float getX();
|
||||
float getY();
|
||||
float getTheta();
|
||||
std::array<float, 3> getPoint();
|
||||
StatePoint getState();
|
||||
uint32_t getID();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* INC_POINT_H_ */
|
||||
55
Core/Src/point.cpp
Normal file
55
Core/Src/point.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
|
||||
#include "point.h"
|
||||
|
||||
Point::Point(float x, float y, float theta, StatePoint state){
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->theta = theta;
|
||||
this->state = state;
|
||||
}
|
||||
|
||||
void Point::setX(float x){
|
||||
this->x = x;
|
||||
}
|
||||
|
||||
void Point::setY(float y){
|
||||
this->y = y;
|
||||
}
|
||||
|
||||
void Point::setTheta(float theta){
|
||||
this->theta = theta;
|
||||
}
|
||||
|
||||
void Point::setState(StatePoint s){
|
||||
this->state = s;
|
||||
}
|
||||
|
||||
void Point::setID(uint32_t id){
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
|
||||
float Point::getX(){
|
||||
return x;
|
||||
}
|
||||
|
||||
float Point::getY(){
|
||||
return y;
|
||||
}
|
||||
|
||||
float Point::getTheta(){
|
||||
return theta;
|
||||
}
|
||||
|
||||
std::array<float, 3> Point::getPoint(){
|
||||
return {this->x, this->y, this->theta};
|
||||
}
|
||||
|
||||
StatePoint Point::getState(){
|
||||
return state;
|
||||
}
|
||||
|
||||
uint32_t Point::getID(){
|
||||
return id;
|
||||
}
|
||||
Reference in New Issue
Block a user