Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 19 additions & 9 deletions bitmap_image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2195,7 +2195,7 @@ class image_drawer
plot_pen_pixel(x2,y2);
}

void horiztonal_line_segment(int x1, int x2, int y)
void horizontal_line_segment(int x1, int x2, int y)
{
if (x1 > x2)
{
Expand All @@ -2208,6 +2208,11 @@ class image_drawer
}
}

void horiztonal_line_segment(int x1, int x2, int y)
{
horizontal_line_segment(x1, x2, y);
}

void vertical_line_segment(int y1, int y2, int x)
{
if (y1 > y2)
Expand Down Expand Up @@ -2461,7 +2466,7 @@ class cartesian_canvas
}
}

void horiztonal_line_segment(double x1, double x2, double y)
void horizontal_line_segment(double x1, double x2, double y)
{
x1 = clamp_x(x1);
x2 = clamp_x(x2);
Expand All @@ -2471,7 +2476,12 @@ class cartesian_canvas
const int sc_x2 = static_cast<int>(cart_to_screen_x(x2));
const int sc_y = static_cast<int>(cart_to_screen_y(y ));

draw_.horiztonal_line_segment(sc_x1, sc_x2, sc_y);
draw_.horizontal_line_segment(sc_x1, sc_x2, sc_y);
}

void horiztonal_line_segment(double x1, double x2, double y)
{
horizontal_line_segment(x1, x2, y);
}

void vertical_line_segment(double y1, double y2, double x)
Expand Down Expand Up @@ -2564,7 +2574,7 @@ class cartesian_canvas

for (double y = p0.second; y <= p1.second; y += 0.5)
{
canvas.horiztonal_line_segment(x0, x1, y);
canvas.horizontal_line_segment(x0, x1, y);

x0 += m0;
x1 += m1;
Expand All @@ -2581,7 +2591,7 @@ class cartesian_canvas

for (double y = p2.second; y >= p0.second; y -= 0.5)
{
canvas.horiztonal_line_segment(x0, x1, y);
canvas.horizontal_line_segment(x0, x1, y);

x0 -= m0;
x1 -= m1;
Expand Down Expand Up @@ -2628,14 +2638,14 @@ class cartesian_canvas
{
for (double i = cx - x; i <= cx + x; i += delta)
{
horiztonal_line_segment(cx - x, cx + x, cy + y);
horiztonal_line_segment(cx - x, cx + x, cy - y);
horizontal_line_segment(cx - x, cx + x, cy + y);
horizontal_line_segment(cx - x, cx + x, cy - y);
}

for (double i = cx - y; i <= cx + y; i += delta)
{
horiztonal_line_segment(cx - y, cx + y, cy + x);
horiztonal_line_segment(cx - y, cx + y, cy - x);
horizontal_line_segment(cx - y, cx + y, cy + x);
horizontal_line_segment(cx - y, cx + y, cy - x);
}

y += delta;
Expand Down
2 changes: 1 addition & 1 deletion bitmap_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ void test19()

canvas.rectangle(canvas.min_x(), canvas.min_y(), canvas.max_x(), canvas.max_y());

canvas.horiztonal_line_segment(canvas.min_x(), canvas.max_x(), -400.0);
canvas.horizontal_line_segment(canvas.min_x(), canvas.max_x(), -400.0);

canvas.line_segment(-500.0, 600.0, 600.0, -500.0);

Expand Down