Questions tagged [bresenham]

A fast integer line-drawing algorithm invented by Jack Bresenham, or one of a family of algorithms derived from the original.

173 questions
0
votes
3 answers

Reading from a text file with spaces and then putting into arrayList

I have spent the last week trying to figure out how to make this stupid code work. I have managed to get everything to work except for reading from my text file. It can read an individual integer on a line, but when given a line with multiple…
Kyo33
  • 1
  • 1
  • 1
  • 2
0
votes
1 answer

Java Coordinate System

i am working on a Bresenham Line drawing algorithm in Java and i have been able to draw the line but i am having a problem with the coordinates. My line starts from the top left corner of the screen and i want it to start from the bottom left…
user3628617
  • 29
  • 1
  • 4
0
votes
1 answer

Draw polygon with equal sides and angles

I am using Bresenham line algorithm in order to draw a simple line. I need help with using this algorithm to create a polygon with equal sides and angles. The sides will be the line created by the Bresenham algorithm, but how do I use the created…
Mr Wigg
  • 41
  • 2
  • 9
0
votes
2 answers

Filled Bresenham circle with some color in OpenGL

I am using this Bresenham's algorithm to draw circle. This code works, but I need filled circle, not only border. This is my code: void setPixel(int x,int y) { glBegin(GL_POINTS); glColor3f(0.0f, 1.0f, 0.0f); glPointSize (20.0); …
Ivan Vulović
  • 2,147
  • 6
  • 27
  • 43
0
votes
1 answer

Drawing a Triangle with a Horizontal Base

I have written a function to draw a house. def drawHouse(): pic=makeEmptyPicture(400,400) for x in range (0,400): for y in range (0,400): px =getPixel(pic,x,y) if y <180: #sky color=makeColor(137, 194, 255) if…
user3956566
0
votes
3 answers

Bresenham's line algorithm. Does exist ncurses output for file?

I have homework, ASCII line plot drawer. I must print graph into to file. All algoritms of Bresenham's line algoritm have function SetPixel ( x, y ); in loops. This function must print pixel by x and y. NCurses library is idealy solution for print…
user1779502
  • 573
  • 2
  • 8
  • 16
0
votes
2 answers

Can I easily skip pixels in Bresenham's line algorithm?

I have a program which is using Bresenham's line algorithm to scan pixels in a line. This is reading pixels rather than writing them, and in my particular case, reading them is costly. I can however determine that some spans of pixels do not need to…
izb
  • 50,101
  • 39
  • 117
  • 168
0
votes
2 answers

Bresenham Lines Drawing Alogrithm

There Is Something In Bresenham's Floating Point Algorithm which annoying me. The Algorithm is listed below : void line(x0, x1, y0, y1) { int deltax = x1 - x0; int deltay = y1 - y0; float error = 0; float deltaerr = Math.abs((float)deltay /…
S.A.Parkhid
  • 2,772
  • 6
  • 28
  • 58
0
votes
1 answer

Pseudcode to java

I have looked around for the past hour or so but I can not find any help on this problem. I am trying to convert this pseudocode to java and can not figure out what I am doing wrong(it ever prints anything). function line(x0, x1, y0, y1) …
me me
  • 778
  • 2
  • 7
  • 18
0
votes
1 answer

Store Bresenham generated circle as polygon?

I'm generating circles using the Midpoint circle algorithm. I don't want to draw these circles. Instead, I want to store them as polygons. Obviously, the coordinates are in the wrong order so if I would draw these circles using e.g.…
l33t
  • 18,692
  • 16
  • 103
  • 180
-1
votes
1 answer

How to rasterize a vector image in C++ Win32 API

recently I have been trying to experiment with vector graphics in C++. I want to make a Win32 app that reads an svg file and shows it on the screen. The program currently is simple. A window opens using the Win32 API and a .svg file is selected.…
-1
votes
1 answer

Bresenham's algorithm next pixel?

In line drawing, bresenham's algorithm was explicitly derived for lines with slopes between 0 and 1 in the first octant from point P1 to point P2, where the x value of P1 is less than that for P2. In the incremental version of this algorithm, once…
-1
votes
1 answer

Using Bresenham's line-algorithm or similar to fill a rectangle

I would like to create a filled rectangle from four points using Bresenham's line-algorithm or similar to get smooth sides. I came across this answer on Stack Overflow [link] that works perfectly for creating a line between two points. How can I…
Blc
  • 58
  • 5
-1
votes
2 answers

Bresenham Algorithm using opengl GL_POINTS is pretty slow

Is there to anyway speed this up? I came to learn, accessing the Frame Buffer itself can do it quickly. but i dont know how... is there a way to do that in opengl?
AnnShress
  • 477
  • 1
  • 5
  • 11
-1
votes
1 answer

Render Line From Rectangles

I've currently implemented the Bresenham line algorithm for a tile based world editor I'm developing. For Shift + Click functionality, I would like to render a line based off the selection rectangle from a tileset. This is simple, as I can just find…
Austin Brunkhorst
  • 20,704
  • 6
  • 47
  • 61
1 2 3
11
12