#ifndef SCURVE_H
#define SCURVE_H

struct point {
    double x,y,z;
};

struct line {
    double xs,ys,zs;
    double xe,ye,ze;
};

struct traject {

     double Vo;            //start velocity
     double Ve;            //end velocity
     double Vm;            //max velocity if atspeed can not be reached
     double Vel;           //feedrate
     double Acc_lineair;   //lineair acceleration, mm/sec^2
     double Acc_inflation; //max acceleration at inflection point, acc_lin*2, mm/sec^2

     double T1;            //total Acc time.
     double T2;            //total atspeed time.
     double T3;            //total Dcc time.
     double Ttot;          //total traject time, T1+T2+T3
     double T1h;           //total half Acc time, time to inflection point.
     double T3h;           //total half Dcc time, time to inflection point.

     double L1;            //acceleration lenght
     double L2;            //atspeed lenght.
     double L3;            //deacceleration lenght
     double Ltot;          //total traject lenght, L1+L2+L3
     double Li;            //line-line intersection x-value

     double Jm;            //max jerk for profile, x*acc_infl/T1 or T3
};

struct traject TrajectCalculator(double Vel, double Acc, double Vo, double Ve, struct line line);
struct traject ScurveUp(struct traject tr);
struct traject ScurveSteady(struct traject tr);
struct traject ScurveDown(struct traject tr);

int myfirstapp(); // Decleration

int myfirstapp(){ // Function
    int i=35;
    return i;
}

void myfirstvoid(float a, float b, float *result);

void myfirstvoid(float a, float b, float *result){
     *result=a+b;
}

struct point myfirstreturn(struct line l); // return midpoint coordinates

struct point myfirstreturn(struct line l){
    struct point p;
    p.x= (l.xs+l.xe)/2;
    p.y= (l.ys+l.ye)/2;
    p.z= (l.zs+l.ze)/2;

    return p;
}

#endif // SCURVE_H
