Преглед изворни кода

Tweak numbers to ensure tiling covers entire map

Tomasz Zieliński пре 1 година
родитељ
комит
d22f42d58a
2 измењених фајлова са 3 додато и 3 уклоњено
  1. 2 2
      lib/rmg/PenroseTiling.cpp
  2. 1 1
      lib/rmg/PenroseTiling.h

+ 2 - 2
lib/rmg/PenroseTiling.cpp

@@ -134,10 +134,10 @@ void PenroseTiling::split(Triangle& p, std::vector<Point2D>& points,
 
 
 std::set<Point2D> PenroseTiling::generatePenroseTiling(size_t numZones, CRandomGenerator * rand)
 std::set<Point2D> PenroseTiling::generatePenroseTiling(size_t numZones, CRandomGenerator * rand)
 {
 {
-	float scale = 100.f / (numZones * 1.5f + 20);
+	float scale = 173.2f / (numZones * 1.5f + 20);
 	float polyAngle = (2 * PI_CONSTANT) / POLY;
 	float polyAngle = (2 * PI_CONSTANT) / POLY;
 
 
-	float randomAngle = rand->nextDouble(0, 2 * PI_CONSTANT);
+	float randomAngle = rand->nextDouble(0.25 * PI_CONSTANT, 0.75 * PI_CONSTANT);
 
 
 	std::vector<Point2D> points = { Point2D(0.0f, 0.0f), Point2D(0.0f, 1.0f).rotated(randomAngle) };
 	std::vector<Point2D> points = { Point2D(0.0f, 0.0f), Point2D(0.0f, 1.0f).rotated(randomAngle) };
 	std::array<std::vector<uint32_t>, 5> indices;
 	std::array<std::vector<uint32_t>, 5> indices;

+ 1 - 1
lib/rmg/PenroseTiling.h

@@ -59,7 +59,7 @@ public:
 	const uint32_t POLY = 10; // Number of symmetries?
 	const uint32_t POLY = 10; // Number of symmetries?
 
 
 	const float BASE_SIZE = 1.25f;
 	const float BASE_SIZE = 1.25f;
-	const uint32_t DEPTH = 7; //Recursion depth
+	const uint32_t DEPTH = 8; //Recursion depth
 	
 	
 	const bool P2 = false; // Tiling type
 	const bool P2 = false; // Tiling type