////////////// OpenGL drawtools for 2D Functions ver 1 ///////////////// typedef struct { float x; float y; } point2D_t; typedef struct { float v[3]; } vector2D_t; typedef struct { float m[3][3]; } matrix2D_t; typedef struct { float r; float g; float b; } color_t; matrix2D_t createIdentity(void); matrix2D_t multiply(matrix2D_t a,matrix2D_t b); matrix2D_t operator * (matrix2D_t a, matrix2D_t b); vector2D_t multiply(matrix2D_t a, vector2D_t b); vector2D_t operator * (matrix2D_t a, vector2D_t b); matrix2D_t translationMTX(float dx,float dy); matrix2D_t rotationMTX(float theta); matrix2D_t scalingMTX(float factorx,float factory); vector2D_t Point2Vector(point2D_t pnt); void setColor(color_t col); void drawDot(point2D_t pt); void drawDot(vector2D_t vc); void drawLine(point2D_t p1,point2D_t p2); void drawLine(vector2D_t v1,vector2D_t v2); void drawLine(float x1,float y1,float x2,float y2); //n: number of points void drawPolyline(point2D_t pnt[],int n); void drawPolyline(vector2D_t vct[],int n); //n: number of vertices void drawPolygon(point2D_t pnt[],int n); void drawPolygon(vector2D_t vct[],int n); // The function fillPolygon can fills only convex polygons //n: number of vertices void fillPolygon(point2D_t pnt[],int n,color_t color); void fillPolygon(vector2D_t vct[],int n,color_t color); // The function gradatePolygon can fills only convex polygons // The vertices will be painted with corresponding given colors. // The points inside the polygon will be painted with the mixed color. //n: number of vertices void gradatePolygon(point2D_t pnt[],color_t col[],int num); void gradatePolygon(vector2D_t vct[],color_t col[],int num);