Coding Challenge #19: Superellipse

Поделиться
HTML-код
  • Опубликовано: 21 янв 2025

Комментарии • 105

  • @NStripleseven
    @NStripleseven 4 года назад +21

    6:40 "I could try to derive it, but I'm just going to look it up."
    The life of a coder

  • @RhoTrepaan
    @RhoTrepaan 5 лет назад +8

    "Superpowers of clumsiness"
    Add to that; superpowers of "putting the fun in explanations"
    and/or "superpowers in "gettings things done" :D

  • @arturkarlov3000
    @arturkarlov3000 8 лет назад +3

    awesome video, you have talent for taking complex concepts and translating them into simpler terms. I want to encourage you to go over the undelying math/maths because I think understanding that stuff can be useful. and you will do a good job with it. can't wait for the next superformula vids!

  • @TrebleWing
    @TrebleWing 2 года назад +1

    For the sgn function, it is a fun candidate for branchless implementations. (C syntax here)
    int sgn(int val) {
    return (val > 0) * 1 + (val < 0) * -1;
    }

  • @PeterKwanvt80
    @PeterKwanvt80 8 лет назад +2

    I first saw this at SIGGRAPH in 1986. It was called superquadric in those days. Some years later I taught it to a colleague who was struggling to model a cone blended onto a rounded rectangular prism. She went on to do special effects CGI in the Harry Potter movies.

  • @franksonjohnson
    @franksonjohnson 8 лет назад +2

    Fantastic tutorials! It appears to me that you get more comfortable with that really complex (and powerful) presentation setup with every video.

  • @chibibobo
    @chibibobo 8 лет назад +33

    1:14 That's almost a perfect circle..

  • @PMuis
    @PMuis 8 лет назад +16

    Man I would love to have you as a teacher irl

  • @SimonTiger
    @SimonTiger 5 лет назад +5

    12:44 and 13:02 the 2 formulas are actually just different form of the same thing.

  • @endofmysteries
    @endofmysteries 8 лет назад

    this is awesome Daniel!! so easy to follow along and code with you!

  • @kotoriitsuka1097
    @kotoriitsuka1097 8 лет назад +1

    seems to have new sub ;) your videos are amazing as well as your attitude and behavior :D keep it up and you'll have tons of subs :D

  • @Shockszzbyyous
    @Shockszzbyyous 8 лет назад

    that bit at 13:08 your pointing at, I understand that r1() takes a angle as argument , but R2() and cos() what is their argument? what is that symbol ?

  • @FunBy15
    @FunBy15 8 лет назад +11

    thanks² + thanks² dan!!

  • @liangdongzhu3082
    @liangdongzhu3082 7 лет назад

    这教程真是太酷了,谢谢你朋友,期待你的更多教程

  • @bsizzbs
    @bsizzbs 8 лет назад

    Awesome videos, Daniel! I'm having fun coding along. Would you consider doing maybe a more advanced series/video for those with a bit of Java experience already under their belts?

    • @TheCodingTrain
      @TheCodingTrain  8 лет назад

      sure thing! I might check out the nature of code videos which serve this purpose somewhat.

  • @goxr3plus_studio
    @goxr3plus_studio 8 лет назад

    Run it Daniel RUN IT!! 🌾 Show us the beautiness.

  • @yuvalgat4163
    @yuvalgat4163 8 лет назад +1

    Great video! :)
    The sgn(a) function can be shortened to (a / abs(a)), but doesn't work when a = 0 :)

  • @AnneONym
    @AnneONym 8 лет назад

    I love this channel. I discovered it yesterday. Is there any others channels in this style that I would be happy to go check ?

    • @TheCodingTrain
      @TheCodingTrain  8 лет назад +1

      check out coding math ruclips.net/user/codingmath

  • @kamoroso94
    @kamoroso94 8 лет назад

    I was getting excited to see you work out the math, but I forgot it's just a coding channel haha! Thank goodness for Wikipedia though.

    • @TheCodingTrain
      @TheCodingTrain  8 лет назад +2

      heh, I would like to do that in a video actually.

  • @amo6139
    @amo6139 7 лет назад

    you could have done the bresenham method with (1-|n|^n)^(1/n), because that is the formula for the height at x on an n unit superelipse

  • @mintyplays4682
    @mintyplays4682 8 лет назад

    This video taught me more Math than school ever will...

  • @JasimGamer
    @JasimGamer 4 года назад

    what if 4D super shape

  • @jonathank.1421
    @jonathank.1421 8 лет назад +6

    I never heard of the sgn function before... Why not use:
    f(x) = x / |x|
    instead? That would give the same result. examples:
    x=20
    f(x) = 20/|20| = 1
    x = -15
    f(x) = -15/|-15| = -15/15 = -1

    • @adlaneladjal3856
      @adlaneladjal3856 8 лет назад

      And if x = 0 ?

    • @jonathank.1421
      @jonathank.1421 8 лет назад

      Good point. What would the other function return in that case? 0?

    • @sadhlife
      @sadhlife 7 лет назад

      johnny Gamer it does. sgn (signum) returns zero for zero.
      that formula is true.

  • @nadkine6601
    @nadkine6601 3 года назад +12

    Who got here from Stand-up Maths? :-)

    • @BenjaminAster
      @BenjaminAster 3 года назад

      me!

    • @TheCodingTrain
      @TheCodingTrain  3 года назад +1

      welcome!

    • @BenjaminAster
      @BenjaminAster 3 года назад +1

      @@TheCodingTrain PS: instead of the "sgn" Function you made, you could just use the Math.sign function that is built-in in JavaScript and does exactly that.

  • @AKASHSOVIS
    @AKASHSOVIS 4 года назад +2

    if (val > 0) {
    return 1;
    } else if (val < 0) {
    return -1;
    } else {
    return 0;
    }
    // Instead of this, you can write...
    if (val == 0) {
    return 0;
    } else {
    return (val / abs(val));
    }

  • @kasturimamatha3663
    @kasturimamatha3663 4 года назад

    Hello
    Sir
    I am Abhi.
    I am just learning coding
    Sir. i dont have idea how you run the program in wedsite
    Can you plzzzz tell us how you make a wedsite and run it live

    • @sanderbos4243
      @sanderbos4243 3 года назад

      Look for "1.1: Introduction - p5.js Tutorial" on RUclips and you'll find his tutorial on how to do exactly that! :-)

  • @marcasrealaccount
    @marcasrealaccount 7 лет назад

    Guys make the minimum value on the slider negative, it looks so cool :D

  • @sahiljoshi2150
    @sahiljoshi2150 8 лет назад

    sgn is also called the signum function, right?

    • @sadhlife
      @sadhlife 7 лет назад

      sgn stands for signum, yes.

  • @JamesCubes-ne2iq
    @JamesCubes-ne2iq 8 лет назад

    i get it but it it doesn't work on processng

  • @AndersWOlsen-we3nw
    @AndersWOlsen-we3nw 8 лет назад

    Why don't you use switch cases rather than all these if-statements? Switch cases are much cleaner to read.

  • @yovliporat8608
    @yovliporat8608 8 лет назад +20

    For the sgn() function you could have just wrote:
    return val / abs(val);

    • @ZonkoKongo
      @ZonkoKongo 8 лет назад +9

      0/0 = 0?

    • @yovliporat8608
      @yovliporat8608 8 лет назад +1

      Add a try catch then? Still more compact than 3 if statements...
      Try{
      return val / abs(val);
      }catch(DivByZeroException e){
      return 0;
      }

    • @Nameci-wo1ht
      @Nameci-wo1ht 8 лет назад +4

      Or just add a case for val equals 0.

    • @yovliporat8608
      @yovliporat8608 8 лет назад +7

      Nameci2718 Yes, but that's a simple solution so I can't think of it :P

    • @louis1001
      @louis1001 8 лет назад +1

      Ternary operand?
      Don't know in javascript, but in pythln you could do:
      return val / (abs(val) if not val == 0 else 1)

  • @eotikurac
    @eotikurac 8 лет назад

    is there any graphics software that is perfectly precise? i mean, whenever you make a shape in adobe flash, illustrator or corel draw it only makes an approximation of it. it's usually good enough but not exactly as you intended.

    • @Dong_Harvey
      @Dong_Harvey 8 лет назад +1

      if the issue is the use of rasterization to render said shapes in the graphics software, then you should consider using a Vector graphics editor like Inkscape..
      at least then the graphics are saved as a series of mathematical inputs and not just a plot graph..

  • @jackthake7209
    @jackthake7209 8 лет назад

    What libraries r u using? - your videos are so cool

  • @zuggrr
    @zuggrr 7 лет назад

    great video

  • @lolerskates876
    @lolerskates876 5 лет назад

    Would be cool with space colonization

  • @TienPhan-rm1jy
    @TienPhan-rm1jy 8 лет назад

    Thank you Daniel, I enjoyed your video very very much. side question which mac configuration do you have? just curious :)

  • @grainfrizz
    @grainfrizz 7 лет назад

    Dan, your voice here is suuuuuuuper different from today.

  • @Mrfaytom
    @Mrfaytom 8 лет назад

    nice hair cut dan

  • @rashmysajin4520
    @rashmysajin4520 3 года назад

    Your the Bob Ross of Bob Ross

  • @andrewjardine8558
    @andrewjardine8558 5 лет назад

    My head exploded

  • @ryderpham5464
    @ryderpham5464 8 лет назад +1

    Can you please do tutorials for vanillaJS ?

    • @ricardo.mazeto
      @ricardo.mazeto 8 лет назад

      Check out the channel CodingMath.

    • @purpleice2343
      @purpleice2343 7 лет назад

      Almost (because I didn't finish watching/writing yet) everything he's ever done in p5.js and processing I've written in pure javascript and had no problems with it.
      Your problem is not knowing JavaScript, not not knowing how to solve those problems. Once you understand what he explained, you can do it in any language, assuming that you know one.

  • @pascalhesselink7515
    @pascalhesselink7515 8 лет назад +3

    Daniel, I'm really sorry for this bad news :(:(
    But the current project isnt in the project folder (challenges)
    rabascm.nl/LNSSU3 for photo :):) (#19)

  • @julianm4674
    @julianm4674 8 лет назад

    1 second missing

  • @charbelsarkis3567
    @charbelsarkis3567 7 лет назад

    return (value > 0)? 1 : (value < 0)? -1 : 0;

  • @glhf8756
    @glhf8756 8 лет назад

    7th

  • @darkdemon1338
    @darkdemon1338 7 лет назад

    make moomoo.io challenge

  • @jelletje8
    @jelletje8 8 лет назад

    MATH PLOX

  • @advaykumar9726
    @advaykumar9726 3 года назад

    First

  • @tobybrewin6240
    @tobybrewin6240 8 лет назад

    first

  • @erggish
    @erggish 7 лет назад

    It's so annoying hearing the circle being called a superellipse, although it's a special case... -_- dah....