12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // GridPositionTool.hpp
- // auto_fill_jewel_v3
- //
- // Created by Red on 2024/12/4.
- //
- #ifndef GridPositionTool_hpp
- #define GridPositionTool_hpp
- #include <stdio.h>
- #include <vector>
- #include "FillGlobalConfig.hpp"
- using std::vector;
- struct GridPositionTool {
- /// 大盘子 210 210 210。 3x3=9个网格
- /// 中盘子 210 210 210。 3x6=18 个网格
- /// 小盘子 110 110 110 110 110 110 6x6=36 个网格
-
- /// 算法 https://t7le908iko.feishu.cn/docx/Cn4tdr0S7o76Ffx4lrVcJtManBg 第6节的顺序进行填充
- /// @param movable 是否移动
- /// @param firstMoveTypeCode 第一行移动代码,A、B、C,如果没有移动使用空字符串
- /// @param secondMoveTypeCode 第二行移动代码,A、B、C,如果没有移动使用空字符串
- /// @param plateTypeIdArr 盘子类型ID数组,通过盘子类型ID可以获取盘子大中小尺寸信息
- /// @param resultPositions 是输出结果,对应输入矩形顺序,每个数据是一个box中心在整个可视化区域(640,720)的坐标。可视化区域坐标原点在左下角。
- void solve(const bool movable,
- const string firstMoveTypeCode,
- const string secondMoveTypeCode,
- const vector<int>& plateTypeIdArr ,
- const vector<int>& moveIdArr ,
- vector<vector<int>>& resultPositions ) ;
-
- private:
- //给定顺序值index,从网格Grid中找到对应的网格列行坐标。列行坐标从0开始计。
- //找到了返回true,反之返回false
- bool getIndexPositionInGrid( const vector<vector<int>>& gridRows, const int index, int& col,int& row) ;
-
- //输入网格col和row,col和row是左上角网格原点,返回的是盘子中心x,y像素坐标 游戏区左下角为坐标原点。
- vector<int> computePositionByGridColRow(int plateSize, int col, int row ) ;
-
- } ;
- #endif /* GridPositionTool_hpp */
|