Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Pretty cool!
|
|
Draws a guide line, computes bounds (which we should defer), draws all
nodes in the tree then draws the bounds.
|
|
Using a stack or queue, we can replace a function recursive tree
traversal with a single call. A stack would make it a DFS while a
queue would be a BFS. Since there's only ever two children, and at
high iteration counts we're getting quite large depth, it would be
best to do a DFS, hence the stack.
|
|
Draws the current node by converting its norm value (which is in
(lower, upper)) to a screen value, drawing a line there.
It then recurs on the children of the node.
|
|
|
|
|
|
This, due to the properties of a cw tree, will be the largest and
smallest fraction of the tree.
|
|
|
|
Abstracting the interface more, such that callers can use functions
rather than accessing internals directly, allows me to refactor the
allocator without having to do a ton of edits all across the source
tree.
|
|
|
|
|
|
Not very useful, but isn't a massive performance waster (I think) and
it will be useful when thinking about colour schemes in graphics.
|
|
MAX now works with Fraction's
|
|
Bit of a cheat but it would allow us to do some interesting graphical
stuff later.
|
|
|
|
Simple implementation, few refactors from the main.cpp version based
on API changes.
|
|
Node constructor is now completely default constructed i.e. no
constructor arguments required. The iterate function takes the queue
by reference, so it can update the caller's state.
Finally, to_string for a Node now uses the node allocator and an index
to print out trees. Seems simpler and more in line with the current
implementation.
|
|
Separates the (basically) completed cw_tree implementation in a
separate module so we can spend time implementing graphics in main.
NOTE: nodes are now generated from a node allocator, which just wraps
around the vector. We also take an allocator and queue by reference
in the iterate procedure now.
|
|
Seems to work!
|
|
|
|
Recursive implementation with proper indenting!
|
|
|
|
An index is a pointer, and they don't change if the vector decides to
reallocate internally unlike the bastardised pointers I was rolling up
before. This simplifies design a bit.
|
|
The vector acts as an arena for the nodes to be allocated from, better
and faster than allocating each child on the heap individually.
|
|
Pops an item off the queue and generate left and right children for it,
if those are empty. Then push those children into the queue for the
next iteration.
NOTE: Because we're using a queue, this does a breadth first
generation of the tree, which is what we want.
|
|
Will be used in creating the cw tree.
|
|
Let's just deal with simplified stuff anyway?
|
|
|
|
|
|
Holds numerator and denominator. Can self simplify, but not
automatically.
|
|
|