Answer the question
In order to leave comments, you need to log in
Algorithm for the correct circle of cells (pixels)?
In general, my task is more complicated:
Given the radius of a cylinder of cubes.
The height of the cylinder is half the radius.
You need to get an array with the relative coordinates of the cubes that make up the cylinder. Also, together with the coordinates, the distance from the cube to the center of the cylinder is stored. Here is a class for storing information of one cube.
data class Point(val x: Int, val y: Int, val z: Int, val distance: Double)
Answer the question
In order to leave comments, you need to log in
there is also a book, Programming graphics for windows
Well, or any similar book
Pixel art is an artistic technique that has nothing to do with engineering graphics, for example.
Roughly speaking, a perfectly pixelated circle can look ugly in your game.
And if he cut corners, then you can achieve visual beauty. Only from the point of view of mathematics, it will already be an oval or RoundRect.
I have nothing against Bresenham's algorithms. But this is about something else.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question