Introducing 2D Geometry Library

  Рет қаралды 52,337

javidx9

javidx9

Күн бұрын

Пікірлер: 219
@javidx9
@javidx9 Жыл бұрын
Live Demo! community.onelonecoder.com/members/javidx9/Geometry2DDemo1/
@obinator9065
@obinator9065 Жыл бұрын
bro, github has a dark mode light mode is gonna attract bugs :D
@zahash1045
@zahash1045 Жыл бұрын
Why does the circle constructor take a reference to the point? Why not just take the value? That way, hidden allocations are avoided
@NEALMOHANSADSANXIETY
@NEALMOHANSADSANXIETY 11 ай бұрын
Hey amazing demo, you can get some great matrix of reflections😊
@codework-vb6er
@codework-vb6er 11 ай бұрын
❤👍
@abdo01386
@abdo01386 11 ай бұрын
I want pls the video how to create the orignal header file for the 3d engine ?
@GTGTRIK
@GTGTRIK Жыл бұрын
My favourite programming channel is alive! And with such a wonderful gift too!
@davidbale8495
@davidbale8495 Жыл бұрын
Have to admit a good chuckle when you said "So far... so what?" Caught me off guard. Many thanx, and much respect to the work on this library!
@javidx9
@javidx9 11 ай бұрын
Thanks David lol :D
@phutureproof
@phutureproof 11 ай бұрын
Hey Javid Just wanted to drop by and say thanks to people like you, simondev, code monkey, sebastian lague.. I am slowly shifting my career from 25 years in web application programming and moving into solo game dev and I cannot thank you enough! Cheers man
@siriusleto3758
@siriusleto3758 Жыл бұрын
He returned. I'm happy for that.
@Nunya58294
@Nunya58294 Жыл бұрын
Well hello good sir! It's good to see your going well!
@javidx9
@javidx9 Жыл бұрын
Why thank you!
@ristopaasivirta9770
@ristopaasivirta9770 11 ай бұрын
This is very cool. I had actually used your game engine to quickly validate some 2D geometry calculations I was doing for Godot. Should probably join your community discord with the fine folks.
@javidx9
@javidx9 11 ай бұрын
Sounds cood, thats exactly what PGE is for! Yeah join up and show-your-stuff
@richardbloemenkamp8532
@richardbloemenkamp8532 Жыл бұрын
Good to see you back. I was just watching some of your older videos last week. The PGE is still my go-to library for hacking together a quick visual in C++.
@javidx9
@javidx9 11 ай бұрын
Thanks Richard, its still my go-to as well :D
@Bastanaft
@Bastanaft Жыл бұрын
Oh!!!! Mate you haven't changed a bit....ahhh... nevermind. Glad to see you back! Ive loved your channel since... well ever!
@javidx9
@javidx9 11 ай бұрын
Ive got precisely 17 more grey hairs thank you very much
@petrihaikonen2528
@petrihaikonen2528 11 ай бұрын
I'd like to see videos like this a bit more often, even short ones. Good content as always :)
@wevv-i7t
@wevv-i7t 10 ай бұрын
This gives me an idea of what seemed impossible before I saw it. While watching, I feel nervous. After completing this, I feel empowered with new possibilities.
@zxuiji
@zxuiji 11 ай бұрын
Just a note, I've found that the √c² can be calculated as roughly √0.5 * (a+b) (a & b from from a²+b²=c²). There will be a little bit of error when a != b but the results do tend to be close enough that it's worth storing the result of √0.5 just to do quick square roots for potential collision detection (whereby the more accurate math can then be used if the result happens to be in the outer radius of the shapes
@jw200
@jw200 Жыл бұрын
Good to see you back. Im in the mood of coding again after 1 year, so Its right on time.
@IllumTheMessage
@IllumTheMessage 11 ай бұрын
Wow, set up everything as stated and worked first shot. Looking forward to helping out.
@uuu12343
@uuu12343 11 ай бұрын
Welcome back Javid! Its also been awhile since I last watched your videos due to university
@javidx9
@javidx9 11 ай бұрын
Thank you! Hopefully uni went well for you!
@DavidBauer38
@DavidBauer38 11 ай бұрын
Awesome project! Hope the family is doing well!
@javidx9
@javidx9 11 ай бұрын
Thanks David, we're all doing fine!
@VictorHernandez-qt2xx
@VictorHernandez-qt2xx 11 ай бұрын
Thank you for the content. It's been sorely missed.
@javidx9
@javidx9 11 ай бұрын
I appreciate that Victor, thanks!
@JADE-iteGames
@JADE-iteGames Жыл бұрын
Your channel is such a wonderful resource! I have learned so much watching your videos. It has helped me grow a lot as a programmer. Thank you for your hard work!
@javidx9
@javidx9 11 ай бұрын
I appreciate that Jade(?) - always good to hear the videos have been useful.
@GRAHAMAUS
@GRAHAMAUS 11 ай бұрын
This looks enormously promising! I'd suggest you add polygons (closed shapes made from line segments) and bezier paths (closed shapes made from concatenated bezier curves). If this then had the ability to find the intersecting points between overlapped paths, lines, circles, rects..., that in turn can extend to boolean/set operations between arbitrary shapes (union, intersection, difference, etc). This is HARD, but fantastically useful for doing all sorts of vector-based 2D drawing. I've never been entirely satisfied with existing libraries for doing this, they all suck in one way or another.
@javidx9
@javidx9 11 ай бұрын
Thanks Graham, yeah polygons are on the roadmap, and some prototype implementations have already started to appear.
@wizardy6267
@wizardy6267 Жыл бұрын
Glad to see you back. Thanks for your nice video :)
@notSoAnonyymus
@notSoAnonyymus 11 ай бұрын
I've watched a lot of your videos and a bunch other game dev channels. I have to say, listening and watch has convinced me to do some hobby projects!
@4F6D
@4F6D Жыл бұрын
Hell yeah, finally another video for motivation!
@fuzzycat3651
@fuzzycat3651 10 ай бұрын
Wow, I wish I knew about this project sooner! I was doing ray reflections recently and this would have made it a LOT easier. Wonderful job
@juror12
@juror12 Жыл бұрын
I've been following the channel for some years now, but only now I started learning c++ and I am using the PGE, I'm glad to see a new video from the guy that got me hooked up into game dev
@javidx9
@javidx9 11 ай бұрын
Well Juror12, you're more than welcome to jump in the Discord and show-your-stuff!
@gustafbstrom
@gustafbstrom 11 ай бұрын
Very impressive work everyone, looks gorgeous and promising!
@MagusArtStudios
@MagusArtStudios 11 ай бұрын
Nice! I made something like this with a chat tool where you can ask it various questions about geometry and it used samples of constructors to decode the response and solve the problem. Thanks for the video!
@TheOnlySWilliams
@TheOnlySWilliams 11 ай бұрын
This is really well done. Thanks OLC crew!
@leewei9117
@leewei9117 Жыл бұрын
It's finally updated. I've been looking forward to it for a long time
@camorimd
@camorimd 11 ай бұрын
Amazing library! And good to see another video ^^
@javidx9
@javidx9 11 ай бұрын
Thanks! Yeah, finding some video making time again now.
@tgd2096
@tgd2096 11 ай бұрын
Great video, and well done to all involved 🎉
@colin_actually
@colin_actually Жыл бұрын
Very cool. Might find a use for this some day!
@maix52
@maix52 11 ай бұрын
Thanks ! this seems genuinly useful (even for non-cpp dev because I find your code very readable and translatable to other language!) Hope you are doing well and do find some sleep with mini-javid being around haha keep going and keep this amazing channel because you are truly doing great work :D
@septimsniffer4104
@septimsniffer4104 Жыл бұрын
So glad you're back, love your content
@sanjivjadhav7789
@sanjivjadhav7789 5 ай бұрын
dear sir all of your session have provided best knowledge & i loved.
@dalskiBo
@dalskiBo 11 ай бұрын
I cannot wait to try this - thank you
@burntt999
@burntt999 11 ай бұрын
so cool.. such a simple thing but man, so gosh darn wonderful
@javidx9
@javidx9 11 ай бұрын
Yeah, I hope others find it useful, thanks!
@LunarcomplexMain
@LunarcomplexMain Жыл бұрын
I love the layout of that Function Matrix
@presidentcrab
@presidentcrab Жыл бұрын
Thanks! your videos are always so helpful!
@javidx9
@javidx9 11 ай бұрын
Cheers, my pleasure!
@circuitgamer7759
@circuitgamer7759 11 ай бұрын
I find it somewhat amusing that the "one lone coder geometry library" is a community project :)
@javidx9
@javidx9 11 ай бұрын
I think its great there's so many lone coders out there :D
@valet_noir
@valet_noir 11 ай бұрын
Really nice lib ! Good work everyone !!
@GNARGNARHEAD
@GNARGNARHEAD Жыл бұрын
ahh! I can almost taste an application, great job guys! 🎉
@huseyinkucuk3909
@huseyinkucuk3909 11 ай бұрын
Welcome back Mr Javid. We missed you.
@songersoft
@songersoft 11 ай бұрын
This was great man. Thanks!
@javidx9
@javidx9 11 ай бұрын
Cheers!
@user-pw5do6tu7i
@user-pw5do6tu7i 11 ай бұрын
11:20 does the library strive to be pure mathematically accurate or is it accurate to the units provided? Would a overlapping boolean check of 2 circles ever change based on floats vs doubles?
@utuberrocks-q5j
@utuberrocks-q5j 11 ай бұрын
I think your web demo should change the colour of the line, every time that it bounces :) Or have a gradient, so we can follow it. Good work! Thanks for sharing, and the community!
@saucybossYT
@saucybossYT 11 ай бұрын
So glad you’re back dude!!
@centdemeern1
@centdemeern1 11 ай бұрын
This library seems quite nice! Good job Javid and the community! I’m more of a Rust person than a C++ person but if I ever have a good excuse to use this I probably will! (As soon as the repo gets a license… I’d prefer to stay in the legal green zone 😅) Maybe I could put this on my list of possible libraries to port or make bindings for…
@javidx9
@javidx9 11 ай бұрын
Thanks, its OLC-3 for the time being, so quite liberal
@centdemeern1
@centdemeern1 11 ай бұрын
@@javidx9 Ah, glad to hear it!
@user-pw5do6tu7i
@user-pw5do6tu7i 11 ай бұрын
Also looks great, good work!
@barellevy6030
@barellevy6030 11 ай бұрын
This type of things is why I love coding, great stuff 🎉
@javidx9
@javidx9 11 ай бұрын
Cheers!
@arcadus
@arcadus 11 ай бұрын
the bob ross of programming. thanks for getting me into game dev
@javidx9
@javidx9 11 ай бұрын
lol, thanks Arcadus
@PaulOvery001
@PaulOvery001 11 ай бұрын
Absolutely fantastic Library!
@nightwintertooth9502
@nightwintertooth9502 11 ай бұрын
This is INCREDIBLY useful as a standalone library of ninute size for collision detection using primitive geometry which is much faster than per pixel algorithms and really adds value to your library. Do you plan to support gcc? I have been moving away from msvc as of late.
@javidx9
@javidx9 11 ай бұрын
All OLC code over last 5 years is cross platform. So yes!
@nightwintertooth9502
@nightwintertooth9502 11 ай бұрын
@@javidx9 I'll be on the repo :)
@VRchitecture
@VRchitecture 11 ай бұрын
OLC repos are great for learning modern C++ (and the way things can be done of course) 👏🏻
@Larioteo
@Larioteo 11 ай бұрын
Amazing, respect to all of you guys...
@Troyxxt
@Troyxxt Жыл бұрын
Good to see you back
@leoreleases
@leoreleases 11 ай бұрын
Hey guys, how are you? It's great to see that Javid is back Regarding the video: knowing 2D and its details well in addition to developing your skills as a game dev will make your games with much more incredible details, making easier and speeder to learn more complex subjects in 3D and will increase game quality Great job! 🤟🏼🚀
@alexeyyurov845
@alexeyyurov845 11 ай бұрын
Gread job, One Lone Coder.
@javidx9
@javidx9 11 ай бұрын
Thanks Alexey!
@protasov-by
@protasov-by 11 ай бұрын
Heh, I implement almost same few months ago, architectural is same looking library except not making it open source yet, ideas is almost same but methods slightly differs, i do closest/contains/distance/intersects. Where first is closest point on surface not matter do u inside or not, seconds - is bool only for full containment and (signed distance float choosable), intersection is more advanced stuff, I test first for containment depending of what shape is contains or contained or coincident, then do find intersection points and intersection times if there rays/lines/segments ( segment is finite line or ray) normals to surface or vertex so you can even test line segment vs point or vice versa, penetration depth if shapes partially overlaps and it’s stored in returning structure with type of interaction to know what to obtain from it. I also add rotation for both shapes in tests and ellipses, and plan to implement sweep (in your u call projection) except do two sweep ellipse shapes also if they rotated cause lots of quartic equations etc. 😅 and same problem for convex and concave polygons not implemented yet.
@grapefruit256-wu5ml
@grapefruit256-wu5ml Жыл бұрын
Thanks for the retro C++ gameengine content. Now on pygame but saved the video for later
@mworld
@mworld 11 ай бұрын
Very nice work.
@javidx9
@javidx9 11 ай бұрын
Thank you!
@lel7531
@lel7531 11 ай бұрын
That is really cool !
@javidx9
@javidx9 11 ай бұрын
It is!
@gwentarinokripperinolkjdsf683
@gwentarinokripperinolkjdsf683 11 ай бұрын
Bless your heart for making it work stand alone
@84giampiero
@84giampiero 5 ай бұрын
Unbeliveable work!!
@sabriZekkour
@sabriZekkour 11 ай бұрын
Sir, very wonderful content. I hope you will make videos for us in which you talk about creating the two- and three-dimensional world from scratch, and we were founded in it. It means creating a library that includes tools from A to Z
@sorek__
@sorek__ Жыл бұрын
This is very cool! Is it possible to use project on a customized ray? Basically I want to check collisions along a path that is (for example) effect of further calculations of trajectory of a object (affected by gravity of other objects). Super cool project, thank you for sharing all of that with us! I love how you approach your code in simple, yet genius ways!
@dominiccasts
@dominiccasts 11 ай бұрын
How well does this scale for number of objects? For example, if you had 10,000 shapes and were trying to make sure that as you moved some around they'd snap to the edges of nearby objects, or didn't intersect them at all (and just stayed on one side or the other depending on mouse position), would that still run reasonably fast?
@javidx9
@javidx9 11 ай бұрын
The library core functions assume only 2 shapes exist. How you use that interaction for many shapes is up to you. It's always context dependent, but either you can batch and accumulate, or do some broad phase reduction first to reduce the number of comparisons.
@Schwuuuuup
@Schwuuuuup 11 ай бұрын
This is great... But did I miss a part or isn't there a distance function yet? I needed in the past and will need in the future a function that takes two items (point, line, circle, polygon) ans spits out the distance of their nearest points.
@javidx9
@javidx9 11 ай бұрын
In this library we have closest(), but not distance() yet... Hint hint
@Schwuuuuup
@Schwuuuuup 11 ай бұрын
@@javidx9 yeah, that's where my confusion comes from. If I understand correctly, I would have to Pythagoras(closest(poly1, poly2), closed (poly2, poly1)) Or does closest give the closest points of both shapes, the one you are holding and the one you are testing it against? Then it would be fine
@dazaidev
@dazaidev Жыл бұрын
insane i will definitely try it
@jwallace6913
@jwallace6913 11 ай бұрын
I wonder, does the ray march off screen? does the user have control here, over length and bounces? really cool stuff :)
@javidx9
@javidx9 11 ай бұрын
Rays are infinitely long. There is no marching, stepping or nibbling here, contacts are resolved as line Vs shape equations.
@magikworx3748
@magikworx3748 11 ай бұрын
That's a neat library
@keithrobinson2016
@keithrobinson2016 11 ай бұрын
Excellent! Can use SFML for graphics and this library for C++ collision detection.
@ARTIFAYT
@ARTIFAYT 11 ай бұрын
im happy:)
@emmadkareem5247
@emmadkareem5247 2 ай бұрын
Thank you for your work. I have a question for you not related to this video, but you know js well, so may have an answer. I work with Google sheets scripting, and need to be able to draw lines and axis inside the Google sheet. Is there any way I can do this? Thanks.
@darkfrei2
@darkfrei2 11 ай бұрын
Thanks for the video! Can you please make a video about boids with multiple behaviors? Where you can one or multiple of them for the same boid.
@javidx9
@javidx9 11 ай бұрын
Boids is the sort of thing this channel would play with. I'll add it to the list!
@darkfrei2
@darkfrei2 11 ай бұрын
@@javidx9 also I am stuck in the Voronoi diagram, not every diagram is solvable: when xn = xm (vertical directrix) in the point event or yn = ym in the circle event the program cannot solve it right (Furtune's algorithm)
@gedaliakoehler6992
@gedaliakoehler6992 Жыл бұрын
The return of the king 👑
@realdotty5356
@realdotty5356 11 ай бұрын
He came back
@ZERR0R
@ZERR0R 11 ай бұрын
What happens if you want to find the intersection points of two same circles? There are infinite number of them, since they consist of the same points...
@javidx9
@javidx9 11 ай бұрын
This is a great question. There has been some discussion about how to represent infinite solutions. The general assumption for now is that the user of the library would be aware of why they are calling the functions they are, and would hopefully have an understanding of the answers. As for your specific example, I think, and I may be wrong as I cant quite recall, that the number of intersections between circle and circle is restricted to a maximum of two. Which those would be however is anyone's guess lol
@Blackoutfor10days
@Blackoutfor10days 11 ай бұрын
Can you work on the artificial tree generation.
@varshneydevansh
@varshneydevansh Жыл бұрын
yayyaa
@ardroudi
@ardroudi 11 ай бұрын
Amazing. Could we run OLCGameEngine in Linux? How does the screen buffer works? if yes, is there a guide?
@javidx9
@javidx9 11 ай бұрын
PixelGameEngine is cross platform. Compile command and instructions are in the header. There's a few guides and videos knocking about giving examples of using PGE in Linux and on Mac.
@ardroudi
@ardroudi 11 ай бұрын
@@javidx9 Thank you, Found it :)
@FreedomAirguns
@FreedomAirguns 11 ай бұрын
I see that the library really is getting big as you noted and the following may turn/raise some eyebrows, but, have you guys considered opting toward arbitrary precision? I might try to rewrite it but, as you said, it's getting big. 😂 I barely had a look but I was wondering if I could easily use the bignum library for that, converting everything to use that as the base for operations. Any help or suggestion would be really useful.😊 I love to play with hundreds of thousands of digits long numbers from time to time and such a library would be the cherry on top of it all. ❤
@gsestream
@gsestream 11 ай бұрын
2d ray traced lighting demo would be nice (top-down wall floor lighting)
@javidx9
@javidx9 11 ай бұрын
Check out my "shadow casting" video, it does it without rays - but yeah a fully ray traced 2D lighting demo would be a neat project.
@chocolate_maned_wolf
@chocolate_maned_wolf Жыл бұрын
do you use separating axis theorem for collisions?
@alexsandergutierrezgoncalves
@alexsandergutierrezgoncalves Жыл бұрын
I was going to ask the same question lol, and if it can handle concave polygons
@okawo80085
@okawo80085 11 ай бұрын
This is literally a perfect c++ graphics engine for teaching gamedev basics now, from the bottom of my heart thank you, you all rock!!!
@AlexanderBukh
@AlexanderBukh 11 ай бұрын
Never really harnessed C, but this is a good video, thanks!
@javidx9
@javidx9 11 ай бұрын
Hopefully the maths is still transferable, Cheers!
@gigigigiotto1673
@gigigigiotto1673 11 ай бұрын
amazing
@MrSandshadow
@MrSandshadow Жыл бұрын
he is alive! :o
@wChris_
@wChris_ Жыл бұрын
It would be nice of the Pixel Game Engine would interact seamlessly with the shapes defined by this library. Im thinking mainly on the Draw methods, they should also accept the shapes from this library if it is present.
@javidx9
@javidx9 Жыл бұрын
This could be included in the library itself, switched on only if PGE is being used.
@littlenewton6
@littlenewton6 11 ай бұрын
Oh my God! You come back!
@superdepressif6047
@superdepressif6047 11 ай бұрын
do you know cool little projects to get back into code ?
@javidx9
@javidx9 11 ай бұрын
I've made over 100 of them on this channel 😄
@superdepressif6047
@superdepressif6047 11 ай бұрын
I'll check them out then thanks, it's a bit overwhelming after a long pause ^^@@javidx9
@jhonrodriguez213
@jhonrodriguez213 Жыл бұрын
Ohhhh hello there javid, how is the family?
@javidx9
@javidx9 11 ай бұрын
We're all good thanks!
@Raix03
@Raix03 11 ай бұрын
UTIL part from the name could be removed olcUTIL_Geometry2D -> olc_Geometry2D. Great content!
@javidx9
@javidx9 11 ай бұрын
Thanks! This is legacy because the file actually is a PGE Utility, and is served by the PGE repo, though it works entirely standalone as well.
@sardineghali
@sardineghali Жыл бұрын
I'm sorry Javid, but I won't be watching this one as I in the process of building something similar and don't want to be influenced by anyone's code. But thank you for sharing, welcome back to youtube, and I am definitely coming back to this later
@javidx9
@javidx9 11 ай бұрын
lol thanks buddy :D good luck with your project!
@山田ちゃん
@山田ちゃん 11 ай бұрын
This same technology is used in the metro UI rendering in windows. That way shapes can be clipped and filled by the GPU without the off screen parts. Very interesting that there is an open source library too now!
@shugyosha7924
@shugyosha7924 3 ай бұрын
Very cool!!
@Barnardrab
@Barnardrab 8 ай бұрын
Is there a Rust version of this library? I'd like to future proof my projects for when C becomes obsolete.
@musthavechannel5262
@musthavechannel5262 Жыл бұрын
Are there any videos this year javed 🤣🤣
@vincentcleaver1925
@vincentcleaver1925 Жыл бұрын
Javid is baaaaack!
@afailable
@afailable 11 ай бұрын
If I had the time, I would love to contribute. I might try to make some to help out.
@javidx9
@javidx9 11 ай бұрын
Its a big project, all contributions are welcome!
@yikaiguo4177
@yikaiguo4177 11 ай бұрын
Welcome back!
Coding Quickie: Handling Periodic Numbers with C++ Templates
17:13
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,6 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
Tinkering With Spirographs in C++
22:01
javidx9
Рет қаралды 24 М.
A simple procedural animation technique
8:31
argonaut
Рет қаралды 557 М.
Coding Quickie: Isometric Tiles
22:13
javidx9
Рет қаралды 121 М.
Harder Than It Seems? 5 Minute Timer in C++
20:10
The Cherno
Рет қаралды 226 М.
I Created a Game Engine Just to Optimise This
4:50
Vercidium
Рет қаралды 1,2 МЛН
The Magic of RISC-V Vector Processing
16:56
LaurieWired
Рет қаралды 352 М.
When Optimisations Work, But for the Wrong Reasons
22:19
SimonDev
Рет қаралды 1,2 МЛН
olc::AllSorts - Text/Commands/Sounds/Jams
21:55
javidx9
Рет қаралды 32 М.
The BEST Mechanical Display You've EVER Seen!!!
13:51
Tin Foil Hat
Рет қаралды 598 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН