Programming & Using Splines - Part#2

  Рет қаралды 23,755

javidx9

javidx9

Күн бұрын

Пікірлер: 47
@-andymel
@-andymel 3 жыл бұрын
I really can only join the praise. It's simply amazing how you manage to add so much info while still being that intelligible
4 жыл бұрын
Huge thanks for these two videos. I always find using graphs, diagrams etc to be crucial for me to understanding abstract things like this and you've certainly helped immensely in doing this - cheers. Really enjoy your videos, gives the old grey matter some needed exercise.
@bobdero9883
@bobdero9883 7 жыл бұрын
There it is, excellent video. I've been neglecting catmull-rom splines for a long time, even though I'm very familiar with bezier curves and parametric surfaces implementantions. I must say you've saved me a lot of effort with these two spline videos.
@javidx9
@javidx9 7 жыл бұрын
Glad I could help Kareshi. Cheers!
@pleshw
@pleshw 4 жыл бұрын
You are one of the best teachers i have ever had since i started college Thanks!
@RhoTrepaan
@RhoTrepaan 6 жыл бұрын
of all the times i tried diving into splines, this (series of two) made me "get" it. Thanks :D
@javidx9
@javidx9 6 жыл бұрын
Nice one Rho, Splines can be a bit difficult, but as soon as you realise just how simple they are, you never stop using them!
@CarstenMeyer
@CarstenMeyer 7 жыл бұрын
Very nice! I once implemented the length calculation with the same idea but my code was very ugly and unreadable. Your videos are awesome because your explanations are very clear and straight foreward. Timeless tutorial videos!
@javidx9
@javidx9 7 жыл бұрын
Hey Thanks Carsten!
@1st_ProCactus
@1st_ProCactus 7 жыл бұрын
Awesome, I have been looking for something like this for years, I will be using some of your code and concepts in your videos for my 'too big' project. Thanks for doing this, I hope your channel gets the magic youtube boost.
@javidx9
@javidx9 7 жыл бұрын
Thank ProCactus, as long as people find it useful, and you have, then I'm happy!
@GregoryTheGr8ster
@GregoryTheGr8ster 5 жыл бұрын
I love watching that wireframe space ship wind and wend its way around the spline path.
@Ruxify
@Ruxify 6 жыл бұрын
I implemented a spline class in my game engine and I noticed that it was very difficult to try and get true velocity independence when sampling from the spline using the normalized percentage value t. I think this is due to samples being more concentrated around the end points of each segment and thus the velocity would fluctuate a little between each point. To solve this, I created a function in my spline class that computes a t value from a distance along the spline in world units using a binary search to find the t that is closest to the desired distance along the spline. Then to move along the spline at an independent velocity, I declare a distance variable that is incremented each frame by a velocity value which I then use to sample from the spline data using the previously mentioned function to compute the transform of whatever is traversing the spline.
@javidx9
@javidx9 6 жыл бұрын
Hi Ruxify, that's quite an interesting approach. Does it handle the spline changing in real time too?
@Ruxify
@Ruxify 6 жыл бұрын
Yes! It calculates it based on the spline's state when you call the function... though since it uses a binary search function it may be more efficient to pre-compute a linear path from the spline whenever the spline changes rather than every frame.
@robotics_and_stuff
@robotics_and_stuff 5 жыл бұрын
Found the same problem and then saw your comment. You are right! There is non-linearity in "t" regarding to the distances, so the divide operation in "GetNormalisedOffset" which intended to result the fractional "t" will be inaccurate. Binary search is good idea!
@nightwintertooth9502
@nightwintertooth9502 2 жыл бұрын
I have to correct you. Although you can use linear rectification to estimate the length of a curve, you can do so while avoiding iteration with elliptic integrals. The lack of sustainable arc length for the ellipsis required the need for the elliptic integral. My research gathered quite a few matlab projects that solve for incomplete arclength in three different orders, or by using Jacobi / Jacobi Zeta in four different ways. Hunt around for moiseevigor's repository and find the computer answer to the arclength for nonclosed incomplete arcs like the hematite curve.
@GregoryTheGr8ster
@GregoryTheGr8ster 5 жыл бұрын
Also, you might want to use binary search to find the node & offset from a point on the spline's perimeter. Of course, this means that the nodes would have to store not only their length, but also their distance from 0.
@mikemontana7436
@mikemontana7436 5 жыл бұрын
I really enjoy your series. Thank you for this.
@javidx9
@javidx9 5 жыл бұрын
Hi and no problem Mike!
@kks2105
@kks2105 4 жыл бұрын
Thanks for the excellent tutorial. Are there any plans to make video on B-Spline and Bezier curve ?
@CykPykMyk
@CykPykMyk 7 жыл бұрын
man that was awesome, very simple and clear explanation and everything done in windows console! Do you plan to make any series in OpenGL / DirectX?
@javidx9
@javidx9 7 жыл бұрын
Hey thanks Xavery. I probably will look at DirectX next year. I've used both OpenGL and DX quite a bit, and would like to talk about them, the downside is they require a lot of preparation for the viewer in terms of understanding, so I don't know if they'll fit my format - perhaps a "project" series of videos would be required. So maybe!
@CykPykMyk
@CykPykMyk 7 жыл бұрын
great to hear that :D
@TimothyChapman
@TimothyChapman Жыл бұрын
Do a tutorial on how to implement NURBS curves.
@DavstrWrexham
@DavstrWrexham 7 жыл бұрын
Quick question: Do you think it would be feasible to differentiate the equations again to get the acceleration? The reason for this is so that if you were modelling an aircraft or spacecraft, say, you could get the model to bank over in the turns.
@javidx9
@javidx9 7 жыл бұрын
Hi Davstr, of course you can keep differentiating! Might be worth a try once I get 3D in the console finished.
@sanosanbaby
@sanosanbaby 2 жыл бұрын
you might need to make some lookup map for any t for this purpose as splines are calculated once.
@TheWeepingCorpse
@TheWeepingCorpse 7 жыл бұрын
i've not looked at my code for ages, but i seem to remember the kink is called an inflection point and they normally appear around t =0.25, t=0.5 and t=0.75.
@javidx9
@javidx9 7 жыл бұрын
Hi WeepingCorpse, I believe you are right.
@TheWeepingCorpse
@TheWeepingCorpse 7 жыл бұрын
javidx9 I've been binge watching your channel. I keep wanting to do something like it myself but haven't plucked up the courage to go on camera lol.
@TeenNewsLive
@TeenNewsLive 2 жыл бұрын
Did you mean to say Euclidean distance at 3:34?
@javidx9
@javidx9 2 жыл бұрын
No
@rogermichou8654
@rogermichou8654 5 жыл бұрын
how do you split a quadratic spline into 2 subsplines please ?
@gdk870
@gdk870 4 жыл бұрын
How would apply this to create a spline of rotations -i.e. quaternions? It would allow smoothly going from one rotation to the next, then the next, and so on.
@javidx9
@javidx9 4 жыл бұрын
The spline can exist in as many dimensions as you like, as its axis independent, so just interpolate your coefficients. Granted, with quats the output may need some tweaking to ensure continuity but it may just simply work.
@gdk870
@gdk870 4 жыл бұрын
@@javidx9 So I scaled then added each quaternion component (w, x, y, z) with the respective coefficient -as you did in the video. I may have misunderstood your written steps above, since there's no smoothness difference from just looping the rotations through a Slerp. This leads me to hope that maybe one day you'd make a video about it -one can hope (U_U)
@BrunoPiovan
@BrunoPiovan 6 жыл бұрын
amazing! thanks for that!
@javidx9
@javidx9 6 жыл бұрын
No problem Bruno, thanks!
@lupinedreamexpress
@lupinedreamexpress 6 жыл бұрын
I really love your 2D implimentations. They helped me learn a lot about interpolation, itself. I think they'd help a lot more if you did a Unity 3D implementation.
@javidx9
@javidx9 6 жыл бұрын
Thanks Lupine, You can easily extend this to 3D, 4D and onwards! :D, the maths is applied independent of the axis, so just add a z component in the same style as x and y.
@lupinedreamexpress
@lupinedreamexpress 6 жыл бұрын
Very nice! I love how extensible these equations are. Its fascinating.
@shoryu7891
@shoryu7891 2 жыл бұрын
@@javidx9 Great!! Thiss helpes me a lot!! Thank you so much!!~
@researchandbuild1751
@researchandbuild1751 5 жыл бұрын
Basically just increase the resolution of the spline for speed calculation. I wonder if this is kind of a nyquist thing. Or aliasing, essentially
@TheDyingFox
@TheDyingFox 4 жыл бұрын
Nice! Now fCurves makes more sense in Blender :D
@d.j.peters
@d.j.peters 6 жыл бұрын
From file OneLoneCoder_Splines2.cpp if t starts in the loop with 0 then newPoint=oldPoint so the t loop must start with fStepSize float CalculateSegmentLength(int node, bool bLooped = false) { float fLength = 0.0f; float fStepSize = 0.005; sPoint2D old_point, new_point; old_point = GetSplinePoint((float)node, bLooped); for (float t = fStepSize; t < 1.0f; t += fStepSize) { new_point = GetSplinePoint((float)node + t, bLooped); fLength += sqrtf((new_point.x - old_point.x)*(new_point.x - old_point.x) + (new_point.y - old_point.y)*(new_point.y - old_point.y)); old_point = new_point; } return fLength; } DJ
@javidx9
@javidx9 6 жыл бұрын
Thanks DJ, this is a minor, but completely valid optimisation!
[LIVE] 0x1FF Subscriber Special! Programming The Matrix
51:00
Programming & Using Splines - Part#1
23:56
javidx9
Рет қаралды 95 М.
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН
Line Of Sight or Shadow Casting in 2D
50:23
javidx9
Рет қаралды 144 М.
Programming Perlin-like Noise (C++)
27:54
javidx9
Рет қаралды 105 М.
2D Sprite Affine Transformations
27:59
javidx9
Рет қаралды 33 М.
Programming Pseudo 3D Planes aka MODE7 (C++)
27:16
javidx9
Рет қаралды 106 М.
olc::AllSorts - Text/Commands/Sounds/Jams
21:55
javidx9
Рет қаралды 32 М.
Path Planning - A* (A-Star)
31:18
javidx9
Рет қаралды 163 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 154 М.
The Continuity of Splines
1:13:50
Freya Holmér
Рет қаралды 1,4 МЛН