Last active
June 28, 2024 08:50
-
-
Save comefrombottom/12316a4c02501888c7521acae2d3cae9 to your computer and use it in GitHub Desktop.
既約分数n/m角形の頂点を求める
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <Siv3D.hpp> // Siv3D v0.6.14 | |
//既約分数n/m角形の頂点を求める | |
LineString makeRegularRationalShapeLineString(const Vec2& center, double r, int32 n, int32 m) | |
{ | |
LineString points(n); | |
for (auto i : step(n)) | |
{ | |
const double theta = Math::TwoPi / n * i * m; | |
points[i] = center + Circular(r, theta); | |
} | |
return points; | |
} | |
void Main() | |
{ | |
while (System::Update()) | |
{ | |
makeRegularRationalShapeLineString(Scene::Center(), 100, 5, 2).drawClosed(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment