Coding Math: Episode 36 - Verlet Integration Part I

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2024

ความคิดเห็น • 57

  • @zealous_carrot8744
    @zealous_carrot8744 2 ปีที่แล้ว +5

    even after 6+years its the best explainations so far

  • @TheEricnorman
    @TheEricnorman 9 ปีที่แล้ว +40

    This is the most useful tutorials of math for programming I've ever seen. Nice!

  • @Edifier1221
    @Edifier1221 9 ปีที่แล้ว +12

    I cant belive you dont have more views, this is gold. Thanks for taking the time to make this vids!!

  • @thinkandmove479
    @thinkandmove479 ปีที่แล้ว

    That "Say may name!"-part spoke out of my heart. 🙂

    • @thinkandmove479
      @thinkandmove479 ปีที่แล้ว

      BTW: it's not "Runge-Kutta" with 'g' like in 'geography', but with 'g' like in 'go'. 🙂

  • @Mayur7Garg
    @Mayur7Garg 3 ปีที่แล้ว +3

    Came here after Sebastian Lague's latest video. Worth it!

  • @ULTRAsoulBRAWLER
    @ULTRAsoulBRAWLER 9 ปีที่แล้ว +14

    This is by far the only good explanation of Verlet integration I've found in the last 2 days. It's a shame only one part is out so far. :(

    • @KeithPeters
      @KeithPeters 9 ปีที่แล้ว +4

      I'm in the middle of working on Part II as I write this. Should finish it up by the end of the weekend.

    • @ULTRAsoulBRAWLER
      @ULTRAsoulBRAWLER 9 ปีที่แล้ว +1

      Keith Peters Looking forward to it. Sadly end of the weekend won't help me out for the assignment I'm trying to do but at least I'll finally understand this topic for the final exam.

    • @KeithPeters
      @KeithPeters 9 ปีที่แล้ว +1

      ULTRAsoulBRAWLER oh.... sorry, bad timing there.

    • @ULTRAsoulBRAWLER
      @ULTRAsoulBRAWLER 9 ปีที่แล้ว +2

      Keith Peters No need to be sorry. I'm grateful this video exists so I can use it as a basis of knowledge for the subject.

  • @monke2220
    @monke2220 ปีที่แล้ว +1

    truly a verlet integration moment

  • @lorenzorossi2000
    @lorenzorossi2000 7 ปีที่แล้ว +8

    When it's bouncing off the wall shouldn't you find the collision point and set the ball there? And then you should calculate the little other piece that it should've done instead of bouncing off. This seems simple but it's not precise

  • @lucaug10
    @lucaug10 9 ปีที่แล้ว +3

    Can't believe we're getting into numerical analysis, great video!

  • @bigpapsi
    @bigpapsi ปีที่แล้ว

    Very good explained. Will watch the other videos! Did you inow your old blog was one of the reasons i got into programming like … 16 years ago 😮

  • @AfterthoughtTV
    @AfterthoughtTV 8 ปีที่แล้ว

    Hey, Coding Math, I have a quick question. I am using an engine with the y values flipped. How would I flip them in the code? I've tried several ways and cannot get it to reverse. Thanks for the vid btw!

    • @jdskale
      @jdskale 8 ปีที่แล้ว

      +Setfenv I know this is obvious but have you tried using a -y instead of +y ?

    • @AfterthoughtTV
      @AfterthoughtTV 8 ปีที่แล้ว

      Yes, I fixed it a long time ago. It was a lot easier than I than I thought XD

  • @UXER260
    @UXER260 ปีที่แล้ว

    how do you get the ball to stop bouncing? because in theory its energy should become less every bounce but will never actually come to a true stop.

  • @LucienWalters
    @LucienWalters 8 ปีที่แล้ว +2

    When bouncing the points off the right-hand wall, you set p.x to the room width. This doesn't account for it bouncing back into the room within the same frame, and makes p.y inaccurate. Should it not be `p.x = width - (p.x - width)` or more concisely `p.x = 2 × width - p.x`?

    • @KeithPeters
      @KeithPeters 8 ปีที่แล้ว +1

      Yes, not optimized for accuracy. More for simplicity and speed. Feel free to improve on it.

    • @elenalenaiva
      @elenalenaiva 6 ปีที่แล้ว

      the correct formula is much more simple and consistent. you've claimed to teach people mathematics, after all :)

    • @elenalenaiva
      @elenalenaiva 6 ปีที่แล้ว

      holy crap, I was soooo wrong :) Doing it my way makes it all so much more complicated further on.... Sorry, you were right ^_^

  • @anuraghazra4772
    @anuraghazra4772 6 ปีที่แล้ว

    Is there any way to simplify the modeling and management.. Like creating a module for making rects,circles,triangles etc?

  • @someguy4592
    @someguy4592 6 ปีที่แล้ว +3

    Anyone tried doing spring cloth with euler integration ? the result is so hilarious, it just becomes a shaking ball and goes out of control

  • @samsibbens8164
    @samsibbens8164 8 ปีที่แล้ว +1

    I've been looking for this everywhere! Thank you!

  • @Polaroidon
    @Polaroidon 9 ปีที่แล้ว +2

    Super excited for the next part! Thanks!

  • @arttupakarinen7642
    @arttupakarinen7642 8 ปีที่แล้ว +1

    very nice did it in c++/SDL2 with this

  • @zealous_carrot8744
    @zealous_carrot8744 2 ปีที่แล้ว

    you are so underrated!

  • @saltysandwiches3554
    @saltysandwiches3554 9 ปีที่แล้ว +1

    I was trying to do something similar to the stick demo with the elastic physics, but I think that using the verlet integration will improve it a lot.

    • @KeithPeters
      @KeithPeters 9 ปีที่แล้ว

      Yeah, you can do it with elasticity, but verlet lets you dial in the rigidity.

    • @saltysandwiches3554
      @saltysandwiches3554 9 ปีที่แล้ว

      Oh, ok, that's useful

  • @khatharrmalkavian3306
    @khatharrmalkavian3306 3 ปีที่แล้ว

    Alternate bounce algo:
    if(x < 0) {
    oldx = -oldx;
    x = -x;
    }
    if(x > width) {
    var dw = width * 2; //this should be stored external to this function, but I put it here for simplicity
    oldx = dw - oldx;
    x = dw - x;
    }
    Explanation of the width * 2:
    The oldx will be n units from the edge, but you want to put it on the opposite side, so you calculate n as [width - oldx] and add that to width.
    width + (width - oldx)
    (width + width) - oldx
    (2 * width) - oldx
    The method in the video introduces latency (possibly simulating collision elasticity) when it sets the new x value to the edge instead of offsetting it.

  • @cheese3038
    @cheese3038 4 ปีที่แล้ว

    best vid ever it actually made me understand how this verlet integration works thanks man

  • @ArjunBkool
    @ArjunBkool 6 ปีที่แล้ว +1

    This is very useful, thank you. and very well explained.

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

    WHEN ARE YOU GOING TO ADD A VIDEO ON ANGULAR CONSTRAINT LIKE THE LEGS ON THE EXAMPLE AT THE START OF THIS ONE

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

    Great explanation ! Instant 👍 Like!!

  • @deepayanghosh7961
    @deepayanghosh7961 7 ปีที่แล้ว

    These videos are just awesome.
    Sir can you please make one on RK Method of integration??

  • @pelegsap
    @pelegsap ปีที่แล้ว

    2:23 doesn't really apply when you live in Germany (or Austria and Switzerland for that matter)🤷🏼‍♀️

  • @mathieug9860
    @mathieug9860 6 ปีที่แล้ว

    This works fine as long as your frame rate is constant. Doubling the frame rate will double the point velocity...

  • @AJ-et3vf
    @AJ-et3vf ปีที่แล้ว

    Awesome video! Thank you!

  • @NickGeo25
    @NickGeo25 4 ปีที่แล้ว

    Thanks for the video! Isn't the simulation framerate dependent though?

  • @Bestmann3n
    @Bestmann3n 4 ปีที่แล้ว

    thanks. brilliant video!

  • @DanWeatherman
    @DanWeatherman 9 ปีที่แล้ว

    Thanks for making these videos. Excellent brain candy!

  • @guitarvoicing
    @guitarvoicing 9 ปีที่แล้ว

    Very nice! Congrats!

  • @voidex2156
    @voidex2156 8 ปีที่แล้ว

    This is great. Thank you very much.

  • @ezequielleonzybert
    @ezequielleonzybert 2 ปีที่แล้ว

    th-cam.com/video/3HjO_RGIjCU/w-d-xo.html
    Wouldn't be necessary to move the particle to make it lie on the dashed line? I mean, he moved it just on the horizontal axis to get it in the canvas again, but the particle would collide some pixels below that position, where the dashed line intersect with the canvas border.

  • @ahmadkhalil94
    @ahmadkhalil94 8 ปีที่แล้ว

    You are my man!!

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

    The point seems to never actually stop, hmm

  • @natgazer
    @natgazer ปีที่แล้ว

    Cooool!!!

  • @luiseduardocastroanaya6880
    @luiseduardocastroanaya6880 4 ปีที่แล้ว

    Cool!!!

  • @hotdude549
    @hotdude549 4 ปีที่แล้ว

    nice

  • @simonmultiverse6349
    @simonmultiverse6349 3 ปีที่แล้ว +1

    Ha! You start off telling us how to pronounce "Euler", then at 3:47 you fail to pronounce "Runge-Kutta" properly!

    • @KeithPeters
      @KeithPeters 3 ปีที่แล้ว +2

      :) I choose my battles. can't win them all.

  • @landreeallen86
    @landreeallen86 8 ปีที่แล้ว

    7:45 Line 28 & 29:
    vx = p.x - p.oldx;