Conversation
…and test coverage Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
|
@robmikh would you mind reviewing? I asked Copilot to review this crate and it came up with some improvements. I'm just not 100% sure they're all applicable. |
|
@copilot fix build breaks |
…n test crate Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
Fixed in c6d7ad4. Two issues:
|
|
I think neg makes sense for vectors, and having the cross product is handy for Vec3. But neg for the matrices doesn't make sense to me, I'm not sure when you'd ever use it. |
@copilot please work on this. |
Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
Done in df72c75 — removed |
|
Thanks Rob! |
What's this all about?
Bug fixes
matrix4x4.rs: Replace hardcoded3.141592654 / 180.0withdegree.to_radians()— idiomatic, self-documenting, and avoids literal driftlib.rs: Removeclippy::allfrom#![expect]— it was fulfilled by the old approximate PI literal triggeringclippy::approx_constant; after switching toto_radians()noclippy::alllints fire, so the expectation was unfulfilled and broke the clippy CI jobCargo.toml(test crate): Addfeatures = ["std"]to thewindows-numericsdependency —length,normalize, anddistanceare#[cfg(feature = "std")]gated, but the workspace default isdefault-features = false, causing test compilation failuresNew functionality
Neg(-x) unary operator added to the three vector types (Vector2,Vector3,Vector4), both owned and borrowed forms, matching the existing operator impl patternVector3::cross(&self, rhs: &Self) -> Self— the standard 3D cross-product was absentTest coverage
Previously only the four arithmetic operators were tested. Added coverage for:
dot,length,length_squared,normalize,distance,distance_squared— all vector typescrossincluding anti-commutativity (v2×v1 == -(v1×v2))Neg— all three vector types (Vector2,Vector3,Vector4)Matrix3x2constructors:identity,translation,scale,scale_aroundMatrix3x2 * identity == matrixidentity propertyMatrix4x4constructors:translation,perspective_projection(including zero/negative depth edge cases)🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.