Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
13 votes

Plotting the Mandelbrot set efficiently

Unnecessary use of OpenGL Using OpenGL to draw individual pixels is the completely wrong thing to do. Apart from requiring OpenGL support which might not be present on all systems, this has a huge ...
G. Sliepen's user avatar
  • 56.8k
12 votes

The Wu line drawing algorithm for anti-aliased lines optimization

This submission is about performance, yet it includes zero profiling, nor even throughput measurements (lines per second, for some uniform line length). describe prior work It would have been helpful ...
J_H's user avatar
  • 27.4k
10 votes

Can I draw a square with pixels more efficiently?

Disclaimer I don't have a working C compiler on my work computer, nor do I have Xlib available to me (I'm also not familiar with it, at all). That being said, given that we know our image is a square, ...
Dan Oberlam's user avatar
  • 7,804
8 votes

Can I draw a square with pixels more efficiently?

The real performance issue here is fairly simple: good performance is obtained by not repeating steps. The big step that you are doing repeatedly is to figure out where the pixel goes in the output ...
David G.'s user avatar
  • 1,356
8 votes

Rendering primitive 2D shapes

Your use of underscores to prefix methods is not a good idea since they are reserved. The lack of comments through out the code mean that it is more difficult to read than it should be. You should ...
Code Gorilla's user avatar
  • 1,592
7 votes
Accepted

Drawing an Archimedean spiral using Pillow

With the default values, the spiral does not look very smooth: it's easy to see that it's been drawn using a series of straight-line segments. That's because the step in \$\theta\$ is quite large — 0....
Gareth Rees's user avatar
  • 49.6k
7 votes
Accepted

Drawing the flag of Liberia

...
StardustGogeta's user avatar
7 votes
Accepted

Writing little package for rubber ducks in tikz

Not much to say about the last version; on the other hand, you could exploit PGF keys. ...
egreg's user avatar
  • 608
7 votes

Simulating a Solar System Using Command-Line Graphics

Finally, I am well aware that the value of the gravitational constant 𝐺 is 6.67408×10−11 and not 0.5, as I have implemented it here; using the correct value of 𝐺 results in a simulation that runs ...
Eric Lippert's user avatar
  • 14.9k
7 votes

Plotting the Mandelbrot set efficiently

First impression is that the code is very dense. Reading would be a bit easier if you give the code room to breathe! Variable names in particular are short and uninformative (why do we have both <...
Toby Speight's user avatar
  • 75.7k
7 votes

Plotting the Mandelbrot set efficiently

General Observations I would not want to maintain this code or delegate this code to someone else to maintain. It is difficult to read and even more difficult to modify. Before trying to optimize the ...
pacmaninbw's user avatar
  • 23.8k
6 votes

Unexpected Low FPS while drawing images

Firstly, I recommend you format your code. In Eclipse, the shortcut is CTRL + SHIFT + F, in IntelliJ, it is CTRL + ALT + L. This is because of the following: A lot of your functions are defined like ...
Justin's user avatar
  • 3,295
6 votes

Car generation algorithm

g = ActiveForm.CreateGraphics(); This is bad. The old or previous Graphics object needs to be disposed before you create a new ...
t3chb0t's user avatar
  • 44.3k
6 votes

Sims-style walls part 2: Flood fill

I happen to like the way I've lined stuff up since it helps with debugging and spotting patterns I do not necessarily reflect this opinion. You use a lot of very short variable names for parameters ...
t3chb0t's user avatar
  • 44.3k
6 votes
Accepted

Sierpiński's carpet fractal animation for teaching Python 3

Algorithm You can simplify the code and make it run faster if you construct the next-level carpet by continuing to work on the previous image (punching more holes in it), rather than starting with a ...
200_success's user avatar
6 votes
Accepted

Menu for X11 using Xlib in C

Prefer functions and const variables over macros While the LEN macro might be unavoidable, MIN and ...
G. Sliepen's user avatar
  • 56.8k
6 votes
Accepted

ad hoc logging in c++ projects

Write clear and concise error messages You will notice that almost any program will not log anything when things are fine. That's desired, because you don't want to be distracted by information that ...
G. Sliepen's user avatar
  • 56.8k
6 votes
Accepted

Python module to print in printer

Wrong Conceptual Model An interesting module, but you need to rethink it a bit. It is a print context, not a document. A document would hold things like paragraphs, images, charts, and what not. ...
AJNeufeld's user avatar
  • 33.7k
5 votes

Car generation algorithm

I would expect separating the UI interactions, the drawing actions and the generating car actions. AppManager - The Application Manager ...
chenop's user avatar
  • 196
5 votes
Accepted

8086 ASM Bresenham's Line Algorithm Pt2

Analysis (in random order) mov ah, 00h mov al, 03h int 10h mov ah,04ch mov al,00h int 21h We always strive to get the smallest code without loosing readability. ...
Sep Roland's user avatar
  • 4,418
5 votes
Accepted

Conway's Game of Life in Win32/GDI

Regarding 1.: Sure, you can just add a border to your field. That's trading space for code-simplicity, which is distinct from efficiency. Regarding 2.: Sure, there's no reason why you cannot just ...
Deduplicator's user avatar
  • 19.3k
5 votes
Accepted

CLIGL - A library for command line graphics

RenderingPixel Well, a struct should be immutable if possible. For the RenderingPixel struct this is possible by making the ...
Heslacher's user avatar
  • 50.4k
5 votes

Simulating a closed particle system in Java

I don't like Comments :P - no, really: /** * The mass of this particle. */ private final double mass; That should be really obvious. And there's also those ones: ...
slowy's user avatar
  • 1,866
5 votes

Voxel engine to draw cubes

Your question is very broad and without enough code to do anything else than speculate. Regardless, I will venture an answer based on speculation. I believe that how to best improve your performance ...
Emily L.'s user avatar
  • 16.6k
5 votes

Math matrix, mainly for graphics

Data layout A first impression gives me some concerns about your data representation. Firstly, in modern C++, we can avoid the responsibility for ownership of resources - instead, we can use (...
Toby Speight's user avatar
  • 75.7k
5 votes

Generic pixel class to seamlessly alpha-blend and convert between different pixel structure layouts

The code seems to get more and more questionable as we read downward. Starting at the bottom: ...
Quuxplusone's user avatar
  • 19.4k
5 votes

Shorten a SVG file created with Inkscape

SVG is written in XML. As a rule, you should prefer using proper XML tools to process XML rather than doing ad hoc text substitutions, for robustness and maintainability. Look into using XSL ...
200_success's user avatar
5 votes

Vulkan application to draw a triangle

Given the amount of code, I can’t do a detailed review. I can’t even really do a holistic design review; that would require days of studying the code. lol_engine.cc ...
indi's user avatar
  • 11.3k

Only top scored, non community-wiki answers of a minimum length are eligible