Skip to content
This repository was archived by the owner on Apr 26, 2023. It is now read-only.

Triangle

Kasugaccho edited this page Mar 12, 2019 · 6 revisions

実装難易度: ★☆☆☆☆☆☆☆☆☆

優先度: ★★☆☆☆

ガバガバ度(自由度): ★☆☆☆☆


四角形

二次元配列であるint matrix[y][x]がある。(xはX軸方向のマスの大きさ, yはY軸方向のマスの大きさ)

matrixは全ての値を0で初期化する。

matrixに、 座標1(x1, y1), 座標2(x2, y2), 座標3(x3, y3)からなる三角形を描画する。 三角形部分の値はvalue。

以上の条件を満たす生成を作成する。


実装関数

template<typename Matrix>
bool createTriangle(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,  int value) {
/* 処理 */
}

エラー処理

(x1, x2, x3)のどれかがx以上または、(y1, y2, y3)のどれかがy以上の場合。

return false; (エラー以外の場合は return true;)


例(x=64, y=64,x1=8, y1=19,x2=47, y2=12,x3=55, y3=51, value=1) ※灰色が0, 黒色が1

当記事のライセンス

CC0

実装手順書

[未実装]

地形

ダンジョン

図形

[実装済]

Simple Voronoi Island

Simple Cellular Automaton Island

Simple Biome Island

Biome Island

Fractal Island

Chunk Island

Simple Diamond Square Average Island

Simple Diamond Square Average Island Corner

RogueLike

Simple RogueLike

Maze Dig

RogueLike Cave

DungeonInit

Border

BorderOdd

PointGrid

PointGridField

PointGridFieldPutBlock

Reversi

Chess

Mountain

Pen

Bucket

Clone this wiki locally