Тёмный

2D Graphics Algorithms (part 2) 

Brian Will
Подписаться 95 тыс.
Просмотров 57 тыс.
50% 1

Bresenham's line algorithm and image rescaling with nearest-neighbor interpolation and bilinear interpolation. Part of a series teaching game programming. Visit codeschool.org

Опубликовано:

 

24 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 30   
@gewaleelek5884
@gewaleelek5884 9 лет назад
simplest explanation for image resize interpolation. i love how it's visualized and it's easy to understand, unlike other sources i found.
@sgtborup
@sgtborup 10 лет назад
You have no idea how much of a relief this was to watch, most of the sources i found on the internet treated bilinear transform with a matrix approach, i just wanted an example damn it !
@fredvin27
@fredvin27 10 лет назад
Very awesome video, just what I was trying to understand !
@scawa1952
@scawa1952 11 лет назад
Gosh... I remember in the 70's looking at the code in the Apple II and learning this graphics algorithm from the code that was in the ROM part of their OS.
@jeyko666
@jeyko666 4 года назад
wow SUCH a NICE explanatrion!!
@trudawg0814
@trudawg0814 7 лет назад
I think there is an error at the code in 6:47 if I am correct. Where it says y = y1 it should be x = x1.
@jellohunter7981
@jellohunter7981 4 года назад
Great video,
@Haligonian
@Haligonian 2 года назад
Thanks for this great video. One thing I'll note is that I think the integer optimization to Bresenham's only works if the rise and run are integers.
@Matyanson
@Matyanson Год назад
The algorithm expects coordinates of the endpoints to be Int.
@353click
@353click 10 лет назад
i think you meant 1.6 rounds to 2 on the fourth pixel
@SpicyMelonYT
@SpicyMelonYT 4 года назад
yeah i noticed that too, 6 years after you haha
@handlol
@handlol 4 года назад
@@SpicyMelonYT same
@mayabartolabac
@mayabartolabac 3 года назад
@@handlol same
@du42bz
@du42bz 3 года назад
@@mayabartolabac Same
@C4rnee
@C4rnee 3 года назад
@@du42bz same
@sc5shout
@sc5shout 2 года назад
finally not some ununderstable mumble talk! Thanks
@sandebeallaline4995
@sandebeallaline4995 3 года назад
How do I draw and flatten the number of lines in the main function at once?
@nguyenquang2907
@nguyenquang2907 5 лет назад
What you were explaining in the video is an incremental error algorithm, but NOT the Bresenham algorithm. It is not precise because of the usage of floating-point representation could cause computed points to drift away from their actual position when the line is relatively long. The code you wrote does not use the floating-point multiplication which makes it faster than the direct implementation using the line equation, however, it does use the floating-point addition. On the other hand, Bresenham’s approach allows integer-only arithmetic, which is generally faster than using floating-point arithmetic.
@tom_forsyth
@tom_forsyth Год назад
At the 6-minute mark, he does actually get to true Brezenham, without divides or floating point.
@jammydodger1449
@jammydodger1449 7 лет назад
Wooo hoo! Someone who doesn't have a thick Indian accent!
@muhammetcolak511
@muhammetcolak511 6 лет назад
Jammy Dodger ty sir made my day
@profhaxable
@profhaxable 11 лет назад
Damn I love learning llike this, keep the good work up man. Can't thank you enough (:
@dl4006
@dl4006 4 года назад
thank you
@Hillstylelife
@Hillstylelife 5 лет назад
thanks!
@freemindfreemind9865
@freemindfreemind9865 7 лет назад
great video, help me a lot. I think there are some mistakes in the actual interpolation resultat @12:35, the result should be 0 0 1 1 2 3 3 4 instead of 0 0 1 2 2 3 4 4. those integers represents the source cells' colors.
@wm8123
@wm8123 2 года назад
Hi there, did you notice you can go around floats to? You just need three booleans, which indicate, wether delta is negative. Lets call them xDecr, yDecr and slopeNegative. C-Language: If (xDecr != yDecr) slopeNegative = true; // XOR "^" would be the same if (delta.x == delta.y) // slope = 1 [...code...] else if (delta.x > delta.y) // slope < 1 [...code...] else // slope > 1 [...code...]
@nates9778
@nates9778 2 года назад
This line drawing algorithm is annoying to implement when you want to be able to clamp the points to the edges of the screen when you're passing points _outside_ the screen space. I was playing around with projecting 3d points onto a 2d screen, and when the 3d points were close to the camera, the projected 2d points would "explode" in magnitude out towards a billion or something and when you don't clamp to the screen, you're iteration over the line drawing routine a billion times which isn't ideal. I did implement clamping for the slow version correctly which is nice, but it's less obvious with Bresenham's algorithm.
@chibimentor
@chibimentor Год назад
M.U.G.E.N 有限責任
@chibimentor
@chibimentor Год назад
MAZDA 6
@BleachWizz
@BleachWizz 3 года назад
Omg... is this it? C'mon isn't this the best example on why you would want to represent polynomials as vectors? Each coeficient is a derivative/n! with n = position so you run adding them until you add to the position as in euler integration and you can figure out the y increment and the rest goes as usual. So you plot any polynomial...
Далее
Visualizing Pathfinding Algorithms
10:03
Просмотров 149 тыс.
Smart Sigma Kid #funny #sigma #comedy
00:26
Просмотров 11 млн
OpenGL - rasterization
16:53
Просмотров 18 тыс.
How Your Computer Draws Lines
4:26
Просмотров 174 тыс.
How Real Time Computer Graphics and Rasterization work
10:51
The Most Legendary Programmers Of All Time
11:49
Просмотров 538 тыс.
A Comparison of Pathfinding Algorithms
7:54
Просмотров 711 тыс.
The Algorithm Behind Spell Checkers
13:02
Просмотров 408 тыс.
Giving Personality to Procedural Animations using Math
15:30
Game States and Game Loops
27:31
Просмотров 30 тыс.
Let's Code MS DOS 0x20: Bresenham Line Drawing
37:53
Просмотров 1,8 тыс.
Smart Sigma Kid #funny #sigma #comedy
00:26
Просмотров 11 млн