From acaf74c7b7ccfed6c4c53a3af700222ed4f4dd8a Mon Sep 17 00:00:00 2001 From: Susan Date: Fri, 14 Feb 2025 15:46:16 +0000 Subject: [PATCH] Cleanup: shorter syntax --- src/tree_cmd.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index a98ba7de1a..aa3e750e52 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -240,14 +240,14 @@ static const double PHASE_DIVISOR = INT32_MAX / (M_PI * 2); ///< Valid values f */ std::array CreateRandomStarShapedPolygon(const int radius) { - std::array harmonics; - /* These values are ones i found in my testing that result in suitable-looking polygons that did not self-intersect and fit within a square of radius * radius dimensions. */ - harmonics.at(0) = BlobHarmonic(radius / 2, Random() / PHASE_DIVISOR, 1); - harmonics.at(1) = BlobHarmonic(radius / 4, Random() / PHASE_DIVISOR, 2); - harmonics.at(2) = BlobHarmonic(radius / 8, Random() / PHASE_DIVISOR, 3); - harmonics.at(3) = BlobHarmonic(radius / 16, Random() / PHASE_DIVISOR, 4); + std::array harmonics = { + BlobHarmonic(radius / 2, Random() / PHASE_DIVISOR, 1), + BlobHarmonic(radius / 4, Random() / PHASE_DIVISOR, 2), + BlobHarmonic(radius / 8, Random() / PHASE_DIVISOR, 3), + BlobHarmonic(radius / 16, Random() / PHASE_DIVISOR, 4), + }; return CreateStarShapedPolygon(radius, harmonics); } @@ -260,6 +260,7 @@ std::array CreateRandomStarShapedPolygon(const int radi * @param vertex0 * @param vertex1 * @param vertex2 the triangle to check against. + * @returns true if the given coordinates lie within a triangle. */ bool IsPointInTriangle(const int x, const int y, Point vertex0, Point vertex1, Point vertex2) {