This repository was archived by the owner on Apr 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Quadrangle
Kasugaccho edited this page Mar 12, 2019
·
9 revisions
二次元配列であるint matrix[y][x]がある。(xはX軸方向のマスの大きさ, yはY軸方向のマスの大きさ)
matrixは全ての値を0で初期化する。
matrixに、 左上座標(x1, y1), 右上座標(x2, y2), 左下座標(x3, y3), 右下座標(x4, y4)の四角形を描画する。 四角形部分の値はvalue。
以上の条件を満たす生成を作成する。
実装関数
template<typename Matrix>
bool createQuadrangle(Matrix& matrix, size_t x, size_t y, size_t x1, size_t y1, size_t x2, size_t y2, size_t x3, size_t y3, size_t x4, size_t y4, int value) {
/* 処理 */
}
(x1, x2, x3, x4)のどれかがx以上または、(y1, y2, y3, y4)のどれかがy以上の場合。
return false;
(エラー以外の場合は return true;
)
例(x=64, y=64,x1=8, y1=19,x2=47, y2=12,x3=12, y3=47,x4=55, y4=51, value=1)
※灰色が0, 黒色が1