Skip to content

dtl::shape::DiamondSquareAverageIsland (形状クラス)

Kasugaccho edited this page Aug 17, 2019 · 9 revisions

バージョン:0.4.2.0以降

<DTL/Shape/DiamondSquareAverageIsland.hpp>

namespace dtl::shape {
  template <typename T>
  class DiamondSquareAverageIsland;
}

T は4bit以上の型

対応機能

機能名 対応
非長方形Matrix 不可

概要

DiamondSquareAverageIslandとは "Matrixの描画範囲にダイヤモンドスクエア法に従って描画値を設置する" 機能を持つクラスである。

描画範囲の全てを必ず塗りつぶすとは限らない (Matrixの初期化が必要)

例 (C++11)

#include <DTL.hpp>
#include <cstdint>
#include <array>

int main() {

	using shape_t = std::uint_fast8_t;
	std::array<std::array<shape_t, 33>, 33> matrix{ {} };

	dtl::shape::DiamondSquareAverageIsland<shape_t>(0, 80, 60).draw(matrix);

	dtl::console::OutputNumber<shape_t>(",").draw(matrix);
	dtl::console::OutputStringBool<shape_t>("##", "//").drawOperator(matrix, [](const shape_t value_) {return value_ > 50; });

	return 0;
}

出力

33,30,29,27,26,24,23,21,20,18,17,15,14,12,11,9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
32,34,33,32,33,31,29,28,26,29,27,29,24,26,20,19,12,21,22,22,20,19,19,20,15,18,21,18,14,19,16,17,7,
32,35,38,39,40,38,37,34,32,35,39,36,35,32,31,23,17,26,37,34,32,31,30,26,22,28,35,27,21,22,24,15,7,
32,35,40,43,47,44,42,44,38,46,44,48,45,39,35,27,21,33,38,43,44,44,38,32,29,34,34,35,27,24,22,13,6,
32,37,43,48,54,51,49,46,45,47,50,53,56,48,41,33,26,33,41,48,57,51,46,41,36,35,35,34,34,27,20,13,6,
32,39,48,55,53,58,55,53,50,58,55,61,56,53,44,36,30,40,44,52,55,60,56,48,43,46,42,40,34,32,24,19,5,
32,43,54,53,52,57,63,59,57,58,61,58,56,52,48,41,35,41,48,51,55,60,66,58,50,50,50,42,34,31,28,16,5,
32,40,47,53,51,60,61,62,63,64,61,63,56,53,49,49,39,49,48,51,54,59,62,62,57,58,49,40,34,32,23,15,4,
32,36,41,45,51,55,60,65,70,66,63,59,57,53,50,47,44,46,49,51,54,56,59,61,65,56,49,41,34,26,19,11,4,
32,44,47,55,56,63,64,71,68,73,69,66,63,62,58,53,48,56,57,58,55,57,58,64,61,60,50,41,34,25,20,16,3,
32,43,55,58,63,65,69,67,66,71,76,73,71,68,66,59,53,59,66,61,56,57,59,58,58,55,53,43,35,28,22,12,3,
32,48,54,61,69,73,68,71,64,70,75,77,78,72,70,68,57,61,63,60,57,61,56,55,55,57,48,45,35,28,20,10,2,
32,43,54,65,76,72,69,65,63,68,74,80,87,80,74,68,62,61,60,59,59,56,55,53,52,48,44,40,36,27,19,10,2,
32,48,56,65,68,72,64,62,60,65,70,79,81,80,75,70,66,66,63,61,58,59,58,56,49,52,46,41,32,28,22,10,1,
32,45,59,59,60,60,60,59,59,62,67,71,77,76,77,73,71,68,66,62,59,60,62,54,46,47,49,38,28,27,27,13,1,
32,40,48,51,52,55,55,61,57,60,64,67,72,79,75,79,75,74,68,64,59,62,56,51,43,42,39,32,24,25,18,12,0,
33,35,38,41,44,47,50,53,56,59,62,65,68,71,74,77,80,75,70,65,60,55,50,45,40,35,30,25,20,15,10,5,0,
31,38,40,46,45,47,51,52,55,61,67,70,69,74,77,81,75,78,74,71,62,59,51,50,39,36,33,28,20,20,15,7,0,
31,36,43,44,46,49,53,53,54,63,72,71,70,75,80,75,70,74,78,71,65,58,53,45,39,37,36,28,21,20,21,10,0,
30,36,40,47,47,53,51,53,53,59,67,73,71,77,73,71,65,68,71,69,67,63,53,45,38,35,33,32,21,22,15,9,0,
30,34,39,43,48,49,50,51,52,57,62,67,73,69,66,63,60,62,65,67,70,62,54,46,38,34,30,26,22,16,11,5,0,
29,35,36,40,45,51,50,55,51,60,59,67,65,67,66,59,55,59,61,61,62,60,49,44,37,41,35,33,21,17,14,10,0,
29,31,35,38,43,46,50,50,50,53,57,57,58,62,67,58,50,54,59,56,54,49,45,40,37,38,40,30,20,19,19,9,0,
28,33,33,40,40,46,46,51,49,52,51,51,51,55,54,48,45,49,48,45,46,43,40,42,36,37,33,25,19,15,13,9,0,
28,30,33,35,38,40,43,45,49,47,46,45,44,43,42,41,41,39,39,38,38,37,37,36,36,31,27,22,18,13,9,4,1,
27,34,34,34,36,39,43,42,43,45,50,47,46,47,43,39,35,34,36,38,39,41,35,38,31,33,27,27,21,17,14,8,0,
27,31,36,35,34,39,44,41,39,46,55,51,48,46,45,37,30,32,35,37,40,37,35,30,27,27,29,26,24,22,20,10,0,
26,32,32,36,32,39,37,40,34,45,47,51,50,45,40,36,25,28,32,41,41,35,32,27,22,23,26,28,27,21,17,12,0,
26,27,28,29,31,30,30,30,30,35,41,46,52,44,36,28,21,25,31,36,42,36,30,24,19,21,24,27,30,22,15,7,1,
25,26,29,29,27,28,30,26,25,37,38,43,40,36,30,24,15,26,27,32,32,31,24,20,14,21,23,27,23,17,11,5,0,
25,27,30,27,24,27,31,25,21,28,36,32,29,26,25,17,11,17,24,23,22,20,19,14,10,16,23,19,16,12,9,4,1,
24,28,25,27,21,26,22,20,16,24,22,23,17,15,14,9,6,8,13,16,12,15,10,10,6,13,12,14,9,10,5,8,1,
24,22,21,19,18,16,15,13,13,10,9,7,7,5,4,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
////////####//////////####//////////////####//////////////////////
//////##########//##########//////////########////////////////////
////########################//////////##########//////////////////
//////######################//////////##############//////////////
////////####################//////////##############//////////////
//////##########################//##################//////////////
////##################################################////////////
////################################################//////////////
////##############################################////////////////
////############################################//##//////////////
////############################################//////////////////
//////##########################################//////////////////
//////////////##############################//////////////////////
////////////##################################////////////////////
////////////##################################////////////////////
//////////####################################////////////////////
//////////////################################////////////////////
//////////##//##############################//////////////////////
//////////////////##############//########////////////////////////
//////////////##//############////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
////////////////////####//////////////////////////////////////////
//////////////////////##//////////////////////////////////////////
////////////////////////##////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

画像

sdsai sdsai dsai

関連項目

dtl::shape::DiamondSquareAverageCornerIsland

Clone this wiki locally