Behold all-new equations for triangles!

  Рет қаралды 443,243

Stand-up Maths

Stand-up Maths

Күн бұрын

Пікірлер: 843
@dougalstanton
@dougalstanton Жыл бұрын
I can't believe you didn't call the missing vertices "plot holes".
@HasekuraIsuna
@HasekuraIsuna Жыл бұрын
... *nice*
@littlered6340
@littlered6340 Жыл бұрын
MASSIVELY underrated comment. Not even 69 smh Edit: I see it now has over 69 likes but it is still not enough.
@MrShiggitty
@MrShiggitty Жыл бұрын
Someone gonna steal this idea for a T-Shirt, its so good lol. Bruh hurry up and secure the movie rights xD
@poppyseedsnuranium
@poppyseedsnuranium Жыл бұрын
@@HasekuraIsuna ... Nice
@Son_Of_Atreides
@Son_Of_Atreides Жыл бұрын
Would that make the stick man walking a plot twist?
@ThisSteveGuy
@ThisSteveGuy Жыл бұрын
Why not "Tri Harder"?
@Luna-wu4rf
@Luna-wu4rf Жыл бұрын
GENIUS
@sycration
@sycration Жыл бұрын
TriHard 7
@cs8712
@cs8712 Жыл бұрын
Do or do not - there is no triangle
@jimmygarza8896
@jimmygarza8896 Жыл бұрын
Triangle 3: the Threequel: Tri Harder.
@user-dx5wm1uz9d
@user-dx5wm1uz9d Жыл бұрын
​@@sycration Cx
@rev1601
@rev1601 Жыл бұрын
10:00 To get rid of the "annoying dot" at the origin, just multiply the entire equation by (|x|+|y|)/(|x|+|y|). This factor is 1 everywhere except for the origin where the denominator is 0 and therefore the equation becomes undefined.
@kyay10
@kyay10 Жыл бұрын
You could also multiply it by 0^((0^(x^2)) * (0^(y^2))) which basically (ab)uses the convention that 0^0=1 as a logical not gate, and so it's only 1 (true) when not(not(x^2) and not(y^2)) which means not((x^2 = 0) and (y^2 = 0)) and so it's only true when not on the origin
@hughobyrne2588
@hughobyrne2588 Жыл бұрын
But some triangles have edges that legitimately go through the origin. *EDIT:* Never mind, I was ignoring some context of that particular part of the video, as others have pointed out below.
@kyay10
@kyay10 Жыл бұрын
@@hughobyrne2588 oh true. Hmmmm, maybe what you can do is use a complicated logical-or kind of equation by basically checking if any of the edges actually include the origin, and if so then calculate the distance from the centre of the triangle, borrowing from another equation from the video
@rev1601
@rev1601 Жыл бұрын
@@kyay10 Not exactly. Your solution is elegant for sure, but doesn't quite do the trick. The goal is to get rid of the 0 at the origin, so multiplying by another 0 doesn't really help. :D However, you could still use your approach by adding (1-0^((0^(x^2)) * (0^(y^2)))) to the equation. It adds 0 everywhere, excapt at the origin it adds 1.
@skyjoe55
@skyjoe55 Жыл бұрын
​@@hughobyrne2588 That is true in general but not in the specific graph in question
@NoahStolee
@NoahStolee Жыл бұрын
“‘Every triangle’s a love triangle when you love triangles’ - Pythagoras” -James Acaster
@NeatNit
@NeatNit Жыл бұрын
Oh wow, that's so James Acaster. Can you say where this joke is from?
@JordanBiserkov
@JordanBiserkov Жыл бұрын
"Every love triangle has at least one obtuse angle" (obtuse ~ stupid)
@vincentfreddoyle7555
@vincentfreddoyle7555 Жыл бұрын
@@JordanBiserkovmeaning none of them are right (As in morally)
@JordanBiserkov
@JordanBiserkov Жыл бұрын
@@vincentfreddoyle7555 It doesn't follow from the axioms. Morality is complicated. You can't control who you fall in love with. You can (and should) control your actions. But you also can (and should) fight for your love ones. And in love (as in war) everything is allowed. Nobody will be judging the winners. Rant over, back to geometry.
@vincentfreddoyle7555
@vincentfreddoyle7555 Жыл бұрын
@@JordanBiserkov yes,polygons angles surface area
@tuna5618
@tuna5618 Жыл бұрын
What a relief, I was lying awake at night wondering when new equations for triangles would come and this is just what I need. Finally, something useful on the internet for once.
@DhirC35
@DhirC35 Жыл бұрын
😂
@oosmanbeekawoo
@oosmanbeekawoo Жыл бұрын
I really like the art on your channel
@simonmultiverse6349
@simonmultiverse6349 Жыл бұрын
I really like the chart on your anal.
@joshyoung1440
@joshyoung1440 Жыл бұрын
I mean your joke kind of defeats itself a tad at the end when you point out that the internet is known to be full of much, MUCH more information much more useless than this, so it begs the question why the joke would apply to this video in particular
@oleg-avdeev
@oleg-avdeev Жыл бұрын
Of course it’s Inigo Quilez! You can expect the guy to pop up every time something resembling signed distance fields happens. An absolute legend.
@jonathansharret4900
@jonathansharret4900 Жыл бұрын
His videos are amazing.
@fernanda_plays
@fernanda_plays Жыл бұрын
An absolute God
@chromosundrift
@chromosundrift Жыл бұрын
Yeah and he not only has equations for a triangle but also for spectacular animated 3d characters with lighting and shadows and scenery!
@Janokins
@Janokins Жыл бұрын
It's good to see Inigo getting recognition. He's the shader programming GOAT
@johnsarthole
@johnsarthole Жыл бұрын
I was going to say that
@NoNameAtAll2
@NoNameAtAll2 Жыл бұрын
his name is Inigo Mantoya you killed his father prepare to die
@lillilacac
@lillilacac Жыл бұрын
Inigo has worked on many Pixar films as well (Brave, The Good Dinosaur, Lava)
@aceman0000099
@aceman0000099 Жыл бұрын
In 2050 they will teach about Inigo Q in the "history of computing" lessons
@PureAsbestos
@PureAsbestos Жыл бұрын
I believe I had commented about Inigo's SDF on the original video. He is indeed a shader god and deserves all the recognition.
@JoshZanders
@JoshZanders Жыл бұрын
That walking-stickman plot was BONKERS. 🤣 I never would've thought to create an equation that animates a figure with a single dynamic value.
@aceman0000099
@aceman0000099 Жыл бұрын
Wait until you hear about Pixar. And a little variable called T for time 😂
@marsovac
@marsovac Жыл бұрын
@@aceman0000099 rest assured pixar is not using equations with one variable to render their movies. A game or rendering engine has the game time parameter but that is also not used to run equations, but rather to define the velocity of transformations applied to 3D meshes to render each frame. Each frame per se has no T as input, it just has static vertex positions which get in memory modified every T time.
@aceman0000099
@aceman0000099 Жыл бұрын
@@marsovac they get modified in memory according to the curved paths of interpolation, which is an equation that takes position A and Position B and gives you a position in between based on T. Whether it's flash animation or 3D motion capture, there is undoubtedly interpolation and splines involved. I've made animations before.
@simonmultiverse6349
@simonmultiverse6349 Жыл бұрын
Personally, I would start with something smooth... some kind of series... I know EXACTLY what I mean, but you'll appreciate it better if you work it out for yourself. *FURTHERMORE* ... there's a finesse which makes it even better.
@simonmultiverse6349
@simonmultiverse6349 Жыл бұрын
*MATT* ... it's not "arbitary" ...the word is arbit *R* ary !!!
@asheep7797
@asheep7797 Жыл бұрын
The triangular sequel! We want a triangular trilogy!
@dahawk8574
@dahawk8574 Жыл бұрын
*Triangle with a Vengeance*
@kaivalya931
@kaivalya931 Жыл бұрын
Triangle prequel: line revolution
@kaivalya931
@kaivalya931 Жыл бұрын
Triangle: the quadrilateral dynasty
@jplays8934
@jplays8934 Жыл бұрын
yes!
@philipdmiller
@philipdmiller Жыл бұрын
Triangle² or Triangle³
@wallyhall
@wallyhall Жыл бұрын
"It was like a triangle that was in a hurry" - absolutely killed me. Coffee spat out everywhere. Thanks Matt.
@jpdemer5
@jpdemer5 Жыл бұрын
A Parker triangle, innit?
@ieatdirtwasntavailable
@ieatdirtwasntavailable 9 ай бұрын
They dont call him "stand up maths" for no reason.
@himynameisdavenicetomeetyou
@himynameisdavenicetomeetyou Жыл бұрын
Inigo, if you're reading this, I miss your paint by maths videos they were spectacular. Thanks for the content and for shadertoy :)
@beskamir5977
@beskamir5977 Жыл бұрын
Agreed. Inigo is an absolute genius especially with how he breaks everything down in his explanation videos.
@himynameisdavenicetomeetyou
@himynameisdavenicetomeetyou Жыл бұрын
@Beskamir it's the fact that everything is essentially explained from first principles that does it for me. That and the results are visually spectacular.
@arirahikkala
@arirahikkala Жыл бұрын
Shadertoy is so much fun. You go through your life barely using any trigonometry, then you draw even the tiniest shader effect, and oh god so much trig, suddenly everything is trig. It's especially mind-bending as a programmer, because you're so used to the idea of having explicit objects that you render, and it's a complete shift in perspective to fake the existence of objects with just a function from time and screen position to pixel colour.
@twinkyoctopus
@twinkyoctopus Жыл бұрын
trig is like the algebra of higher maths, it apears everywhere
@__8120
@__8120 Жыл бұрын
Yeah but unfortunately the idea of rendering objects implicitly to the screen pixel by pixel doesn't seem to really be a thing outside of shadertoy. Fragment shaders like the one you get there are generally used to apply final effects to an individual face pixel by pixel, rather than the entire screen. It's a great playground for sure, but you do typically have real explicit objects to render
@MichaelPohoreski
@MichaelPohoreski Жыл бұрын
_Rendering Worlds with Two Triangles_ is a good introduction for non-graphic programmers, along with my _HOWTO: Ray Marching_ which has tons of examples to play with.
@NitzanBueno
@NitzanBueno Жыл бұрын
​@@__8120 Rendering with fragment shaders (and raymarching) really isn't very popular, but it allows rendering complex shapes using only equations that describe them, which can be very short. That's why it's extensively used in the demoscene, specifically for 4KB/1KB intros. I'd say that is indeed its most prevalent place, however - it's mainly a thing for artsy programmers and not really used in the graphics world, but I still love it 🥰
@__8120
@__8120 Жыл бұрын
@@NitzanBueno oh absolutely
@teamruddy611
@teamruddy611 Жыл бұрын
8:00 I've seen prime computing equations (totally exist, but very long) smaller than that. Also I have a triangle myself but I can't post it here - it starts as a Isosceles Triangle and you can drag around the corners - it is made by drawing a line from each point to every other point.
@amyshaw893
@amyshaw893 Жыл бұрын
inigo has their own youtube channel hwere they explain a lot of their code. it really helped me when i was in uni and i was doing some work on 4d shape rendering using raymarching, and he works from first principles which is amazing
@djcsdy2
@djcsdy2 Жыл бұрын
I was super excited when Inigo Quilez popped up! Glad you took the time to talk a bit about shadertoy.
@Hermaniac8
@Hermaniac8 Жыл бұрын
Inigo Quilez's SDF videos are so good. Masterpieces in educational content
@john_carter_of_earth
@john_carter_of_earth Ай бұрын
I'm hopelessly inept at math/maths, but just wanted to drop a note of appreciation at how entertaining Matt is at explaining it all. 85% of the time I have no idea what he's talking about, but I still love watching/listening to him do it. 😅
@christianzander6547
@christianzander6547 Жыл бұрын
Good luck with the cinematic universe. But I am holding out for 'Triangle Hard with a Vengeance' caus I love a New York settings for my math thrillers. Can't wait for the scene where you walk through the Financial District with a sandwich board describing a controversial conjecture about triangles infuriating the local population.
@griffinblades8475
@griffinblades8475 Жыл бұрын
I love these community contribution videos!
@lillithplays6514
@lillithplays6514 Жыл бұрын
The sign function shouldn't be a problem. You can represent it as x/abs(x) for any nonzero x. The absolute value can also be the positive solution to sqrt(x^2)
@anomaliecosmos
@anomaliecosmos Жыл бұрын
Does the sqrt(x^2) version technically leave some extra values in the imaginary/complex plane? Best case it ends up a second triangle, but that might count as similar to the one with the extra origin dot or the rays out the corners. (Didn't think of x/abs(x) though, clever!)
@friedrichhayek4862
@friedrichhayek4862 Жыл бұрын
@@anomaliecosmos The circle equation is the same.
@the1exnay
@the1exnay Жыл бұрын
The sign function being undefined at 0 feels very appropriate.
@ollllj
@ollllj Жыл бұрын
@@anomaliecosmos yes, this fails for nonzero imaginary values, but these do not occur here. shortcuts are important.
@ollllj
@ollllj Жыл бұрын
@@the1exnay negative zero is fun, but not useful, so positive nulls are asserted. MUCH worse is that the first derivative of abs() is discontinuous, any 3d shapes with "abs" will always have a shiny-kin/corner at their 1st derivative discontinuity, and that always looks "to oartificial" , unless you enforce "smooth abs" (seach "sabs" on shadertoy)
@DingbatToast
@DingbatToast Жыл бұрын
I don't know how you continue to take one of my most hated subjects at school and make some of the most enjoyable and entertaining content on KZbin. Thanks for making me want to learn more about maths ❤
@theoriginaltubeofyous
@theoriginaltubeofyous Жыл бұрын
you probably didn't hate maths in school because of maths, you probably hated it because of school.
@DingbatToast
@DingbatToast Жыл бұрын
@@theoriginaltubeofyous true, i hated it because of my maths teacher
@vittorio1159
@vittorio1159 Жыл бұрын
15:30 You can just multiply by (1+sqrt(r^2-(x-h)^2-(y-k)^2)) removing that annoying denominator and this way including the vertices of the triangle.
@Jetpans
@Jetpans Жыл бұрын
The 11:15 solution is just so beautiful. Using such simple concepts and yet getting such a magnificent result.
@sp0_od597
@sp0_od597 Жыл бұрын
At 2:57, I believe that skewing and stretching the triangle can get you all triangles albeit, rotated and translated in the xy plane, so to fix this you could transform x and y into a new coordinate space x' y' and get all triangles that way. Basically I am stating that by stretching and skewing the triangle, you can generate any combination of internal angles of the triangle. Then by change of coordinate space, you can scale, translate, and rotate the triangle to wherever you want in the new coordinate space.
@ollllj
@ollllj Жыл бұрын
16:00 OOH YES it matters VERY much if your interval (for line-segments) is a closed-interval, open-interval or half-open-interval. I saw countless shadertoy-shaders that pondered about interval-error-cases, significantly losing out on precision or even losing out on performance. intervals become VERY tricky close to undefined/asymptotes, and you generally want to "rather have this area undefined (or replaced by a simpler non-asymptotic smoothing-function) than having it at a too low precision, too close to an asymptote" boundary near asymptotes. And that boundary better be a half-open-interval. a smoothing--function ideally is continuous, and for that you want an open-interval, but you to not want to use the slower function for the same point+solution, where 2 functions met, and then you better pick the right intervals where 2 functions switch.
@alanmiller7875
@alanmiller7875 Жыл бұрын
First off... it's "Triangle 2: Electric Boogaloo." Secondly, I love that you started with triangles that were Parker Squares.
@unvergebeneid
@unvergebeneid Жыл бұрын
Seeing those shapes that are not made up of triangles on Shadertoy was actually a thing of beauty. Maybe one day games will have actual curves being rendered on our GPUs.
@DerToasti
@DerToasti Жыл бұрын
well, the one at 16:50 is the perfect one. very nice, straightforward and i assume it generalizes to any polygon. at 15:00 it shouldn't be too hard though to find a function that works at the ends too, like 1+sqrt(1-abs(x-1)-abs(x)) for example.
@cmilkau
@cmilkau Жыл бұрын
The easiest way to make a triangle I think is to use max or min (works for all convex polytopes). Basically just take the max or the min of a bunch of affine-linear functions on the plane and you can get a polygonal-base cone (a generalized pyramid) as a graph of that max/min. Now pick another affine-linear function, could be as simple as just 0, and equate the two. The intersection of the two graphs typically is the border of a convex polygon (and it still is when projected back down onto the domain). Example: min { |m₁x - y + b₁|, |m₂x - y + b₂|, |m₃x - y + b₃| } = 0 in the notation of the video. You can choose an appropriate sign for each of the absolute values depending on the m's and b's. Note: max {x, y} = (x + |x - y| + y)/2 and min {x, y} = (x - |x - y| + y)/2, for the guys who don't want special functions. Note: You can also get weird unbounded "polytopes" in general. This is analogous to how cone intersections may not just give you ellipses but also hyperbolas or even parabolas.
@ethanolcott3960
@ethanolcott3960 Жыл бұрын
There's a nice clean way to represent triangles in Desmos, just define a function l(A,B,t)=A+(B-A)t and then call [l(P,Q,t),l(P,R,t),l(Q,R,t)] where P, Q, and R are all called as points.
@kylerichardson514
@kylerichardson514 Жыл бұрын
This episode was fascinating to me. I'm in the FEA world working on a smooth potential to describe contact. A very closely related problem. The code at the very end looked like it was possibly based on the old algorithms in FEA with all sorts of problems and issues. Mainly they are only C^0 continuous. Using Non-Newtonian calculus it is possible to build smooth potentials that can describe any arbitrary shape.
@MateusAntonioBittencourt
@MateusAntonioBittencourt Жыл бұрын
Wow... just re-watched yesterday your original video. Now today there's a part two.
@macronencer
@macronencer Жыл бұрын
This was a LOT of fun! My favourite was the affine transformation with the homogeneous co-ordinate matrices. That approach occurred to me immediately as soon as you showed the base triangle for it, because when I was young I spent a lot of time studying computer graphics techniques. Homogeneous co-ordinates are very useful.
@cragnog
@cragnog Жыл бұрын
"As a approaches infinity this will approach a triangle" was a way funnier line than one would expect
@ollllj
@ollllj Жыл бұрын
this is a VERY overused phrase in 8th to 13rth grade maths, usually not with triangles. But i guess they stopped teaching that maths after the 90s.
@aikumaDK
@aikumaDK Жыл бұрын
1:26 subtitles says 'James Street' instead of Jane Street 7:35 Subtitles says 'octan' instead of arctan 12:10 Subtitles says 'F9' instead of (presumable) affine 13:38 'Goebel' instead of Goble 19:56 'gene street'
@abigailcooling6604
@abigailcooling6604 Жыл бұрын
0:38 subtitles says 'sine function' instead of sign function.
@kindlin
@kindlin Жыл бұрын
I'm pretty sure they're just autogenerated, so if that's the worst they did a good job.
@asheep7797
@asheep7797 Жыл бұрын
also 1:26 subtitles say "James tree" instead of Jane Street
@simonmultiverse6349
@simonmultiverse6349 Жыл бұрын
It also says "K9" instead of "canine"
@Jivvi
@Jivvi Жыл бұрын
10:53 "okay good" instead of "so good".
@Beokabatuka
@Beokabatuka Жыл бұрын
There's something so pure about the joy of math(s) nerds trying to solve somewhat meaningless yet captivating problems. I love it.
@firymath976
@firymath976 Жыл бұрын
So the thing is in roughly 15:30, there is a way to modify Graham's Equation using modular. There is a function f(x) = (|x| - |x| mod 1)(1/|x| - 1/|x| mod 1) or equivelently floor(|x|)floor(1/|x|) that at x = -1 or 1 has a value of 1 but everywhere else it has a value of 0. (If it wasn't absolute value negatives would mess stuff up for other negative values). It works because if x > 1 or x < -1, 1/|x| is between 0 and 1 so the floor is 0, and at -1 < x < 1, |x| is between 0 to 1 so the floor is 0, but when x = 1 and x = -1, the floor of |x| and 1/|x| are both 1. If you added this function but with x = x - x1 + 1, times this function at x = y - y1 + 1 and repeated for each vertex you would include the vertices. However this would create problems potentially at x - x1 = -2, y - y1 = -2, etc... This can be solved by modifying f(x) and doing (|x - x1 + 1| - |x - x1 + 1| mod 1)(1/|x - x1 + 1| - 1/|x - x1 + 1| mod 1)(0.5((x - x1 + 1) - (x - x1 + 1) mod 1)(1/(x - x1 + 1) - 1/(x - x1 + 1) mod 1) + 0.5((x - x1 + 1) - (x - x1 + 1) mod 1)(1/(x - x1 + 1) - 1/(x - x1 + 1) mod 1)^2) * this but with y1 and y instead of x1 and x, and the adding of this but with x2 and y2, etc... The reason this works is because the f(x - x1 + 1) with absolute value makes sure it is only 1 or -1 while the alternated non absolute value average does have the downside of having values besides that of -1 and 1 (negatives don't work since it'd require ceil instead), but if you square either of the terms when it is at x = -1 it becomes -1 not 1, and the average becomes 0 if x = -1, of course in our case x is either going to be x - x1 + 1, y - y1 + 1 for the first vertex. This essentially adds the vertexes because of the value 1 being added to the denominator at each vertex b (meaning that we get 0/1 instead of 0/0 causing our result to still be 0.
@edwardhoppe4294
@edwardhoppe4294 Жыл бұрын
Parametric equation of a triangle: p = p0 + r(p1 - p0) + s(p2 - p0), where pn are the 3 vertices, and r, s are scalars. The point p lies within the triangle for 0
@vick229
@vick229 Жыл бұрын
All Parker tri angles in one place.. love it 🤣
@claritas6557
@claritas6557 Жыл бұрын
I'd never noticed how fuzzy Matts ears are. But it makes sense. As a number ninja he can't wear ear muffs, since that would dampen the sound of any assassin integrals sneaking up on him, so he uses a natural alternative.
@sighmon5640
@sighmon5640 Жыл бұрын
That first equation reminds me of the "trick" where rearranges some pieces in a triangle and seems to create an extra square of area in the process, but the resultant is just a quadrilateral that looks very close to a triangle
@Jivvi
@Jivvi Жыл бұрын
The original "triangle" is also a quadrilateral. The seemingly straight edge has an angle that is less than 180° by exactly as much as the angle in the final one is more than 180°.
@johnchessant3012
@johnchessant3012 Жыл бұрын
The circumcircle method was clever! The fact that it misses just the three vertices is extremely funny to me haha
@kazedcat
@kazedcat Жыл бұрын
There must be a way to add back those 3 missing vertices
@hughobyrne2588
@hughobyrne2588 Жыл бұрын
@@kazedcat If we take the 'sqrt' function as one that strictly works within the real numbers, i.e. it gives the result 'undefined' for less than zero, zero for zero, and a nonzero positive value for a nonzero positive value, then this trick can be used quite easily - instead of excluding the region outside a circle, excluding a region outside the triangle, as defined by the half-planes indicated by the sides of the triangle. Get nine values a1 b1 c1 a2 b2 c2 a3 b3 c3 such that aix+biy+ci=0 is an equation for line number 'i' of the triangle, and aix+biy+ci>0 is the half-plane that includes the triangle. Then, the equation sqrt(a1x+b1y+c1)*sqrt(a2x+b2y+c2)*sqrt(a3x+b3y+c3)=0, where the expression is evaluated at all stages in the reals, will give exactly the triangle. The square-roots ensure the expression does not give a value for any point outside the triangle (as long as you're not using complex-number-clever square roots), so if the point is on any line, and the product is defined, the product is zero, and if it's off every line, the product is nonzero.
@devjock
@devjock Жыл бұрын
Today, Matt finds out demosceners have cracked a lot of the math behind aesthetic things, that demosceners are lazy AND efficient enough to make toolchains to go from sliced bread to sliced bread with the whole universe in between, that demosceners eat sleep code repeat, and we're all happily nerding out together. Matt, next year, visit any demoparty. You will be amazed by the things sceners showcase. Most of the time on a very limited codesize budget, to add to the challenge.
@soffeebeans
@soffeebeans Жыл бұрын
I just wanted to compliment the way you displayed and referred to the desmos equations. It felt really very natural and was a lot more engaging than a box off to the side!
@psychoDon525
@psychoDon525 Жыл бұрын
"You're missing something infinitely small, which some would say, 'Does that really count?' I think it does." Seems like a bit of a change of heart on the significance of infinitesimals from Mr. Matt Parker.
@awboqm
@awboqm Жыл бұрын
15:52 would clever use of inequality signs and/or absolute values solve the better problem? Rather than forcing the function to be undefined outside the circle, you could use the inequality sign to specify only points inside (and on) the circle.
@Grable4PC
@Grable4PC Жыл бұрын
That's how I started it, but I wanted to make a true triangle "equation," not a piecewise function, inequality, or anything with the absolute value or sign operators. Just 5 operators (+, -, *, /, ^) and an equals sign.
@ecospider5
@ecospider5 Жыл бұрын
Conversations for Math aficionados. Truly fantastic.
@vertxxyz
@vertxxyz Жыл бұрын
Anybody who's even dabbled in graphics programming should recognise the thumbnail immediately. Inigo's resources have saved/enabled all our asses continually
@randomname9291
@randomname9291 Жыл бұрын
1:50 you can actually make a square parallel/perpendicular to the axes like so: abs(x+y) + abs(x-y) = n where n is the square’s side length
@heighRick
@heighRick Жыл бұрын
Thanks Matt, I was not expecting such an excellent and informative video about triangles on a Wednesday, helps a lot!
@jeremybuchanan4759
@jeremybuchanan4759 Жыл бұрын
Gen Eric is so much more easy-going than any of the other Gen's ... well done Gen Eric
@cristhiangrundmann1226
@cristhiangrundmann1226 Жыл бұрын
You can make an equation for a line segment easily: dist(a,p) + dist(p, b) - dist(a,b) = 0. You can then multiply a bunch of segment equations together to make the union of them.
@aleksitjvladica.
@aleksitjvladica. Жыл бұрын
By far the best video I watched recently, I had a blast, I had a lot of fun! Although I knew most of this. Thank you my mate! I love you!
@EMAngel2718
@EMAngel2718 Жыл бұрын
I think that if you're going to be fine with the absolute value function then you should be fine with the sign function because it's very easy to derive the sign function using the absolute value function
@mgpalpha
@mgpalpha Жыл бұрын
As soon as I saw the thumbnail I knew the video would end in Inigo Quiles. Absolutely insane shader artist
@jmi967
@jmi967 Жыл бұрын
Concerning Graham Goble's entry, would either of the following put the vertices back? (1) Use his triangle equation as bounds on the same circle and then combine the two results. Essentially using his almost triangle to do what he did from the other side (2) Do what he did but use calculus to infinitesimally increase the radius of the circle to include the vertices
@ollllj
@ollllj Жыл бұрын
sign02(a)=floor(floor(sqrt(a*a))-floor(a)) , where the floor() function just ensures good precision and floor() or fract() are ESSENTIAL for modulo-arithmetic on type float. sign02(a) //returns 0 or 2 (0 for negative) sign01(floor(sign02(a)*.5)) //returns 0 or 1 sign(floor(sign02(a)-1)) //returns -1 or 1 (-1 for negative)
@wikingagresor
@wikingagresor Жыл бұрын
I'm not a specialist or anything, but for me the simplest way to define a triangle is to have 2 vectors and a 3rd vector that is a product of their vector multiplication.
@morejpeg
@morejpeg Жыл бұрын
Inigo is a legend. I used his triangle SDF to do 3D collision detection!
@saliso470
@saliso470 Жыл бұрын
It's not defined for zero but x/abs(x) will give you a one with the sign of x. And since abs can be done by using sqrt(x^2) using sign isn't a bad way.
@curiousfirely
@curiousfirely Жыл бұрын
I'm just over here, being amazed at the overlay of the graphs on top of your face.
@Zero-4793
@Zero-4793 Жыл бұрын
that n sided shape equation is insane. feel like we need a video just on it
@Awokenify
@Awokenify Жыл бұрын
In this video: Matt is excited because he learned a new video editing trick.
@hansdietrich83
@hansdietrich83 Жыл бұрын
Shader code is like a different universe of code, it's so much fun.
@kappasphere
@kappasphere Жыл бұрын
15:43 On the vertices, the distance should be exactly r, so the argument of the square root should be 0, so the equation would still be defined and true on the vertices. Edit: nvm I missed the part where it cuts out the entire circle of radius r afterwards
@simonwillover4175
@simonwillover4175 Жыл бұрын
But it is defined there. And the limit of the 0/0 term = 1, not undefined.
@cg505_
@cg505_ Жыл бұрын
​This confused me as well, didn't realize there was a ^1/4 in the denominator. ​@@simonwillover4175 Usually 0/0 is taken to be undefined, not 1 or any other value. Even the limit of x/x as x goes to 0 is undefined. But we aren't taking a limit here, so I don't think it's relevant.
@kappasphere
@kappasphere Жыл бұрын
@@simonwillover4175 it's okay to be wrong about 0/0 but please don't say it as if correcting someone
@gasparliboreiro4572
@gasparliboreiro4572 Жыл бұрын
5:30 love the last words and transition
@ktbbb5
@ktbbb5 Жыл бұрын
Thumbnail looks like it is from Indigo Quilez's video. I'm already excited!
@mananagrawal6855
@mananagrawal6855 Жыл бұрын
The circumcircle solution is so nice. Love the creativity.
@Michael-Hammerschmidt
@Michael-Hammerschmidt Жыл бұрын
I was NOT read for the Matt Parker jumpscare in the new Captain Disillusion video. Very spooky
@TheSmegPod
@TheSmegPod Жыл бұрын
Curious to know what those n-gon equations give you for non-integer values What does a shape with pi or sqrt(2) or i sides look like
@freshIight
@freshIight Жыл бұрын
Yoooo!! New equations for triangles just dropped🔥
@harrywoodell7008
@harrywoodell7008 Жыл бұрын
I use nonlinear in my music all the time. Signum can make beautiful music. Or nerve impulses that let me play music. Absolute value is ... absolute value!
@Pogonateur
@Pogonateur Жыл бұрын
Your video editing is always so amazing, i really need to say it, it's such a pleasure to not only have interesting videos about maths but also so well edited like yours. Thank you so much for your work!
@micksam7
@micksam7 Жыл бұрын
IQ is a legend in the shader coding and demoscene communities. Props for showing off his work!
@PretzelBS
@PretzelBS Жыл бұрын
Today I bought both your books cause I’m in the uk for a family wedding! You’re my favourite educational KZbin channel!
@quillaja
@quillaja Жыл бұрын
From the very start of this video, I just knew Inigo Quilez would have the best, simplest, most precise answer (even if he hadn't submitted one). The one with the circle "cropping" the triangle was also good.
@monhi64
@monhi64 Жыл бұрын
I have a confession, for literal ages I thought your channel name was stand-up maths in the sense you were showing off some really nice math. Recently I saw your bio and realized I might be an idiot. I think I’m just used to seeing stand up comedy written without the hyphen
@yes.thatjanedoe
@yes.thatjanedoe Жыл бұрын
5:30 it may not be a triangle, but it has its heart in it. Gets credit for triing
@Verrisin
@Verrisin Жыл бұрын
16:00 according to a math class I remember, 0.9999... = 1 - So in R, a number infinitely as close is the same, right? - So missing an infinitely small point on the edge of a triangle should ... not be missing anything?
@Verrisin
@Verrisin Жыл бұрын
I guess not, but it's weirdy annoyingly inconsistent ,...
@The14Some1
@The14Some1 Жыл бұрын
Guys, i'm not native English speaker. Could somebody explain me, why he refers to Anson Mansfield at 13:24 as "they" while using "the only person" shortly after?
@AmPlant
@AmPlant Жыл бұрын
Triangle is my favorite shape! I'm so glad the sequel finally dropped :D
@haph2087
@haph2087 Жыл бұрын
Can one just take any equation for an arbitrary (non-colinear) triangle, and turn that into an equation for any other triangle, by changing your basis? (Any function that applies a transformation to the X-Y plane also works as a transformation to all functions on the X-Y plane).
@ChavvyChannel
@ChavvyChannel Жыл бұрын
5:25 according to the Intermediate value theorem, somewhere between the triangle and the heart would be a love triangle.
@EthanBradley1231
@EthanBradley1231 Жыл бұрын
I noticed that with the almost-triangle equation featured around 5:00, there are certain non-integer values of *a* for which it is *extremely* not a triangle. At *a* = 12.5, for example, the almost-vertical almost-line at x = -1 turns into two (almost) lines shooting out from (-1, 2) and (-1, -2).
@oscidleus
@oscidleus Жыл бұрын
I've seen his book translated to polish few days ago and got proud that some publisher decided that theres enough people intrested in math in Poland
@AgainstMyBetterJudgement
@AgainstMyBetterJudgement Жыл бұрын
I found an easier solution. Use a variation on polar coordinates where θ is the angle but r is the distance from the desired triangle. Then every triangle is just 'r = 0' but with a different coordinate system 🙃
@rwarazor
@rwarazor Жыл бұрын
Was there no solution that utilized the fact that a segment is just a corner case of ellipse? So solving ||X - A|| + ||X - B|| = ||A - B|| for X will give all the points on segment AB Or in coordinates sqrt((x - x1)^2 + (y-y1)^2) + sqrt((x-x2)^2 + (y - y2)^2) - sqrt((x1 - x2)^2 + (y1 - y2)^2) = 0 Multiply 3 of those and you've got yourself a triangle. This equation is also defined on the whole plane, which is nice
@eccleshillstluke5352
@eccleshillstluke5352 6 ай бұрын
I also wondered if no-one else had seen this, so posted it, then found yours - thanks for reassuring me I wasn't going nuts! - JOHN HARTLEY
@MrSilbarita
@MrSilbarita Жыл бұрын
You can only be mad at the sign function if you are also mad at the absolute value function, since you can pretty much construct sign(x) as |x|/x (except for the case x=0). And you con only be mad at the absolute value function if you are mad a sqrt(x) and x^2. So really, there is no basis for being mad at sign.
@ehfik
@ehfik 18 күн бұрын
ive been thinking about inigo all the time, and VOILA! what a nice surprise. he is the true king of shadertoy
@hughobyrne2588
@hughobyrne2588 Жыл бұрын
A hybrid of two approaches: Get nine values a1 b1 c1 a2 b2 c2 a3 b3 c3 such that aix+biy+ci=0 is line number 'i' of the triangle, and aix+biy+ci>0 is the half-plane that includes the triangle. Then, the equation sqrt(a1x+b1y+c1)*sqrt(a2x+b2y+c2)*sqrt(a3x+b3y+c3)=0, where the expression is evaluated at all stages in the reals, will give exactly the triangle. The square-roots ensure the expression does not give a value for any point outside the triangle (as long as you're not using complex-number-clever square roots), the square roots leave 0 at 0 and leave every positive number positive, so if the point is on any line, the product is zero, if it's off every line, the product is nonzero.
@hughobyrne2588
@hughobyrne2588 Жыл бұрын
Just want to make an edit, but keep the timestamp of my original comment: "if the point is on any line, and the product is defined, the product is zero". Credit where credit is due: the idea of chopping off those parts of the lines that are not desirable, and the method for doing so, are adapted from Graham Goble's e-mail, which Matt starts explaining at 13:34. My variation on his idea is not to use a circle to chop off the unwanted bits, but to use the lines we already have.
@Ethan-sc7gq
@Ethan-sc7gq Жыл бұрын
Instead of the sign function, it could use |cos(pi t) - 1| /2 . That outputs 1 for odd values and ) for even, just switch the - to a + to reverse it. Multiply the individual multipliers by this to use or negate them. I made it up while making a Collatz Conjecture Desmos graph :) .
@karibui494
@karibui494 Жыл бұрын
I got it without trig functions with: sign(x) = -2mod(x, |x|+1)+|x|+1+x, this gives 1 for x>=0 and -1 for x
@satindra.r
@satindra.r Жыл бұрын
​​@@karibui494 ideally you would want to get 0 for x=0 but i think its possible to convert this into something we can define floor as x-((cot^-1(cot(πx)))/π) and then use floor(tanh(x))-floor(tanh(-x)) to get sign(x)
@angeldude101
@angeldude101 Жыл бұрын
sign(x) is actually exactly the same as normalization for vectors, which is usually written as v/|v|. This works for real numbers as well though doesn't include 0. Absolute value can be found the same way as other things as well with sqrt(x²). (Technically sqrt(x*conj(x)), but the conjugate of a real number is itself.)
@karibui494
@karibui494 Жыл бұрын
@@satindra.r setting sign(0) = 0, wouldn't remove the edges in this case?
@karibui494
@karibui494 Жыл бұрын
@@satindra.r I played around and found: mod(-x, |x|+1)+(x-|x|)/2 this is 1 for x > 0 and 0 for x
@FlamingBehar
@FlamingBehar Жыл бұрын
I literally just re-watched that triangle video today, how serendipitous 😁
@monstronamaguederaz
@monstronamaguederaz Жыл бұрын
5:27 That's what I'd call a mathematically love triangle
@johncage5368
@johncage5368 Жыл бұрын
I liked that safety triangle with the rounded corners. ;)
@__dane__
@__dane__ Жыл бұрын
I would recognize that SDF shadertoy from anywhere. It’s not a video mentioning SDFs without Inigo Quilez
@Zolbat
@Zolbat Жыл бұрын
Inigo is an absolute legend
@__dane__
@__dane__ Жыл бұрын
@@Zolbat Inigo, Keijiro, Ben Golus and more
@petersage5157
@petersage5157 Жыл бұрын
Makes you appreciate how much code was required for "simple" vector graphics video games like Asteroids.
@Den_drummer
@Den_drummer Жыл бұрын
Regarding the second solution aka the anonymous one. Wouldn't a quick workaround to make that "disc"-triangle into a "circle"-triangle be to put it into a modulo?
@cosmologicalturtle9528
@cosmologicalturtle9528 Жыл бұрын
15:34 You can fix this by multiplying by (|x-x1|+|y-y1|)(|x-x2|+|y-y2|)(|x-x3|+|y-y3|), which will each be zero only at one of the missing points.
@aurelienlouesdon9880
@aurelienlouesdon9880 Жыл бұрын
It doesnt work because on the missings points in the original formula, it is undefined
@eragonawesome
@eragonawesome Жыл бұрын
I still feel like the sign function is totally valid, you could manually test for the sign by just putting b/|b| giving you either positive or negative 1
@codinghub3759
@codinghub3759 Жыл бұрын
Unfortunately, it is undefined at 0
@eragonawesome
@eragonawesome Жыл бұрын
@@codinghub3759 so is division, but we still use that
@eragonawesome
@eragonawesome Жыл бұрын
@@codinghub3759 also, to my understanding, that would actually be correct as the sign of zero IS undefined
@idiotinium
@idiotinium Жыл бұрын
@@eragonawesome the sign of 0 is 0
@stevenchristy6156
@stevenchristy6156 Жыл бұрын
The sign function is legit. I use it sometimes in my own programming as its very cheap to obtain the high bit of a float or double.
Is there an equation for a triangle?
15:50
Stand-up Maths
Рет қаралды 668 М.
I designed a silly but semi-functional computer.
24:19
Stand-up Maths
Рет қаралды 295 М.
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
The "Just One More" Paradox
9:13
Marcin Anforowicz
Рет қаралды 3,2 МЛН
Researchers thought this was a bug (Borwein integrals)
17:26
3Blue1Brown
Рет қаралды 3,9 МЛН
The GAMMA function.
23:44
Amaarculus
Рет қаралды 727
Putting Algebraic Curves in Perspective
21:39
Bill Shillito
Рет қаралды 287 М.
Why the longest English word is PAPAL and SPA is the pointiest.
31:20
Stand-up Maths
Рет қаралды 866 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1,1 МЛН
What is the biggest tangent of a prime?
10:59
Stand-up Maths
Рет қаралды 364 М.
Beware the Runge Spikes!
17:08
Stand-up Maths
Рет қаралды 468 М.
Exploring the mysteries of the Prime (gaps!) Line.
21:43
Stand-up Maths
Рет қаралды 611 М.
The weirdest paradox in statistics (and machine learning)
21:44
Mathemaniac
Рет қаралды 1 МЛН