*rect_poly.exterior.xy是什么意思
时间: 2024-05-17 09:18:18 浏览: 10
`rect_poly.exterior.xy`是一个属性,它返回一个元组,包含最小矩形的外部多边形边界点的x坐标和y坐标。这个元组有两个元素,分别是x坐标数组和y坐标数组,可以用这些数组来绘制最小矩形的边界线。例如,`rect_poly.exterior.xy[0]`返回一个包含所有x坐标的数组,`rect_poly.exterior.xy[1]`返回一个包含所有y坐标的数组。
相关问题
if( src_point != NULL ) { src_point[cd_make->dest_index].X = (int32_t)(dl_context.rect.width * cd_make->h_CP) + (int32_t)(((float32_t)dl_context.rect.width * dl_context.mesh_width * (float32_t)cd_make->h_count) + GRPH_CD_OFFSET_TO_ROUND); src_point[cd_make->dest_index].Y = (int32_t)((dl_context.rect.height * cd_make->v_CP) + ((uint32_t)GRPH_CD_MESH_HEIGHT_DEFAULT * cd_make->v_count)); } dest_point[cd_make->dest_index].X = (int32_t)((cd_make->pos[cd_make->pos_index].h_CP_position * GRPH_CD_DST_POINT_SCALE) + GRPH_CD_OFFSET_TO_ROUND); dest_point[cd_make->dest_index].Y = (int32_t)((cd_make->pos[cd_make->pos_index].v_CP_position * GRPH_CD_DST_POINT_SCALE) + GRPH_CD_OFFSET_TO_ROUND);错误为将基本类型的复合表达式转换为无符号的基本类型,修正
要修正错误,您可以将基本类型的复合表达式转换为无符号基本类型。在这种情况下,您可以使用类型转换操作符来执行转换。以下是修改后的代码示例:
```c
if (src_point != NULL) {
src_point[cd_make->dest_index].X = (int32_t)(dl_context.rect.width * cd_make->h_CP) +
(int32_t)(((float32_t)dl_context.rect.width * dl_context.mesh_width * (float32_t)cd_make->h_count) + (uint32_t)GRPH_CD_OFFSET_TO_ROUND);
src_point[cd_make->dest_index].Y = (int32_t)((dl_context.rect.height * cd_make->v_CP) + ((uint32_t)GRPH_CD_MESH_HEIGHT_DEFAULT * cd_make->v_count));
}
dest_point[cd_make->dest_index].X = (int32_t)((cd_make->pos[cd_make->pos_index].h_CP_position * GRPH_CD_DST_POINT_SCALE) + (uint32_t)GRPH_CD_OFFSET_TO_ROUND);
dest_point[cd_make->dest_index].Y = (int32_t)((cd_make->pos[cd_make->pos_index].v_CP_position * GRPH_CD_DST_POINT_SCALE) + (uint32_t)GRPH_CD_OFFSET_TO_ROUND);
```
在这里,我们使用 `(uint32_t)` 将 `GRPH_CD_OFFSET_TO_ROUND` 转换为无符号基本类型。这样就可以将结果赋给对应的变量,并修复了错误。
bullet_rect.centerx = plane_rect.centerx bullet_rect.bottom = plane_rect.top
这行代码的作用是将子弹的初始位置设置为飞机的正上方。具体来说,bullet_rect.centerx = plane_rect.centerx 将子弹的水平中心点设置为飞机的水平中心点,而 bullet_rect.bottom = plane_rect.top 则将子弹的底部设置为飞机的顶部,这样子弹就会从飞机的顶部中心位置向上飞行。这通常是游戏中子弹的初始位置设置方式之一。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)