1
//---------------------------------------------------------------------------
2
#ifndef PIC_SERVO_PATH_H
3
#define PIC_SERVO_PATH_H
4
//---------------------------------------------------------------------------
11
#define MAXSEG 1000 //Maximum number of segments
16
//Valuse for tangent tolerance
17
#define TAN_1DEGREE 0.99985
18
#define TAN_3DEGREE 0.99863
19
#define TAN_5DEGREE 0.99619
20
#define TAN_10DEGREE 0.98481
21
#define TAN_20DEGREE 0.93969
22
#define TAN_45DEGREE 0.70711
25
//---------------------------------------------------------------------------
28
typedef float fp[3]; //floating point 3x1 vector
30
typedef long int ip[3]; //integer 3x1 vector
32
typedef struct { //data type for line segments or arc segments
33
int type; //LINE or ARC
34
fp p1; //Starting point
36
fp c; //Center point (arcs only)
37
fp norm; //Normal vector (arcs only)
38
float len; //Segment length
39
float r; //Radius (arcs only)
42
typedef struct { //data type for a coordinate frame
49
//---------------------------------------------------------------------------
52
//Load functions from DLL.
54
static void (*SetTangentTolerance)(float) = reinterpret_cast<void(*)(float)>(DLL::loadFunction("PATHLIB4.dll","SetTangentTolerance"));
55
static void (*ClearSegList)(float,float,float) = reinterpret_cast<void(*)(float,float,float)>(DLL::loadFunction("PATHLIB4.dll","ClearSegList"));
56
static int (*AddLineSeg)(float,float,float) = reinterpret_cast<int(*)(float,float,float)>(DLL::loadFunction("PATHLIB4.dll","AddLineSeg"));
57
static int (*AddArcSeg)(float,float,float,float,float,float,float,float,float) = reinterpret_cast<int(*)(float,float,float,float,float,float,float,float,float)>(DLL::loadFunction("PATHLIB4.dll","AddArcSeg"));
58
static void (*SetFeedrate)(float) = reinterpret_cast<void(*)(float)>(DLL::loadFunction("PATHLIB4.dll","SetFeedrate"));
59
static void (*SetOrigin)(float,float,float) = reinterpret_cast<void(*)(float,float,float)>(DLL::loadFunction("PATHLIB4.dll","SetOrigin"));
60
static int (*SetPathParams)(int,int,int,int,int,int,int,float,float,float,float) = reinterpret_cast<int(*)(int,int,int,int,int,int,int,float,float,float,float)>(DLL::loadFunction("PATHLIB4.dll","SetPathParams"));
61
static int (*SetPathParams2)(int,int,int,int,int,int,int,float,float,float,float) = reinterpret_cast<int(*)(int,int,int,int,int,int,int,float,float,float,float)>(DLL::loadFunction("PATHLIB4.dll","SetPathParams2"));
62
static float (*InitPath)(void) = reinterpret_cast<float(*)(void)>(DLL::loadFunction("PATHLIB4.dll","InitPath"));
63
static int (*AddPathPoints)(void) = reinterpret_cast<int(*)(void)>(DLL::loadFunction("PATHLIB4.dll","AddPathPoints"));
66
[DllImport("PATHLIB4.dll", EntryPoint = "SetTangentTolerance", CharSet = Unicode)]
67
void SetTangentTolerance(float);
69
[DllImport("PATHLIB4.dll", EntryPoint = "ClearSegList", CharSet = Unicode)]
70
void ClearSegList(float,float,float);
72
[DllImport("PATHLIB4.dll", EntryPoint = "AddLineSeg", CharSet = Unicode)]
73
int AddLineSeg(float,float,float);
75
[DllImport("PATHLIB4.dll", EntryPoint = "AddArcSeg", CharSet = Unicode)]
76
int AddArcSeg(float,float,float,float,float,float,float,float,float);
78
[DllImport("PATHLIB4.dll", EntryPoint = "SetFeedrate", CharSet = Unicode)]
79
void SetFeedrate(float);
81
[DllImport("PATHLIB4.dll", EntryPoint = "SetOrigin", CharSet = Unicode)]
82
void SetOrigin(float,float,float);
84
[DllImport("PATHLIB4.dll", EntryPoint = "SetPathParams", CharSet = Unicode)]
85
int SetPathParams(int,int,int,int,int,int,int,float,float,float,float);
87
[DllImport("PATHLIB4.dll", EntryPoint = "SetPathParams2", CharSet = Unicode)]
88
int SetPathParams2(int,int,int,int,int,int,int,float,float,float,float);
90
[DllImport("PATHLIB4.dll", EntryPoint = "InitPath", CharSet = Unicode)]
93
[DllImport("PATHLIB4.dll", EntryPoint = "AddPathPoints", CharSet = Unicode)]
94
int AddPathPoints(void);
96
#endif //ndef PIC_SERVO_PATH_H
b'\\ No newline at end of file'