From 099636cd7c116d4c20385dfdcfb2c20662cbc1aa Mon Sep 17 00:00:00 2001 From: ikpil Date: Tue, 4 Jun 2024 00:34:07 +0900 Subject: [PATCH] Removed RcVecUtils.Dot() --- CHANGELOG.md | 2 +- src/DotRecast.Core/Numerics/RcVecUtils.cs | 16 ---------------- .../Jumplink/ITrajectory.cs | 2 +- .../RcFilledVolumeRasterization.cs | 12 ++++++------ 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e46369b..a1e3524 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Nothing ### Removed -- Nothing +- Removed RcVecUtils.Dot() ### Special Thanks - [@Doprez](https://github.com/Doprez) diff --git a/src/DotRecast.Core/Numerics/RcVecUtils.cs b/src/DotRecast.Core/Numerics/RcVecUtils.cs index 68816b1..0dab29c 100644 --- a/src/DotRecast.Core/Numerics/RcVecUtils.cs +++ b/src/DotRecast.Core/Numerics/RcVecUtils.cs @@ -118,22 +118,6 @@ namespace DotRecast.Core.Numerics @out[n + 2] = @in[m + 2]; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float Dot(float[] v1, float[] v2) - { - return v1[0] * v2[0] + - v1[1] * v2[1] + - v1[2] * v2[2]; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float Dot(float[] v1, RcVec3f vector2) - { - return v1[0] * vector2.X + - v1[1] * vector2.Y + - v1[2] * vector2.Z; - } - /// Returns the distance between two points. /// @param[in] v1 A point. [(x, y, z)] /// @param[in] v2 A point. [(x, y, z)] diff --git a/src/DotRecast.Detour.Extras/Jumplink/ITrajectory.cs b/src/DotRecast.Detour.Extras/Jumplink/ITrajectory.cs index dfd04a5..9b9da62 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/ITrajectory.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/ITrajectory.cs @@ -5,6 +5,6 @@ namespace DotRecast.Detour.Extras.Jumplink { public interface ITrajectory { - public RcVec3f Apply(RcVec3f start, RcVec3f end, float u); + RcVec3f Apply(RcVec3f start, RcVec3f end, float u); } } \ No newline at end of file diff --git a/src/DotRecast.Recast/RcFilledVolumeRasterization.cs b/src/DotRecast.Recast/RcFilledVolumeRasterization.cs index 2ddacd4..fd558b2 100644 --- a/src/DotRecast.Recast/RcFilledVolumeRasterization.cs +++ b/src/DotRecast.Recast/RcFilledVolumeRasterization.cs @@ -525,7 +525,7 @@ namespace DotRecast.Recast { if (MathF.Abs(planes[j][1]) > EPSILON) { - float dotNormalPoint = RcVecUtils.Dot(planes[j], point); + float dotNormalPoint = RcVec3f.Dot(RcVecUtils.Create(planes[j]), point); float t = (planes[j][3] - dotNormalPoint) / planes[j][1]; float y = point.Y + t; bool valid = true; @@ -729,15 +729,15 @@ namespace DotRecast.Recast private static bool RayTriangleIntersection(RcVec3f point, int plane, float[][] planes, out float y) { y = 0.0f; - float t = (planes[plane][3] - RcVecUtils.Dot(planes[plane], point)) / planes[plane][1]; - float[] s = { point.X, point.Y + t, point.Z }; - float u = RcVecUtils.Dot(s, planes[plane + 1]) - planes[plane + 1][3]; + float t = (planes[plane][3] - RcVec3f.Dot(RcVecUtils.Create(planes[plane]), point)) / planes[plane][1]; + RcVec3f s = new RcVec3f(point.X, point.Y + t, point.Z); + float u = RcVec3f.Dot(s, RcVecUtils.Create(planes[plane + 1])) - planes[plane + 1][3]; if (u < 0.0f || u > 1.0f) { return false; } - float v = RcVecUtils.Dot(s, planes[plane + 2]) - planes[plane + 2][3]; + float v = RcVec3f.Dot(s, RcVecUtils.Create(planes[plane + 2])) - planes[plane + 2][3]; if (v < 0.0f) { return false; @@ -749,7 +749,7 @@ namespace DotRecast.Recast return false; } - y = s[1]; + y = s.Y; return true; }