#include "project_utilities.h"
Go to the source code of this file.
Defines | |
#define | BRESENHAM_H 1 |
The standard guard against including the same header twice. | |
Functions | |
bresenham_linep_t | bresenham_from_s_coord (int32_t first_col, int32_t first_row, int32_t last_col, int32_t last_row) |
Wrapper to construct a Bresenham line context from signed coordinates. | |
int | bresenham_next_s (bresenham_linep_t bline, int32_t *col, int32_t *row) |
Iterate the Bresenham line context, generating the next coordinate pair. | |
bresenham_linep_t | bresenham_from_coord (uint32_t first_col, uint32_t first_row, uint32_t last_col, uint32_t last_row) |
Wrapper to construct a Bresenham line context from unsigned coordinates. | |
int | bresenham_next (bresenham_linep_t bline, uint32_t *col, uint32_t *row) |
Iterate the Bresenham line context, generating the next coordinate pair. | |
void | demolish_bresenham (bresenham_linep_t *blinehandle) |
Destroy a Bresenham line context. | |
Variables | |
typedefBEGIN_C_DECLARATIONS struct Bresenham_line * | bresenham_linep_t |
An opaque pointer to the line tracking state. |
We can hide the implementaion details of the Bresenham line algorithm behind an interface that only exposes some generic object construction and destruction operations, and an iterator that generates the next set of coordinates.
Definition in file bresenham.h.
|
Wrapper to construct a Bresenham line context from unsigned coordinates. The context records the state of the algorithm that will generate pairs of discrete coordinates for a series of steps approximating the line linking the first and last points.
Definition at line 279 of file bresenham.c. |
|
Wrapper to construct a Bresenham line context from signed coordinates. The context records the state of the algorithm that will generate pairs of discrete coordinates for a series of steps approximating the line linking the first and last points.
Definition at line 260 of file bresenham.c. Referenced by Sadie_Plot_ProfileCmd(). |
|
Iterate the Bresenham line context, generating the next coordinate pair. As constructed, the line context will always represent at least one point (even if the first point coincides with the last point), and so we can iterate it at least once; however once we've obtained the coordinates of the last point further iterations are incorrect (think of the context as being just off the end of the line). An iteration produces the current coordinate pair in the sequence of discrete points that approximate the straight line joining the first to the last point, and modifies the internals of the context to prepare the next point. The return value is a Boolean flag that is false iff further iterations are possible.
Definition at line 303 of file bresenham.c. References logerr_assert, LOGERR_DEBUG, and LOGERR_FUNC. Referenced by Sadie_Plot_ProfileCmd(). |
|
Iterate the Bresenham line context, generating the next coordinate pair. Just a variation for signed coordinates.
Definition at line 332 of file bresenham.c. References logerr_assert, LOGERR_DEBUG, and LOGERR_FUNC. |
|
Destroy a Bresenham line context. A simple free() would suffice to reclaim the storage allocated by the current Bresenham line context constructors, but we don't want to guarantee this for all future versions of this code.
Definition at line 359 of file bresenham.c. References logerr_assert, LOGERR_CRIT, and LOGERR_FUNC. Referenced by Sadie_Plot_ProfileCmd(). |