名校训练1377: Border题解

凌晚轩 算法基础篇 30 0
全网最全C++题库,助您快速提升编程技能!题库丰富多样,涵盖各个领域,让您在练习中不断成长!
You are to write a program that draws a border around a closed path into a bitmap, as displayed in the. The path is closed and runs along the grid lines, i.e. between the squares of the grid. The path runs. counter-clockwise, so if following the path is considered as going ” forward ” , the border pixels are always. to the ” right ” of the path. The bitmap always covers 32 by 32 squares and has its lower left corner at (0,0).You can safely assume that the path never touches the bounding rectangle of the bitmap and never. touches or crosses itself. Note that a bit gets set if it is on the outside of the area surrounded by the path. and if at least one of its edges belongs to the path, but not if only one of its corners is in the path. (A look. at the convex corners in the figure should clarify that statement.)

You are to write a program that draws a border around a closed path into a bitmap, as displayed in the following figure: The path is closed and runs along the grid lines, i.e. between the squares of the grid. The path runs counter-clockwise, so if following the path is considered as going ” forward ” , the border pixels are always to the ” right ” of the path. The bitmap always covers 32 by 32 squares and has its lower left corner at (0,0). You can safely assume that the path never touches the bounding rectangle of the bitmap and never touches or crosses itself. Note that a bit gets set if it is on the outside of the area surrounded by the path and if at least one of its edges belongs to the path, but not if only one of its corners is in the path. (A look at the convex corners in the figure should clarify that statement.)

名校训练1377: Border题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: 名校训练1377: Border题解