Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement grow from start refinement algorithm #224

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d1b29c7
Stub out definition of `sxbp_refine_figure_grow_from_start()`
saxbophone Nov 9, 2018
9512938
Amend documentation typos
saxbophone Nov 9, 2018
d89c833
Document psuedo-code of old algorithm to re-implement
saxbophone Nov 9, 2018
4d168b6
Wrote skeleton incomplete implementation of old refine method
saxbophone Nov 9, 2018
618ed4c
Remove now unneeded warnings about unused parameters in non-stubbed f…
saxbophone Nov 9, 2018
72492c3
Refactored out line-resizing to separate function without changing im…
saxbophone Nov 9, 2018
7f170aa
Gradually fleshing out more parts of `sxbp_refine_figure_grow_from_st…
saxbophone Nov 9, 2018
acd4f02
Added more helper functions for plotting the line pointers for sxbp_f…
saxbophone Nov 9, 2018
c8f3427
Add an extra argument to sxbp_walk_figure()'s callback
saxbophone Nov 9, 2018
15c08b0
Fix error in pointer cast to actually store the collider's address
saxbophone Nov 9, 2018
d6ba9c0
Set line_map.cells pointers to NULL upon free()
saxbophone Nov 10, 2018
a4ab816
Remove some debugging code and refactor 'last line' logic in callback
saxbophone Nov 10, 2018
fdf300d
Attempt to solve recursively
saxbophone Nov 11, 2018
10f08df
Remove debugging code
saxbophone Nov 11, 2018
ad59700
After a bit more debugging, it turns out the source of my woes was in…
saxbophone Nov 11, 2018
56d502a
Some small optimisations in sxbp_figure_collides_with_callback()
saxbophone Nov 11, 2018
201905d
Remove numerous other bits of left over debugging code
saxbophone Nov 11, 2018
373786f
Add comments detailing the need to correct sxbp_suggest_previous_leng…
saxbophone Nov 11, 2018
111bc8d
Add more documentational and cautionary comments
saxbophone Nov 11, 2018
9912e8d
Update signature of callback function in light of recent changes
saxbophone Dec 12, 2018
4657d4e
Use new datatype for bitmap dimensions and fix compilation errors
saxbophone Dec 12, 2018
caba146
Substitute correct typedef in casts and use unsigned literal when adding
saxbophone Dec 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions sxbp/begin_figure.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ typedef enum sxbp_rotation_t {

// private, builds a line from a direction and length
static sxbp_line_t sxbp_make_line(
sxbp_figure_size_t index,
sxbp_direction_t direction,
sxbp_length_t length
) {
return (sxbp_line_t){ .direction = direction, .length = length, };
return (sxbp_line_t){
.id = index,
.direction = direction,
.length = length,
};
}

// private, converts a binary bit into a rotational direction
Expand Down Expand Up @@ -101,7 +106,7 @@ static void sxbp_plot_lines(const sxbp_buffer_t* data, sxbp_figure_t* figure) {
// the first line is always an up line - this is for orientation purposes
sxbp_direction_t facing = SXBP_UP;
// add first line to the figure
figure->lines[0] = sxbp_make_line(facing, 1);
figure->lines[0] = sxbp_make_line(0u, facing, 1);
// update the location
sxbp_move_location_along_line(&location, figure->lines[0]);
// update the bounds
Expand Down Expand Up @@ -130,7 +135,7 @@ static void sxbp_plot_lines(const sxbp_buffer_t* data, sxbp_figure_t* figure) {
// calculate what length this line should be
sxbp_length_t length = sxbp_next_length(location, facing, bounds);
// make line
sxbp_line_t line = sxbp_make_line(facing, length);
sxbp_line_t line = sxbp_make_line(index, facing, length);
// add line to figure
figure->lines[index] = line;
// update location and bounds
Expand Down
2 changes: 2 additions & 0 deletions sxbp/refine_figure.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ sxbp_result_t sxbp_refine_figure(
}
// now run the appropriate refinement function for all implemented methods
switch (method) {
case SXBP_REFINE_METHOD_GROW_FROM_START:
return sxbp_refine_figure_grow_from_start(figure, options);
case SXBP_REFINE_METHOD_SHRINK_FROM_END:
return sxbp_refine_figure_shrink_from_end(figure, options);
default:
Expand Down
Loading