ajout de la classe point

This commit is contained in:
Maxime Chauveau
2025-03-24 21:20:20 +01:00
parent 23e1d0431c
commit 71f22f3b4f
2 changed files with 106 additions and 0 deletions

51
Core/Inc/point.h Normal file
View 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
View 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;
}