The Midpoint Circle Algorithm Explained Step by Step

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 163

  • @reyariass
    @reyariass 2 місяці тому +16

    At first I didn’t like you showing the steps to shorten the equation… but, I then realized it actually answered my usual question when viewing these equations which is “why are there hardcoded numbers?!”, this is great! Thank you!

  • @IvanToshkov
    @IvanToshkov 2 місяці тому +131

    You can simply your math computations by using this formula: A^2 - B^2 = (A - B)(A + B).
    Instead of removing the 0.25 we can instead multiply by 4 and compute q = 4 * p. We'll need to adjust the other two formulas as well, to compute the next value of q using the current one, but I don't think it's going to be very difficult.

    • @vibaj16
      @vibaj16 2 місяці тому +6

      you mean 0.25

    • @IvanToshkov
      @IvanToshkov 2 місяці тому +2

      @@vibaj16 Yes, my mistake.

    • @trinityy-7
      @trinityy-7 2 місяці тому +7

      honestly annoying watching someone not rearrange formulas to make them more computationally efficient

    • @aXe-km7pr
      @aXe-km7pr Місяць тому

      @@trinityy-7 this is computing not mental math

    • @trinityy-7
      @trinityy-7 Місяць тому +5

      ​@@aXe-km7pr its about minimising the number of execution cycles required, and at least for older CPUs, multiplication requires more execution cycles than addition, and division even more than that.

  • @SimplexonYt
    @SimplexonYt 2 місяці тому +8

    this is something intuitive that i was able to implement it in desmos in about two minutes

    • @zackbuildit88
      @zackbuildit88 18 днів тому

      Yo? Fellow Desmos coder? Post a video of it on your channel I wanna see

  • @syrupthesaiyanturtle
    @syrupthesaiyanturtle 2 місяці тому +191

    instead of truncating the float value, why not just multiply both sides of the equation and condition by a constant so it becomes an integer?

    • @akiel941
      @akiel941 2 місяці тому +50

      Really good idea ! And it would just need a multiplication by 4, which works nicely.

    • @MiguelEX3cutavel
      @MiguelEX3cutavel 2 місяці тому +37

      ​@@akiel941in this case two left shifts would do the job instead of multiplying
      Since multiplying by 2 is one left shifts, multiplying by four is just two left shifts which for the CPU is faster compared to multplication

    • @neovictorius
      @neovictorius 2 місяці тому +47

      @@MiguelEX3cutavel In languages such as C++ for example (and probably also all other programming languages, that compiles down to symbolic machine code), the compiler is actually allowed to do that exact conversion from a multiplication to a left shift. If the specific compiler does so or not is another matter entirely though

    • @vibaj16
      @vibaj16 2 місяці тому +22

      @@MiguelEX3cutavel Most CPUs can shift by more than 1 in one instruction, so it can just be a single left shift by 2. And as the person above mentioned, a multiplication by 4 would automatically get optimized to a left shift by any decent compiler.

    • @timnewsham1
      @timnewsham1 2 місяці тому +4

      @@vibaj16 true but on the cpus where every cycle counted and floating point math had to be avoided, like the 6502, you needed multiple shift instructions. the increased accuracy is probably not worth the extra cycles there. these days you'd just do the operations in the gpu and there are probably better algorithms to use to fit its capabilities.

  • @VideoNOLA
    @VideoNOLA 14 днів тому +1

    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!

  • @jacquev6
    @jacquev6 2 місяці тому +9

    Again a clear and concise explanation! Thank you for taking the time to make these videos and share them with us!

  • @noamrtd-g4f
    @noamrtd-g4f 2 місяці тому +6

    I saw a video of yours a few months ago and now this popped up,
    Your videos are amazing, not only for implementation but also for general understanding of those commonly used formulas.

  • @ConsciousHoney2113
    @ConsciousHoney2113 2 місяці тому +12

    As a CS student, I really enjoyed this video. Well done!

  • @ai_outline
    @ai_outline 2 місяці тому +9

    This channel is going to explode!! Please keep up with the Computer Science content ❤️

  • @kbsanders
    @kbsanders 2 місяці тому +3

    These videos are great. They remind me of videos created by the Coding Math channel here on UA-cam.

  • @czajla
    @czajla 2 місяці тому +3

    years ago I have implemented this algorithm on ZX Spectrum in Z80 assembly, using only integers and with no multiplications. Boy, that was fast

  • @gigelgigica
    @gigelgigica 20 днів тому

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

  • @graydhd8688
    @graydhd8688 Місяць тому +1

    Great vid, i used this for a circle drawing function on the Gameboy advance but this helped me better understand how it actually works!

  • @GCKteamKrispy
    @GCKteamKrispy 2 місяці тому

    Whoever made this algorithm is a genius for me

  • @MegaArti2000
    @MegaArti2000 Місяць тому

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

  • @FooneTuring
    @FooneTuring 2 місяці тому +2

    I interviewed at IMVU back in... God, 2010? And the tech part of the interview was just "derive this algorithm". It was a lot of fun, but this video really would have helped!

    • @_nuage_
      @_nuage_ День тому

      Uh I follow you on mastodon, I didn't expect to see you there but I'm not surprised either. Anyway, hi !

  • @VideosViraisVirais-dc7nx
    @VideosViraisVirais-dc7nx Місяць тому

    A very good video for intermediate leaners

  • @aidennwitz
    @aidennwitz 2 місяці тому

    this is great, thank you! a thick line modification of this or line algorithm would be great too

    • @AdamDavisEE
      @AdamDavisEE 2 місяці тому +2

      The simple thick line algorithm would take two of these as the outer and inner edges, and then fill between on each row. I'm sure there are optimizations, but that will get you to a quick solution you can use now. So if you wanted a circle with radius 100 and a line thickness of 9, then you'd have two circles with radius 104 and 96. Fill the center just like you'd fill the center of a single circle, just make the beginning point the inside circle (or midline if the inside circle's minimum y value is greater than then y value of the starting point).

  • @niceshotapps1233
    @niceshotapps1233 2 місяці тому +2

    You can get rid of multiplication in the loop by observing that differences between subsequent squares are odd numbers. For example 0+1+3+5+7+9+11+13 = 49
    Then you can just keep the amount you need to increase x and y in separate variables that increment by 2 after you add them to p.

    • @dascandy
      @dascandy 2 місяці тому

      You can also leave that job to the compiler and write more readable code.

    • @jimwinchester339
      @jimwinchester339 2 місяці тому +1

      @@dascandy You don't get to decide how smart your compiler is. Most code at this level is written in assembler anyway, in which case there is no 'p' variable at all: it's just a test of the carry flag.

  • @tomasbernardo5972
    @tomasbernardo5972 2 місяці тому +15

    YES!
    (I suggested this in the previous video, I'm now happy)
    (I'm not saying that NoBS Code made that just because I asked, it's kinda the next level of complexity and amazingness, algorithmwise)

    • @nobs_code
      @nobs_code  2 місяці тому +7

      Haha, I did see that! Although I did plan on making this one next, but it's always nice to know what people want to see.

    • @pandaszan9310
      @pandaszan9310 2 місяці тому

      ​@@nobs_code This was so wholesome I'm gonna subscribe 😂😂😂

    • @James2210
      @James2210 Місяць тому

      I suggested it too, although for some reason I thought it was called the bresenham circle-drawing algorithm

  • @fremsoft
    @fremsoft 20 днів тому

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

  • @JackBond1234
    @JackBond1234 Місяць тому

    I came up with a similar algorithm for drawing pixelated circles by hand. Starting at x=0 and y=-r, increment x and calculate the offset y given the known x offset and radius plugged into the Pythagorean theorem. Once you reach x=r/2, you can mirror the result 7 more times.

  • @nand3kudasai
    @nand3kudasai 2 місяці тому

    9:17 thanks so much for explaining step by step. That way i can learn deeply. Also very interesting.

  • @ktbbb5
    @ktbbb5 2 місяці тому +18

    It would be great if you showed the difference between including or excluding the 0.25. Also, can't we multiply everything by four to get rid of the imprecision?

    • @nobs_code
      @nobs_code  2 місяці тому +8

      Yup we could multiply by 4. But if I'm not mistaken that would also require extra multiplications by 4 when we increase the p value inside the loop. My guess is most implementation don't do that because it would introduce more operations, while truncating 0.25 works fine.
      And definitely agree I should have shown the difference the approximation makes. That would have been a nice extra animation. 👍

    • @Starwort
      @Starwort 2 місяці тому +11

      ​@@nobs_codeyou're already multiplying by 2, multiplying by 8 (or shifting by 3) instead isn't an extra operation, and the constants can be baked to be 4x what they were previously

    • @nobs_code
      @nobs_code  2 місяці тому +11

      I did not realize that. Simply multiplying everything by 4 does seem like a great solution then. Any idea why that isn't usually done in the implementations I've seen?

    • @lbgstzockt8493
      @lbgstzockt8493 2 місяці тому +2

      @@nobs_code Did you look at any high-performance production implementations? I would bet they do such and much more advanced tricks. Maybe look into the Linux kernel, they probably have a hyper-optimized circle-drawing routine.

    • @besusbb
      @besusbb 2 місяці тому +2

      @@nobs_code not sure about specifically midpoint circle implementations, but this whole "shifting by some bits so you could work with integers" thing is called fixed point numbers. it used to be popular, made it ways into c libraries and theres games like doom that used fixed point for almost everything involving coordinates

  • @arunoruto
    @arunoruto 2 дні тому

    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.

  • @Pengochan
    @Pengochan 2 місяці тому +7

    So you approximated p by subtracting 0.25, and you check p>0, when the "exact" check would be p+0.25>0.
    But since p is integer: p+0.25>0 p>=0.

    • @supremedevice1311
      @supremedevice1311 2 місяці тому

      i think the problem is that the error accumulates on each iteration

    • @Pengochan
      @Pengochan 2 місяці тому

      @@supremedevice1311 No, the approximation happens only once for the initial value, and it always neglects 0.25. All differences are integer. The reason is, that you calculate the square of some midpoint in y direction plus the square of an integer in x direction: n²+(m+.5)² = n²+m²+m+.25

  • @doublepinger
    @doublepinger 2 місяці тому +3

    Very early in my programming experience we did this to draw Pacman, in C, for a programming class (Landtiger LPC1768). I spent a LOT of time tweaking it to draw correctly... and I don't remember one bit of it, but I wanted to watch anyways. It feels silly now, but getting something to work, refactoring, getting it to work again, refactoring... so... numbing. In the good way.

  • @Hycord
    @Hycord 2 місяці тому +1

    If this wasn't made by someone who writes C++ and OpenGL I would be shocked, the 0, 0 being the top left corner then centering the circle on it brought back weird like half memories

  • @jimwinchester339
    @jimwinchester339 2 місяці тому

    With a few modifications, you can also draw ellipses using the same general approach.
    It's important to mention, because in many cases the aspect ratio of the pixels is not 1:1, so your "circle" is actually drawn as an ellipse anyway.

  • @kanashisa0
    @kanashisa0 2 місяці тому +13

    8:15 if r is also integer, we can just change the condition from p>0 to p>=0 to get the exact same result.

  • @mxdevil
    @mxdevil Місяць тому

    There is no way I had to solve this in an interview a few days ago and then I get this recommended…

  • @torrentails
    @torrentails 2 місяці тому

    Cringing hard at the camelCase in Python code 😖😛
    Awesome vid though, always love seeing more CS content!

  • @hagalloch
    @hagalloch 2 місяці тому +8

    You missed the opportunity to make it branchless, by computing the y increment dy as p>0 and then just y += dy and p+= 2x + dy*2y+1. Because dy is either 0 or 1 the multiplication should be very fast

    • @vibaj16
      @vibaj16 2 місяці тому

      p>0 is a branch tho..

    • @hagalloch
      @hagalloch 2 місяці тому +2

      @@vibaj16 it's not, it's an expression that evaluates to either 1 or 0.
      In the code provided by the video the processor needs to guess which branch is executed (the "if p>0: ..." and the "else: ...") and if the processor's prediction is wrong this code becomes slow, especially in GPU processors.
      Branchless means no guessing (in better terms no conditional jumping instructions). This can be done by promoting p>0 to a number so the code in a branchless version becomes
      dy = (int)(p>0)
      y += dy
      p += 2x + dy*2y + 1
      because there aren't any if-else statements the code just runs faster (counting cumulative time for all pixels) and the output is still the same.

    • @vibaj16
      @vibaj16 2 місяці тому

      @@hagalloch "(int)(p>0)" is not gauranteed to be branchless. In fact, on some processors it's impossible without branching.

    • @hagalloch
      @hagalloch 2 місяці тому

      @@vibaj16 afaik CMP, MOV(from flags to gpr) and AND are the most basic way to implement it and they are support in any processor, even old ones. You can be fancier with SETcc which is still widely supported as per x86 since 80386. I can't see how a comparison alone must be branched.

    • @vibaj16
      @vibaj16 2 місяці тому

      @@hagalloch they are not supported in every processor

  • @EaglePicking
    @EaglePicking 2 місяці тому +2

    Back in the nineties, on Turbo Pascal, I used to draw my own circles, but I always used a precalculated lookup table with sin and cos values and then a simple:
    for d := 0 to 359 do drawpixel( x+coslookup[d]*r, y+sinlookup[d]*r );

    • @MrMoon-hy6pn
      @MrMoon-hy6pn 26 днів тому

      Wouldn’t that skip pixels if the circle had more than 360 pixels e.g a greater than ~64 radius? Also seems inefficient for smaller circles since you’d be overwriting the same pixels multiple times. If it worked fine for the application though then fair enough I guess.

    • @EaglePicking
      @EaglePicking 26 днів тому

      @@MrMoon-hy6pn I never said it was good coding. I was 14 or so at the time.

    • @MrMoon-hy6pn
      @MrMoon-hy6pn 26 днів тому

      @@EaglePicking I had a feeling so. Apologies if I sounded harsh. I just thought it was interesting to find the weaknesses of the approach.

    • @EaglePicking
      @EaglePicking 26 днів тому

      @@MrMoon-hy6pn Sure it was kinda weak. I just wanted to point out that by using lookup tables, sin and cos could be used even when such calculations were too expensive.

  • @Wololo123abc
    @Wololo123abc 2 місяці тому +3

    Good video!!!

  • @ax13h
    @ax13h Місяць тому

    9:00 The first decision is about which of the two pixels at X=1 to choose from. Yours makes this choice by testing the mid-point at X=0. You step correctly each time but the initial value error causes some wrong decisions, changing the look of the circle.

  • @BartomiejGawron
    @BartomiejGawron 24 дні тому

    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

  • @xmoex6393
    @xmoex6393 Місяць тому

    If you use p = -4 * r +1 and increment it by either 8 * (x + y) + 4 or 8 * x + 4 you get the exact result as in the not-optimized version without paying any extra costs...

  • @jozsiolah1435
    @jozsiolah1435 2 місяці тому

    Optical instructions exist for monitors and tv. For example, Sonic Master System gameplay last level instructs the computer to speed up the fan, to prevent overheating. Just by watching the video, the level turns on the S5 power mode, when watching videos, the phone will be cold, and was hot before.

  • @mathmachine4266
    @mathmachine4266 2 місяці тому

    8:25 or you could change the > into >=, removing that slight difference. This is what I thought you were gonna do all along. Since yMid is always a half integer, and x is always an integer, the sum of their squares is always 1/4 greater than an integer. So if k+1/4>r², and both k and r² are integers, that's the same as saying k>=r².

  • @AEF23C20
    @AEF23C20 2 місяці тому +1

    тут нужен полный __целочисленный__ алгоритм
    п.с.: как стартовое объяснение - очень хорошо, но нужно продолжение в __целочисленный__ алгоритм

  • @sashimanu
    @sashimanu 2 місяці тому +1

    Will you do antialiased drawing next?

  • @danser_theplayer01
    @danser_theplayer01 2 місяці тому +2

    Interesting, what if I want to draw a square-outwards-clockwise-single-line spiral on a grid of tiles, starting from a 1x1 point (1 tile)? I recently had to think about it hard, and several of my days have been filled with math.
    Oh and one of the reasons why it was hard is because I want it centered in the grid, ealisy divisible into 4 quadrants so I had to use a cartesian plane and start my spiral at 0,0.
    It's not on a base grid like your circle is, so I can't add to y to go down, sometimes I have to add and sometimes I have to subtract, and I need to know when, so that my spiral doesn't turn into a flat line or a thin rectangle or have a weird off shoot into some direction.
    And there is literally no midpoint possible, my "tiles" act as squares but I can't calculate fractions of them, a coordinate 3,5.14689 will default to 3,6. But that is irrelevant in for the shape I'm asking about.
    I already went through all this and made the algorithm, and I'm just asking for your version that would make the spiral I asked about.
    Currently I can already make any number of squares follow the spiral shape.
    I can access any one of them in constant time using coordinates;
    But I also can access any one of them in constant time, based on the order of insertion, independent of the size of the spiral, and without creating extra references to associate the index of the square (it's order of insertion) with it's coordinates.
    So.. yeah, a little head scratcher for you.

  • @art-creator
    @art-creator 2 місяці тому

    It can easily be generalized to line for zero-level set coverage finding

  • @강현규-g3g
    @강현규-g3g Місяць тому

    its very cool and easy

  • @raidensama1511
    @raidensama1511 Місяць тому

    Now do an algorithm for making a dome on a 3D grid system.

  • @andreasherz4605
    @andreasherz4605 Місяць тому

    I love it!!!!

  • @bleakaddict
    @bleakaddict 2 місяці тому

    Can you do a video on how to draw a horizontal line by filling 0xFF in the middles and use bitshifts for 2 ends

  • @KonstantinKuzvesov-s2h
    @KonstantinKuzvesov-s2h 8 днів тому

    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.

  • @VideosViraisVirais-dc7nx
    @VideosViraisVirais-dc7nx Місяць тому

    Indeed

  • @ВладимирОгородников-и1ы

    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".

  • @mono9613
    @mono9613 2 місяці тому +2

    Is there some way to donate to you? Content of this quality can't stay unpayed

  • @igorlukyanov7434
    @igorlukyanov7434 2 місяці тому +2

    Is the optimization really necessary? You've basically replaced 3 multiplications with 1, and you still have 8 function calls to putPixel. Since calling functions is a much "heavier" operation than multiplication, I wonder if it even matters.
    Nonetheless, the idea behind the optimization is great, and I have no problems with it. Just wondering if it makes a difference.

    • @nobs_code
      @nobs_code  2 місяці тому +4

      The use of the putPixel() function is basically just an abstraction. In real code you would of course not want a function call for placing every single pixel, but directly access the pixels in memory instead. Otherwise, as you said, that would be super inefficient.

    • @IsmeGenius
      @IsmeGenius 2 місяці тому +1

      The only way to know if it makes the difference is to measure. Naturally, results may differ on different hardware and, potentially, with different inputs.

    • @igorlukyanov7434
      @igorlukyanov7434 2 місяці тому

      @@IsmeGenius In this case that is the only way.

  • @soran2290
    @soran2290 Місяць тому +1

    And with elipses?

    • @buysnoah
      @buysnoah Місяць тому

      Circle algorithm not ellipse

  • @eliasmisaelramirez9624
    @eliasmisaelramirez9624 Місяць тому +1

    I fuck up my mind 3 fukings day programing this, and find this is a relieve, because i belive I did everything wrong, but NOPE THX GOD

  • @ytstolemyname
    @ytstolemyname 2 місяці тому

    Very useful for Minecraft

  • @rkalle66
    @rkalle66 26 днів тому

    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?

  • @rewixx69420
    @rewixx69420 2 місяці тому +1

    nice

  • @atreidesson
    @atreidesson Місяць тому

    You didn't point out that the y is negative all the time in the "changing p" piece. Because increasing p by 2(x+y)+1 looks as if it's always increasing but it's not and that's the point, moreover, -y is always bigger than x by at least 1 so p's actually always decreased in that step.

  • @benholroyd5221
    @benholroyd5221 21 день тому

    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

  • @Yashss4617
    @Yashss4617 2 місяці тому

    Can you please continue this with the ellipse drawing algorithm

  • @郭哲銘-o3x
    @郭哲銘-o3x Місяць тому

    What tool you use to do this nice pixel animation?

  • @astropgn
    @astropgn День тому

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

  • @rahuls7039
    @rahuls7039 Місяць тому

    Awesome video!

  • @vinceguemat3751
    @vinceguemat3751 2 місяці тому

    what is the adventage of this algorithme compare to Marching squares ?

  • @TheBitenix
    @TheBitenix Місяць тому

    8:09 If we are checking if '-r + 0.25 > 0' then is there a way to check if ''-100 * r > -25' ?

  • @milos_radovanovic
    @milos_radovanovic 2 місяці тому +1

    Why not simply use 4p instead?

  • @jogloran
    @jogloran 2 місяці тому

    I love this series of videos for raster algorithms. Due to the time at which they were developed, most of the explanations are terse and uninformative. This is the complete opposite!

  • @mspeir
    @mspeir 2 місяці тому +1

    Now do ellipses.

  • @mshonle
    @mshonle 2 місяці тому +8

    Gen Z says this algorithm is very mid.

  • @zhabiboss
    @zhabiboss Місяць тому

    I like the video but it’s kinda strange when you choose to through all those steps with showing the binomials and taking 10 seconds just to get from 2x + 1 + y + y to 2(x + y) + 1 and then not explain the filling of the circle to the audience.

  • @sukursukur3617
    @sukursukur3617 Місяць тому

    Why did you build that circle?

  • @tHEuKER
    @tHEuKER Місяць тому

    Why not multiply every term by 4 to get p = 1 - 4r? Multiplication by 4 is quite cheap.

  • @prog_5952
    @prog_5952 Місяць тому

    There's actually a lot more convenient way for drawing a circle. Saving the coordinates of the midpoint in an array of 2 dimensions and by using cos(theta) and sin(theta) from mathematics you can draw short lines from pixel to pixel say from {centerpoint[0] + cos(theta), centerpoint[1] + sin(theta)} to {centerpoint[0] + cos(theta+1), centerpoint[1] + sin(theta+1)} theta ranging from 0 to 359 degrees.

    • @misterkite
      @misterkite Місяць тому +1

      This algorithm ends up using a bitshift and some addition.. replacing that with sin and cos isn't "more convenient".

  • @SlothHuntOnYou
    @SlothHuntOnYou 2 місяці тому

    how add "stroke" to that?=)

  • @demonkingswarn
    @demonkingswarn Місяць тому

    he explained better than my computer graphics professor xD

  • @shalevforfor5550
    @shalevforfor5550 8 днів тому

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

    • @shalevforfor5550
      @shalevforfor5550 8 днів тому

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

  • @SAhellenLily
    @SAhellenLily Місяць тому

    Python program for wafer Cp test equipment

  • @ArnaudMEURET
    @ArnaudMEURET Місяць тому

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

  • @nvs-different-ideas
    @nvs-different-ideas 2 місяці тому

    I dont see where is use p to draw

  • @Wololo123abc
    @Wololo123abc 2 місяці тому +1

    GG. 69 views!!!

  • @Yueyelongbob
    @Yueyelongbob 2 місяці тому

    u can just solve y++, not x++, it is just 3 step.

  • @MiccaPhone
    @MiccaPhone 20 днів тому

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

  • @Paultimate7
    @Paultimate7 Місяць тому

    This was overly complex for such a simple thing..

  • @VideosViraisVirais-dc7nx
    @VideosViraisVirais-dc7nx Місяць тому

    Learners* damnit

  • @dmaraptor
    @dmaraptor Місяць тому

    You will never draw circle efficiently using these calculations, they are too complex.
    All this can be calculated using integer arithmetics.

  • @xPlay5r
    @xPlay5r 2 місяці тому +22

    This guy talks about optimization in python XD

    • @nobs_code
      @nobs_code  2 місяці тому +8

      Obviously python is only used for pseudocode here. 😋

    • @xPlay5r
      @xPlay5r 2 місяці тому +2

      @@nobs_code Python is like scratch. He is perfect for simple tasks, not a low-programming.

    • @Omena0
      @Omena0 2 місяці тому +2

      Python can be used for quite a lot. Not just "simple scripts." Optimization is important.

    • @xPlay5r
      @xPlay5r 2 місяці тому +3

      @@Omena0 You are right in some way. The most of people does their project in python. Python is slow programming language... But yeah, python have a bunch of different libraries in it.

    • @Omena0
      @Omena0 2 місяці тому

      @@xPlay5r Instagram's back-end is Python. Python is only slow if you A. Use normal CPython, and B. Have an inefficient implementation of whatever you're doing.

  • @alexchan4226
    @alexchan4226 Місяць тому

    The midpoint circle algorithm is used for processing.

  • @amalkurvat
    @amalkurvat 2 місяці тому

    Since python has many version. It's a WARNING/ CRITICAL to do graphical computer science or low programming in python.

  • @Ruhgtfo
    @Ruhgtfo Місяць тому

    😂 computers doesn't have circle 🤣 My whole life must be a lie