Not being able to sleep tonight, you crawl into your nerdy programmer boyfriend's study to sit and listen to him work on his project.
Oh hi babe couldn't sleep yeah I got a sudden spark of inspiration and I just couldn't let it go tonight I decided I get at least a rudimentary part of this all great and done you to sleep in here with me it's not exactly comfy here in my study. Are you sure? Won't you be more comfortable in the bed? No? I guess your standard for comfy are a bit different than mine.
You're welcome to stay baby. Of course you are. I won't be master entertainment though it's a pretty specific programming task that I'm doing so I hope that's all right you just want to sit here for the company oh baby you're just too sweet I love you all right I'm about halfway there.
Want me to try to explain it to you? I'm doing computational geometry again. You know it's my favorite topic.
This task in particular is to create a convex hull so basically I have this set of random points and imagine it's just a big cloud of like 512 points that's a power of 2 number by the way so it's 2 to the 9th which means I can divide it nine times before I have to introduce decimals and computers like to operate on nice whole integers for the most part even fractions are expressed as ones and zeros anyway that means I can split some of the parts and two different cores and you can your computer so the computer can multitask instead of doing it all in a single core and you're following along? It takes some getting into to understand it. I wouldn't really expect anyone to understand my wishy-washy explanation.
I wouldn't exactly say this is an easy algorithm to understand and implement either and certainly not an optimizing and updating when introducing new points and. .. Do you still want to hear me rambling along? Okay then, baby.
Anyway, imagine all of those random points. I'm doing this in 2D because everything tends to be easier on the plane rather than in 3D space. At least for now.
What I'm doing is to find the subset of points that are on the outer edge of this collection of points. That's what's called the convex hull. It's convex because it just kind of bulges out everywhere.
There's no indentations in it. And hull because it's hollow? I don't know.
But it helps with collision detection in some cases. So simulations really benefit from this. But I'm really just doing it for the practice.
At least for now. I am using what's called the graham scan algorithm for this. And there are other ways of doing it, but I thought this one looked kind of easiest to understand for my brain.
So this algorithm first needs me to sort all of these points polarly, which means that they are arranged as a kind of a clock hand sweep. It doesn't matter which direction it is. But I'll choose counterclockwise since I'm assuming this is a right-handed coordinate system.
That's a whole other discussion, but I'll save that rant for some other time if you want to hear it. Well, so I got these points sorted. I checked that earlier before I came in.
Now all I need is to do the snakey motion thing part of the algorithm. Sort of like sewing a thread along those points in order. So I take three at a time.
As long as I keep turning left, I'm all good. But the moment I have to turn right, I know I've discovered a hole or an indentation in the shape. And it's no longer convex, so then I have to undo my turning movements and skip to the last one to see if that one is a better fit.
Usually the majority of points aren't included in the convex hole. Imagine 512 random points. How many of them are, like, on the outside? Not many.
So most likely there will be a lot of snaking around and reverting the path until I find one that goes around. I'm currently working on implementing this part of the algorithm. I've been struggling with how to manage the stack of indices in the array of points to skip over.
It seems to include a lot of points that shouldn't be in there. That's a bug, in case you didn't notice. Oh baby, hey, you look so cute over there.
Am I overloading you just as you're going to sleep? It's okay. All right, I'll just continue debugging this algorithm for a while until you fall asleep, okay? You can sleep right there.
I'll make sure that you're taken care of and I'll make sure you're in a good position when you're falling asleep, okay? I love you, baby. Sleep well.
Okay, so we've got complex, duals, vector 2, vector 3, vector 4, quaternion, dual quaternion, matrix 2, matrix 3, matrix 4. Do I need any more dual matrix? Nah, I don't think so.
Where's the slurp? Oh, okay, oh, yeah. How about now? Darius? Hang on, maybe I should slurp.
Maybe that's just a normal lurp. What am I doing? I don't need to lurp.
Yeah, I'm not moving the points. Oh, what if they're coplanar? Oh, no, I gotta have tolerance.
Oh, no, but I gotta save the tolerance, too. Hang on. Okay, I'll.
..