#ifndef TRAJECTOIRE_H
#define TRAJECTOIRE_H

enum trajectoire_type_t{
    TRAJECTOIRE_DROITE,
    TRAJECTOIRE_CIRCULAIRE,
    TRAJECTOIRE_BEZIER,
    TRAJECTOIRE_ROTATION,
};

struct point_xy_t{
    double x, y;
};

struct point_xyo_t{
    struct point_xy_t point_xy;
    float orientation;
};

struct trajectoire_t {
    enum trajectoire_type_t type;
    struct point_xy_t p1, p2, p3, p4;
    float orientation_debut_rad, orientation_fin_rad;
    float rayon, angle_debut_degre, angle_fin_degre;
    float longueur;
};

float Trajectoire_get_longueur_mm(struct trajectoire_t * trajectoire);
struct point_xyo_t Trajectoire_get_point(struct trajectoire_t * trajectoire, double abscisse);
float Trajectoire_get_orientation_rad(struct trajectoire_t * trajectoire, float abscisse);
float Trajectoire_avance(struct trajectoire_t * trajectoire, double abscisse, double distance_mm);
double distance_points(struct point_xy_t point, struct point_xy_t point_old);
void Trajectoire_circulaire(struct trajectoire_t * trajectoire, float centre_x, float centre_y, float angle_debut_degre, float angle_fin_degre,
                            float rayon, float orientation_debut_rad, float orientation_fin_rad);
void Trajectoire_droite(struct trajectoire_t * trajectoire, float p1_x, float p1_y, float p2_x, float p2_y, float orientation_debut_rad, float orientation_fin_rad);
void Trajectoire_bezier(struct trajectoire_t * trajectoire, float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y,
                        float orientation_debut_rad, float orientation_fin_rad);
void Trajectoire_rotation(struct trajectoire_t * trajectoire, float p1_x, float p1_y, float orientation_debut_rad, float orientation_fin_rad);
void Trajectoire_inverse(struct trajectoire_t * trajectoire);

#endif