#ifndef CONTOURDATA_H #define CONTOURDATA_H // 定义轮廓数据 by wf 2024-11-13 #include "ajson5.hpp" #include #include #include using std::string; using std::vector; using std::ifstream; class ContourData { public: struct Point { float x,y; }; ContourData(); //从json读取点数据 bool readFromJsonFile(string jsonfilename); bool readFromJsonFile(string jsonfilename,float scalex,float scaley); bool readFromJsonFile(string jsonfilename,int translateX, int translateY, float scalex,float scaley); //点数据 vector _points ; //计算包围盒子 bool getBoundingBox( float& xmin,float& ymin, float& xmax, float& ymax ) ; //新建一个副本并进行缩放然后返回 ContourData copyAndScale(float scalex,float scaley) ; //旋转轮廓多边形 void rotate( float rotdeg ) ; //旋转一个点 Point rotateOnePoint( ContourData::Point pt0, float rotateAng); //切换点序,顺时针逆时针 void togglePointOrder() ; }; #endif // CONTOURDATA_H