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
3
votes
0 answers

Algorithm inorder to Convert a Triangular Facet to Voxelised Model

I have the following vertices: (x1,y1,z1),(x2,y2,z2) and (x3,y3,z3). I have followed the below approach: Calculating the bounding box of the facet. The length of the bounding box is Maximum(xmax-xmin, ymax-ymin,zmax-zmin) where xmax,xmin,....,zmin…
3
votes
1 answer

Draw a line between two pixels on a grayscale image in Julia

I have a greyscale image in Julia and I'd like to draw a straight line on the image. I have two pairs of coordinates. They represent the start (x1,y1) and end (x2,y2) pixel positions of where the line should start and end. I'm not sure how to find…
lara
  • 835
  • 1
  • 8
  • 20
3
votes
2 answers

Is there an error in the Bresenham's algorithm from Wikipedia?

Bresenham's algorithm is used to draw a line on a square grid as are pixels for example. The algorithm is partly based on the subdivision of the plane into 8 parts called octants. The trick is to use symmetries to generalize the algorithm…
Delgan
  • 18,571
  • 11
  • 90
  • 141
3
votes
1 answer

Ray tracing: Bresenham's vs Siddon's algorithm

I'm developping a tool for radiotherapy inverse planning based in a pencil-beam approach. An important step in these methods (particularly in dose calculation) is a ray-tracing from many sources and one of the most used algorithms is Siddon's one…
3
votes
4 answers

Bresenham's line drawing Code

I'm trying to draw a line in C language using Bresenham's algorithm.I'm using turbo C++ in dosbox for windows 7 to implement this code.While compiling i'm not getting any error but when i run the code the programs terminates after obtaining the 2…
Lucy
  • 1,812
  • 15
  • 55
  • 93
3
votes
1 answer

high-speed drawing algorithm for cornu spiral/spline?

Has anyone seen a decent drawing algorithm for cornu spirals (aka, clothoids) or splines? For arcs and lines we have things like Bresenham's algorithm. Is that adaptable to clothoids? The Wikipedia page has this Sage code: p =…
Brannon
  • 5,324
  • 4
  • 35
  • 83
2
votes
1 answer

OpenGL Line Drawing Artifacts

I am using OpenGL/GLUT to implement Bresenham's line drawing algorithm and having some issues with seemingly arbitrary artifacts showing up. Here is an example: Here is some code that I think may be relevant. I didn't include the code that…
Kyle
  • 1,978
  • 1
  • 18
  • 30
2
votes
3 answers

Bresenham lines w/o diagonal movement

Is there a modified Bresenham algorithm, where the step from one pixel to the next one isn't allowed to be diagonally, just horizontally or vertically? Or any other algorithm which does that? (PHP preferred) Right: 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0…
user355318
2
votes
2 answers

Reverse Bresenham algorithm? How to convert array of drawn pixels into coordinates

Does there exist an algorithm that can analyze an array of pixel coordinates, and return an array of line coordinates that, when drawn using Bresenham's algorithm, would generate lines that cover the same pixels as the original array? One use case…
2
votes
1 answer

What does the variable D do inside the while in this Bresenham's line drawing algorithm?

I've found this Generalized Bresenham's Line Drawing Algorithm and I'm having a hard time understanding what the while is doing here. Any help is greatly appreciated. the code: #define sign(x) ((x > 0)? 1 : ((x < 0)? -1: 0)) x = x1; y = y1; dx =…
MiguelP
  • 416
  • 2
  • 12
2
votes
0 answers

Understanding modified version of Bresenham's algorithm?

I was recently reading a paper by Alois Zingl about rasterization algorithms. I didn't get very far before I totally lost understanding of the algorithm. From my research I believe this algorithm is some kind of version of Bresenham's line drawing…
James51332
  • 164
  • 11
2
votes
2 answers

Bresenham algorithm

Possible Duplicate: how do I create a line of arbitrary thickness using Bresenham? How can I use Bresenham algorithm to draw lines of more than a pixel thick? Do i have to run the algorithm many times with an offset from x and y?
JustCurious
  • 1,848
  • 3
  • 30
  • 57
2
votes
1 answer

Find corners/edges on a shape (minimum vertices that can define that shape)

I'm trying to get the corners of the following shape: By corners I mean this (red dots): The minimum quantity of points that can define this shape. And I have implemented the following: public Shape Optimize() { // If the vertices…
z3nth10n
  • 2,341
  • 2
  • 25
  • 49
2
votes
1 answer

Bresenham’s Circle Algorithm

https://www.geeksforgeeks.org/bresenhams-circle-drawing-algorithm/ I was looking at Bresenham's algorithm which I'm trying to use to make a MS paint style application. I've implemented it into python and it works. However, I was not sure HOW this…
2
votes
3 answers

Drawing circle with Bresenham's Algorithm on OpenGL

I can draw a circle with the algorithm. However, the boundary looks weird, the pixels look so separate from each other. I want them to be closer. I have tried to bigger the point size. But the result is not that much good. So, I was thinking that…
Sammy
  • 885
  • 3
  • 13
  • 32
1 2
3
11 12