Repository navigation
Nerd_STF v3.1.1
Hi there! I mostly just have a few tweaks for this release, stuff I wanted to get out now so I can use it in other projects. There's plenty more tweaks to come in the future, but who knows when that'll be. Before or after the next major release, I couldn't tell you.
This update mostly focuses on linear algebra tweaks. I was messing around with some code to experiment with homework, and I wanted to project one vector upon another. Sometimes they would be 2d vectors, sometimes 3d. Problem was, the IVectorOperations<T> interface was really lame and didn't let me do that sort of thing with constraints.
So I've fixed that. Here's the simple projection method I wrote. The mathematical formula for projecting a vector
T Project<T>(T vec, T onto) where T : IVector<T>
{
return onto * (T.Dot(vec, onto) / T.Dot(onto, onto));
}Nice and simple. It works for all vector types, meaning Float2, Float3, Float4, and even the int equivalents if you substitute IVector<T> with IVector<T, int>.
What else... oh right. ISplittable<T, TTuple> was completely redundant, and has always been redundant, thanks to System.Linq. For example, take a list of Float3s, and we want to separate the X components from the rest.
using System.Linq; // We need this or we'll get a weird compiler error.
List<Float3> items = [
(1, 2, 3),
(4, 5, 6),
(7, 8, 9)
];
double[] option1 = Float3.SplitArray(items).Xs; // We could do this and save all three variables in memory...
IEnumerable<double> option2 = from i in items select i.x; // Or we could do this.So I removed ISplittable. This is technically a breaking change, but I doubt anyone was using it in any serious measure. Sorry if I screwed up your code :(
One last thing, this is a matrix feature (man, I've had matrices in my head a lot this update) that has been missing in 3.x, casting FloatXs to matrices. Now Float2, Float3, and Float4s can all be implicitly converted to column vectors, making them easy to multiply with the general matrix class. I also apparently forgot to create casting from specialized matrix classes to the generalized one, so I also implemented that.
Anyway, that's it. Not a huge update, I only spent about an hour implementing these thingies. I'm not done with small stuff, but whether it'll come out before or after the next major update I couldn't say. Wait, didn't I just say that? Call me AI the way I repeat myself but slightly rephrase words.
On that note, don't worry. I never EVER use AI in this project for any reason whatsoever. It's a passion project, why would I delegate something I love making? But yeah, no AI-generated changelog, no @Copilot pull requests, and no AI agent or autocomplete, but you'll have to take my word on that one since you can't really see my development environment.
Anyway, I'm definitely sick and tired of the choice I made way back at the beginning of 3.0: putting ws as the first component in Float4s. What a terrible idea. I think I'm going to revert that soon. I just keep facepalming every time I see the scuff that gets caused by that design choice. Oopsies.
Take care, enjoy 3.1.1!