Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [line-drawing]

The tag has no usage guidance.

0
votes
1answer
39 views

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 ...
1
vote
1answer
40 views

Drawing Directed Lines (with arrow endings)

I am working on a simple graph viewer with OpenGL. My problem with is directed edges. I tried to draw arrow endings with GL_TRIANGLES but somehow my calculations are off. I've used direction cosine ...
2
votes
0answers
32 views

Can you disable strip cutting (AKA primitive restart) on Direct3D 11?

Line strips and triangle strips are drawing modes supported across 3D graphics APIs, such as OpenGL, Direct3D, and Vulkan. When using indices to control drawing, a more recent feature is "strip ...
1
vote
1answer
42 views

How different can the number of pixels in a straight line be to its real length?

I'm working on a game with a programmable robot. It uses a laser range finder to get the distance to walls. I'm using DDA to generate a line from the robot, going in the direction it is pointing, ...
1
vote
1answer
99 views

Bresenham's Algorithm not drawing horizontal lines

I'm getting started with graphics and I'm having trouble implementing the Bresenham's algorithm. Now, I know that my implementation is incomplente, but I can't see why it doesn't make horizontal lines(...
6
votes
1answer
143 views

Logarithmic spiral with equal vertex spacing, what equations?

I need to draw a logarithmic spiral (or close approximation) whose vertices are equally spaced, such that the lines between any two consecutive vertices are of equal length. (Actually, that spiral is ...
1
vote
0answers
104 views

Finding Segments in Continuous line

I'm trying to break a continuous line segment into multiple, straight segments. I've tried using the Hough transform but have found it unreliable for getting the line segments I'm looking for and ...
4
votes
2answers
124 views

First steps towards CAD standard curve fitting

I am interested in building a program to accomodate the following workflow: A user begins with an arbitrary vector/CAD shape, which they wish to transfer onto paper without using a printer (there are ...
7
votes
1answer
118 views

Anti-aliasing - Controlling colour density of pixel that comes within the “rectangle” surrounding my line

I am currently a beginner when it comes to anti-aliasing. I have read some notes online that how anti-aliasing works is that you first draw the line using an algorithm such as Bresenham's algorithm. ...
6
votes
1answer
176 views

How to rasterize a line when the background color is not always white?

I've to rasterize a line taking into account not only the background color of the screen, which is white, but also the color of other objects in the scene. In my case, I've just another object, a ...
2
votes
1answer
557 views

Bezier Curve Tool Controlled by Mouse

So I have recently learned about Bezier Curves (quadratic & cubic) and have a thorough knowledge of how they work. In my graphics engine in DirectX I wanted to implement a Bezier Curve Tool ...
7
votes
1answer
149 views

How to never draw “Jaggies” in the first place considering resolution and scale

Ok, I have a simulation I am trying to make. The entire simulation is drawn by circles (with gl_Point) and rectangles (gl_triangles with indices). It would be great to add some anti aliasing ...
1
vote
1answer
46 views

How would I create a virtual cabling system?

I am trying to devise a GUI system that functions as a virtual patchbay, as seen in something like Logic Studio's environment editor, or seen in virtual synthesizers that use virtual patchcables. I'm ...
5
votes
2answers
641 views

Bug with the Bresenham's line drawing algorithm?

I know how to draw lines with DDA, but I want to learn a more efficient way and Google suggests Bresenham's line drawing algorithm is better than DDA. Here is my implementation: ...
10
votes
2answers
4k views

What is an index buffer and how is it related to vertex buffers?

I have a vertex buffer like this: 0.0, 0.0, 1.0, 0.0, 0.0, 0.6, 1.0, 0.6, 0.5, 1.0 I have the following index buffer: ...
7
votes
2answers
484 views

Rotate line around center

I have to use a propriertary graphics-engine for drawing a line. I can rotate the whole drawing by its origin point (P1). What I want, is to rotate it around its center point(M). So basically that it ...
2
votes
0answers
561 views

Problems in using cox regression with restricted cubic spline plot with R software

In R software, I want to plot a graph by using cox regression with the restricted cubic spline method. However, I can't quite get it to work. This is the code I'm using: ...
9
votes
1answer
393 views

How should I fill a shape consisting of Bezier curves and straight lines?

I have been working on a graphics library for some time now and have gotten to the point where I have to draw Bezier and line based fonts. Up to this point I am stuck with this: The green lines are ...
7
votes
2answers
489 views

Best technique to draw overlapping colored line segments that follow the same route

I'm not too versed in computer graphics so my question may be vague. I'm given a sequence of GPS coordinates which I draw on an iOS map, and they define bus routes. Some of the bus routes happen to ...
5
votes
1answer
828 views

Draw angles lines in raster graphics using bresenham line algorithm

I at the moment trying to draw some angled lines using bresenham line algorithm which can circulate a 2d array of size 21x21, as a line angled from 0 - 2pi. So the idea is that the program has to ...
8
votes
1answer
350 views
2
votes
0answers
47 views

Draw lines angled from 0 to 2 pi in a raster grid [duplicate]

I am trying to draw an angled line in a raster grid. The idea is to create a function that given a start point, a length and an angle, would give me the pixel positions that combined would give me a ...
6
votes
1answer
290 views

How to calculate matching roundness of two offset rectangles?

I have two rectangles — one with a fill (blue) and one with a stroke (red). The red rectangle is being offset (depending on the stroke width) so that it appears snug and outside the edge of the blue ...
11
votes
1answer
3k views

Fast antialiased line drawing

Bresenham's line algorithm is a way of drawing straight lines using only fast integer operations (addition, subtraction, and multiplication by 2). However, it generates aliased lines. Is there a ...