Clean up and use the right initial fraction for CW tree
This commit is contained in:
@@ -102,7 +102,7 @@ struct State
|
|||||||
|
|
||||||
constexpr word_t clamp_to_width(long double value)
|
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()
|
void draw_bounds()
|
||||||
@@ -147,7 +147,7 @@ using Ms = std::chrono::milliseconds;
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
// Setup state
|
// Setup state
|
||||||
State state{{1, 2}};
|
State state{{1, 1}};
|
||||||
|
|
||||||
// Setup meta text (counter, iterations, etc)
|
// Setup meta text (counter, iterations, etc)
|
||||||
word_t count = 1, prev_count = 0;
|
word_t count = 1, prev_count = 0;
|
||||||
@@ -156,9 +156,10 @@ int main(void)
|
|||||||
word_t format_str_width = 0;
|
word_t format_str_width = 0;
|
||||||
Fraction previous_leftmost, previous_rightmost;
|
Fraction previous_leftmost, previous_rightmost;
|
||||||
|
|
||||||
|
// Setup timer
|
||||||
auto time_current = Clock::now();
|
auto time_current = Clock::now();
|
||||||
auto time_previous = time_current;
|
auto time_previous = time_current;
|
||||||
constexpr auto time_delta = 10;
|
constexpr auto time_delta = 1;
|
||||||
|
|
||||||
InitWindow(WIDTH, HEIGHT, "Calkin-Wilf Tree");
|
InitWindow(WIDTH, HEIGHT, "Calkin-Wilf Tree");
|
||||||
while (!WindowShouldClose())
|
while (!WindowShouldClose())
|
||||||
|
|||||||
Reference in New Issue
Block a user