aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-07-27 02:20:31 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-07-27 02:20:31 +0100
commit564bac363f38445dad2db011769738a6b176f817 (patch)
tree2b1867ba5a23daf60f37796262d4eed89b546a0e
parent76d407ae1bf8ad9f10a8334826ef2d1ead965229 (diff)
downloadcw_tree-564bac363f38445dad2db011769738a6b176f817.tar.gz
cw_tree-564bac363f38445dad2db011769738a6b176f817.tar.bz2
cw_tree-564bac363f38445dad2db011769738a6b176f817.zip
Clean up and use the right initial fraction for CW tree
-rw-r--r--src/main.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 99b24d1..a1743bf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -102,7 +102,7 @@ struct State
constexpr word_t clamp_to_width(long double value)
{
- return WIDTH / (bounds.upper - bounds.lower) * (value - bounds.lower);
+ return (WIDTH / (bounds.upper - bounds.lower)) * (value - bounds.lower);
}
void draw_bounds()
@@ -147,7 +147,7 @@ using Ms = std::chrono::milliseconds;
int main(void)
{
// Setup state
- State state{{1, 2}};
+ State state{{1, 1}};
// Setup meta text (counter, iterations, etc)
word_t count = 1, prev_count = 0;
@@ -156,9 +156,10 @@ int main(void)
word_t format_str_width = 0;
Fraction previous_leftmost, previous_rightmost;
+ // Setup timer
auto time_current = Clock::now();
auto time_previous = time_current;
- constexpr auto time_delta = 10;
+ constexpr auto time_delta = 1;
InitWindow(WIDTH, HEIGHT, "Calkin-Wilf Tree");
while (!WindowShouldClose())