NoBS Code
NoBS Code
  • 7
  • 270 484
Xiaolin Wu's Line Algorithm - Rasterizing Lines with Anti-Aliasing
In this video we'll take a look at Xiaolin Wu's line algorithm. It can draw anti-aliased lines at sub-pixel positions, which results in lines that look and move smoother than those drawn using e.g. Bresenham's algorithm.
- Chapters -
0:00 - Introduction
0:40 - Notes and Recap
1:22 - Deconstructing Wu's Line
3:25 - Plotting Points
5:22 - Distances & Opacities
6:35 - Fixing the Function
7:58 - Handling the Endpoints
10:17 - Conclusion
- Music Credits -
Music by Tokyo Walker Music, released under the CC BY-NC-SA 3.0 license.
Songs:
Closing Time - www.soundcloud.com/user-356546060/closing-time
Lamp - soundcloud.com/user-356546060/lamp
Artist Media & Socials:
Spotify: open.spotify.com/artist/7cktl8j9CsS2TwsgzakhsD
Apple Music: music.apple.com/us/artist/tokyo-m…walker/1503480346
TH-cam: th-cam.com/channels/3lLfvhpPGtwd5qD25cMDcA.html
Instagram: tokyo_music_walker
Twitter: TMW99407138
มุมมอง: 66 468

วีดีโอ

The Midpoint Circle Algorithm Explained Step by Step
มุมมอง 140K2 หลายเดือนก่อน
In this video we'll take a look at how the midpoint circle algorithm works. We go through all steps required to implement the algorithm. - Chapters - 0:00 - Introduction 1:07 - First Implementation 4:05 - Testing the Midpoint 5:40 - Initial Decision Parameter 8:10 - Approximation 9:52 - Incrementing Decision Parameter 13:03 - Conclusion - Music Credits - Music by Tokyo Walker Music, released un...
Bresenham's Line Algorithm - Demystified Step by Step
มุมมอง 63K4 หลายเดือนก่อน
Bresenham's Line Algorithm is simple, but how exactly does it work? In this video we go through the steps necessary to draw a line inside a grid of pixels using only integers. To do this, we're going to write the algorithm from scratch and derive the decision parameter used in Bresenham's algorithm. - Chapters - 0:00 - Intro 2:00 - Draw Lines using Floats 3:32 - Supporting all Octants (Floats) ...
How Computers Store Text - ASCII, Unicode, UTF-8, UTF-16, and UTF-32
มุมมอง 2.6K5 หลายเดือนก่อน
How do computers store text? In this video you will learn how we encode text into numbers, and decode those back into text. We'll talk about the ASCII and Unicode standards, as well as the UTF-8, UTF-16, and UTF-32 text encodings. The former standards represent characters and codepoints respectively to store text in binary. The UTF-8, UTF-16, and UTF-32 encodings are used to actually represent ...
How Computers Store Binary Data - RAM, ROM, Flash, Magnetic, and Optical
มุมมอง 9045 หลายเดือนก่อน
This video explains how computers are able to store data using physical devices, such as Hard Disk Drives, Solid State Drives, Memory, and more. We go over volatile storage devices like dynamic random access memory, to non-volatile devices such as ROM, Flash Memory, and so on. Chapters 0:00 - Intro 0:18 - Switches & Transistors 1:42 - Semiconductor 3:13 - Building a Diode 4:37 - Building a Tran...
How does Hexadecimal work? And why do we use it?
มุมมอง 5115 หลายเดือนก่อน
This video explains how hexadecimal works in simple terms. It covers the basics and how to convert hexadecimal to decimal, convert decimal to hexadecimal, convert hexadecimal to binary, convert binary to hexadecimal, and explains why we would use hexadecimal in the first place. - Chapters - 0:00 - Hexadecimal Number System 1:09 - Hexadecimal to Decimal 1:33 - Decimal to Hexadecimal 2:41 - Hexad...
How does Binary work? From the Basics to Floating Point
มุมมอง 9755 หลายเดือนก่อน
This video explains how binary works in simple terms. No prior knowledge required. It covers everything from basic conversions to binary arithmetic, sign bits, ones complement, twos complement, biases, fixed point, floating point numbers, and more. - Chapters - 0:00 Intro 0:11 Binary Numeral System 1:00 Binary to Decimal 1:15 Decimal to Binary 2:01 Conversion by Halving 2:30 Conversion by Doubl...

ความคิดเห็น

  • @leonthayne
    @leonthayne 8 นาทีที่ผ่านมา

    These videos are amazing. Hope you post more soon.

  • @asthabahuendra3391
    @asthabahuendra3391 9 ชั่วโมงที่ผ่านมา

    U LEGEND HOW U DO THIS MAN

  • @discoHR
    @discoHR วันที่ผ่านมา

    I'd take stable and sharp Bresenham over the unstable antialiased Wu any day. I just can't stand when a line changes color while moving/rotating. It must remain the same color over the same background regardless of the movement/rotation.

  • @Adam_Lyskawa
    @Adam_Lyskawa 2 วันที่ผ่านมา

    This is just basic highschool geometry applied. I wish I was taught this at school. I mean - not the geometry, but how can it be used to draw things on screens ;) When I look at it now it's so easy and obvious, but back in the days, when I was a kid that was way more intelligent than I am today, but I had no necessary knowledge or experience - such algorithms was just magic. I had the geometry from school, I had some programming knowledge from books but I was not able to figure out how to draw vector graphics properly. I've seen articles on this in magazines, I read about them in books but it was like too hard for the teenage me. Now my brain is much slower, but when I see how the algos work, I'm sure you could easily explain it to a 10 year old.

  • @PASHKULI
    @PASHKULI 3 วันที่ผ่านมา

    How the algor. knows it has completed 1/8 of the circle?

  • @dthunes
    @dthunes 3 วันที่ผ่านมา

    This is the first time i wish i could give more likes.

  • @cypher2960
    @cypher2960 4 วันที่ผ่านมา

    what do you use for the animations?

  • @astropgn
    @astropgn 5 วันที่ผ่านมา

    0:40 if they are symmetrical, why 1/8? Why not 1/16? 1/32?

  • @arunoruto
    @arunoruto 7 วันที่ผ่านมา

    If I am not mistaken, you can also multiply p by four and you would get rid of the fractions, while still only checking for the sign of p, i.e., 4*p.

  • @vahiddanesh4661
    @vahiddanesh4661 7 วันที่ผ่านมา

    I can't imagine how I came across to this beautiful video by learning about AccelStepper library!

  • @Japrajah
    @Japrajah 12 วันที่ผ่านมา

    13:13 Filled circle has easier algorithm. You can fill every pixel on some distance from point. By using sqrt + pow

  • @shalevforfor5550
    @shalevforfor5550 12 วันที่ผ่านมา

    can't you just use cosine and sine ?????????

    • @shalevforfor5550
      @shalevforfor5550 12 วันที่ผ่านมา

      having a line that spin and put a point in his end point

  • @KonstantinKuzvesov-s2h
    @KonstantinKuzvesov-s2h 13 วันที่ผ่านมา

    Why not calculate 4*p instead of p ? This will help to get rid of fractional numbers like 0.25 or 1.25 and convert everything into integers, while preserving the sign of p.

  • @dottedboxguy
    @dottedboxguy 18 วันที่ผ่านมา

    it'd be neat if you looked into signed distance fields for fast anti-aliased vector graphics, it's quite versatile. i can give some ressources if you want to look into it (or even discuss about it) !

  • @VideoNOLA
    @VideoNOLA 19 วันที่ผ่านมา

    The intermediate conclusion that 2x+1 predicts the next increment, is synonymous with what calculus shows as the slope of the curve x*2 + 2x + c. It's just the slope or derivative of the quadratic at a given value of x, which is not only helpful to realize, but definitely computationally leaner than just calculating points brute-force. Nice tutorial!

  • @WhiteDragon103
    @WhiteDragon103 19 วันที่ผ่านมา

    One minor flaw - 45 degree lines will be about 30 percent thinner than horizontal or vertical lines, since the algorithm basically "shears" a square rather than rotating and stretching it.

  • @Dyas777
    @Dyas777 19 วันที่ผ่านมา

    Nice style of explanation!

  • @ВладимирОгородников-и1ы
    @ВладимирОгородников-и1ы 22 วันที่ผ่านมา

    The slight difference you've noticed when truncating 0.25 appears because of using > instead of >=. For INTEGER values A and B, the inequality A + 0.25 > B is equivalent to A >= B. So in the code you need to replace the check "p > 0" with "p >= 0".

  • @gigelgigica
    @gigelgigica 25 วันที่ผ่านมา

    This video would’ve saved me in university, keep it up 🫡

  • @fremsoft
    @fremsoft 25 วันที่ผ่านมา

    Super! What software are you using for creating these wonderful animations?

  • @MiccaPhone
    @MiccaPhone 25 วันที่ผ่านมา

    Why flipping coordinate system against mathematical standards? Want to sound important?

  • @benholroyd5221
    @benholroyd5221 25 วันที่ผ่านมา

    0:43 I can think of simple ways of mirroring a quarter circle into a whole circle. doing it with 16ths would seem to be as hard as the original problem. or am I missing somthing

  • @ZomB1986
    @ZomB1986 26 วันที่ผ่านมา

    I'm disappointed for two reasons. First off, it's nicely animated, no worries there. The problem is the algorithm is simple. I was interested because it had a fancy name, but it turns out to be something I independently invented long ago, and probably many others did so too. Second, you don't seem to apply sRGB correction, i.e. 50%+50% ≠ 100%. In fact it's more like 69%+69% = 100% in sRGB space. That's why in all your animations, the line looks like it has gaps in every place where two half-opaque pixels meet.

  • @menachemsalomon
    @menachemsalomon 28 วันที่ผ่านมา

    "There is zero room for bigotry and racism" well, CNN, you are hosting Mehdi Hassan, so that's a false statement right there.

  • @menachemsalomon
    @menachemsalomon 29 วันที่ผ่านมา

    Thanks. I've seen Bresenham's algorithm before, but this explained it in a way I would be able to reproduce (or rederive) without having to memorize the algorithm. An additional note you may find humorous: You are referring to _y_ subscript 0 as "y naught", but the way you pronounce _naught_ sounded to me as if you had said, "Let's change _why_ to _why not."_ (People make fun of New Yorkers for the way we say _cawfee,_ but our _naught_ doesn't sound like our _not.)_

  • @BartomiejGawron
    @BartomiejGawron 29 วันที่ผ่านมา

    I did it the same way a long time ago, but instead of calculations I used the fact that the squares of consecutive natural numbers differ by consecutive odd numbers (which also comes out at 11:20), so all I had to do was add and subtract

  • @rkalle66
    @rkalle66 หลายเดือนก่อน

    I'm not into this stuff of optimizing but my idea is to calculate only every second step and filling the gap with DrawLine. Does it work?

  • @creative1978
    @creative1978 หลายเดือนก่อน

    Your ability to explain is amazing. Thank you for this video and for the time you have dedicated to us.

  • @creative1978
    @creative1978 หลายเดือนก่อน

    I subscribed to your channel in a split second, very good, keep it up!

  • @mjthebest7294
    @mjthebest7294 หลายเดือนก่อน

    The opacity is messed up. Lines look terrible, not "perfectly antialiased". Even if the opacity is corrected, vertical/horizontal distance is just an approximation due to triangular inequality. No DDA? Floats? Python?? C'mon! The video had a lot of potential for the way it is presented.

  • @hrayz
    @hrayz หลายเดือนก่อน

    You showed the partially finished result but not the end result. Show how it looks completed.

  • @em00k
    @em00k หลายเดือนก่อน

    An excellent explanation, really expressed how the algorithm works Top video.

  • @saultube44
    @saultube44 หลายเดือนก่อน

    Initially, This is the worst kind of explanation you can make: figure the problem out, and them put solutions that are at the end to the beginning, to make you look smart, offering no process why it was done that way; seen this on teachers that lack pedagogical skills. You should have continue with your previous example, more to the point: with the original example; then, observe the potential improvements & implement them. You don't explain why those variables are there, you just describe the code, you explain Nothing. The rest of the explanation makes not much sense, you don't explain yNext and many other things' origins, your introverted explanation doesn't make sense, only for you; you should redo this video

  • @Skyliner_369
    @Skyliner_369 หลายเดือนก่อน

    I wonder if theres a version of this that is tweaked for the edge of triangles

  • @Necrozene
    @Necrozene หลายเดือนก่อน

    I think one can get a better result by assuming the line is actually a skinny rectangle, and calculate the percentage of the pixel covered.

  • @monkey7218
    @monkey7218 หลายเดือนก่อน

    Awesome explanation! One question: Is it a mistake at 11:58 that the - 2 * dx * y turns into a + 2 * dx * y and then back again in the following re-arrangement? Or what am I missing?

  • @RubenPalenqueArriola
    @RubenPalenqueArriola หลายเดือนก่อน

    This is an a great idea for can use the pixels Matrix with flotas values so assume that make an a sub Matrix that pixels for each pixel. This is an a great way to gain resolución on the radials corners of the circles 😊😊😊 Goog explanation of this kind of renderization tricks!!

  • @AK-vx4dy
    @AK-vx4dy หลายเดือนก่อน

    Antialiased explanation 😉 Nice and clean job at every angle. Excellent job.

  • @ArnaudMEURET
    @ArnaudMEURET หลายเดือนก่อน

    Final optimization that should be layered on all these algorithms: memoization.

  • @Paultimate7
    @Paultimate7 หลายเดือนก่อน

    This was overly complex for such a simple thing..

  • @Narigopia
    @Narigopia หลายเดือนก่อน

    Excellent, I wish I had this 55 years ago...

  • @gblenemy
    @gblenemy หลายเดือนก่อน

    I'm struggling with the end point of the line. if the end point is 0.1, 0.2, 0.3 or 0.4 above pixel, I get a gap at the end

  • @davidhu8768
    @davidhu8768 หลายเดือนก่อน

    This video explains the algorithm almost too well. It's hard to follow along. Explaining the goal and approach was most useful.

  • @gblenemy
    @gblenemy หลายเดือนก่อน

    I would actually love a video on thick lines. :)

  • @MegaArti2000
    @MegaArti2000 หลายเดือนก่อน

    I had this problem once I wanted to code generating a circle in minecraft. Thanks for the video!!

  • @marike113
    @marike113 หลายเดือนก่อน

    nick wu!!

  • @gblenemy
    @gblenemy หลายเดือนก่อน

    that was great. thank you!

  • @FrankHarwald
    @FrankHarwald หลายเดือนก่อน

    Note: it's possible to combine Bresenham's integer only multiply-free slope update computation with anti-aliasing à la Wu if you do basically do 2 parallel Bresenham iterations per step of the main loop, but while one is for the position of the pixel to draw & controlling the loop exit, the other one runs independently of the former one in the loop & is responsible for the opacity. Both of these Bresenham parts need to be initialized differently though. Note: & these Bresenham algorithms can be further generalized to draw arbitrary polynomial curves (including the AA) if you subdivide the polynomial into screen diagonal bound parts & add root-finding (of these diagonals to the shapes) prior the main loops while in the main loop you further differentiate the polynomial step update by using newton's method of iterative polynomial differences (from Newton's divided differences triangular scheme, except here we aren't dividing the differences because we want integer only solutions so we end up simply using two integers per resulting difference coefficient updating in lock step, which is what Bresenham is all about).

  • @nagesh007
    @nagesh007 หลายเดือนก่อน

    Awesome , Thanks 😍

  • @dunnydunn458
    @dunnydunn458 หลายเดือนก่อน

    This was pretty good video, but I felt that there were a few areas that would have benefited from a more in depth explanation. Nonetheless, good, job!