diff --git a/src/DotRecast.Detour/DtNavMeshQuery.cs b/src/DotRecast.Detour/DtNavMeshQuery.cs index c6ab7c0..9f3f9d7 100644 --- a/src/DotRecast.Detour/DtNavMeshQuery.cs +++ b/src/DotRecast.Detour/DtNavMeshQuery.cs @@ -202,7 +202,7 @@ namespace DotRecast.Detour public DtStatus FindRandomPointAroundCircle(long startRef, RcVec3f centerPos, float maxRadius, IDtQueryFilter filter, IRcRand frand, out long randomRef, out RcVec3f randomPt) { - return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, NoOpPolygonByCircleConstraint.Noop, out randomRef, out randomPt); + return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, DtNoOpDtPolygonByCircleConstraint.Noop, out randomRef, out randomPt); } /** @@ -223,11 +223,11 @@ namespace DotRecast.Detour public DtStatus FindRandomPointWithinCircle(long startRef, RcVec3f centerPos, float maxRadius, IDtQueryFilter filter, IRcRand frand, out long randomRef, out RcVec3f randomPt) { - return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, StrictPolygonByCircleConstraint.Strict, out randomRef, out randomPt); + return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, DtStrictDtPolygonByCircleConstraint.Strict, out randomRef, out randomPt); } public DtStatus FindRandomPointAroundCircle(long startRef, RcVec3f centerPos, float maxRadius, - IDtQueryFilter filter, IRcRand frand, IPolygonByCircleConstraint constraint, + IDtQueryFilter filter, IRcRand frand, IDtPolygonByCircleConstraint constraint, out long randomRef, out RcVec3f randomPt) { randomRef = startRef; diff --git a/src/DotRecast.Detour/DtNoOpDtPolygonByCircleConstraint.cs b/src/DotRecast.Detour/DtNoOpDtPolygonByCircleConstraint.cs new file mode 100644 index 0000000..b938dc1 --- /dev/null +++ b/src/DotRecast.Detour/DtNoOpDtPolygonByCircleConstraint.cs @@ -0,0 +1,18 @@ +using DotRecast.Core; + +namespace DotRecast.Detour +{ + public class DtNoOpDtPolygonByCircleConstraint : IDtPolygonByCircleConstraint + { + public static readonly DtNoOpDtPolygonByCircleConstraint Noop = new DtNoOpDtPolygonByCircleConstraint(); + + private DtNoOpDtPolygonByCircleConstraint() + { + } + + public float[] Apply(float[] polyVerts, RcVec3f circleCenter, float radius) + { + return polyVerts; + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Detour/StrictPolygonByCircleConstraint.cs b/src/DotRecast.Detour/DtStrictDtPolygonByCircleConstraint.cs similarity index 89% rename from src/DotRecast.Detour/StrictPolygonByCircleConstraint.cs rename to src/DotRecast.Detour/DtStrictDtPolygonByCircleConstraint.cs index 59de356..86ae5be 100644 --- a/src/DotRecast.Detour/StrictPolygonByCircleConstraint.cs +++ b/src/DotRecast.Detour/DtStrictDtPolygonByCircleConstraint.cs @@ -6,14 +6,14 @@ namespace DotRecast.Detour /** * Calculate the intersection between a polygon and a circle. A dodecagon is used as an approximation of the circle. */ - public class StrictPolygonByCircleConstraint : IPolygonByCircleConstraint + public class DtStrictDtPolygonByCircleConstraint : IDtPolygonByCircleConstraint { private const int CIRCLE_SEGMENTS = 12; private static readonly float[] UnitCircle = MakeUnitCircle(); - public static readonly IPolygonByCircleConstraint Strict = new StrictPolygonByCircleConstraint(); + public static readonly IDtPolygonByCircleConstraint Strict = new DtStrictDtPolygonByCircleConstraint(); - private StrictPolygonByCircleConstraint() + private DtStrictDtPolygonByCircleConstraint() { } diff --git a/src/DotRecast.Detour/IPolygonByCircleConstraint.cs b/src/DotRecast.Detour/IDtPolygonByCircleConstraint.cs similarity index 95% rename from src/DotRecast.Detour/IPolygonByCircleConstraint.cs rename to src/DotRecast.Detour/IDtPolygonByCircleConstraint.cs index 4855429..e50ecf5 100644 --- a/src/DotRecast.Detour/IPolygonByCircleConstraint.cs +++ b/src/DotRecast.Detour/IDtPolygonByCircleConstraint.cs @@ -21,7 +21,7 @@ using DotRecast.Core; namespace DotRecast.Detour { - public interface IPolygonByCircleConstraint + public interface IDtPolygonByCircleConstraint { float[] Apply(float[] polyVerts, RcVec3f circleCenter, float radius); } diff --git a/src/DotRecast.Detour/NoOpPolygonByCircleConstraint.cs b/src/DotRecast.Detour/NoOpPolygonByCircleConstraint.cs deleted file mode 100644 index 2238024..0000000 --- a/src/DotRecast.Detour/NoOpPolygonByCircleConstraint.cs +++ /dev/null @@ -1,18 +0,0 @@ -using DotRecast.Core; - -namespace DotRecast.Detour -{ - public class NoOpPolygonByCircleConstraint : IPolygonByCircleConstraint - { - public static readonly NoOpPolygonByCircleConstraint Noop = new NoOpPolygonByCircleConstraint(); - - private NoOpPolygonByCircleConstraint() - { - } - - public float[] Apply(float[] polyVerts, RcVec3f circleCenter, float radius) - { - return polyVerts; - } - } -} \ No newline at end of file diff --git a/src/DotRecast.Recast.DemoTool/Tools/TestNavmeshToolImpl.cs b/src/DotRecast.Recast.DemoTool/Tools/TestNavmeshToolImpl.cs index 19da000..6d7187a 100644 --- a/src/DotRecast.Recast.DemoTool/Tools/TestNavmeshToolImpl.cs +++ b/src/DotRecast.Recast.DemoTool/Tools/TestNavmeshToolImpl.cs @@ -297,9 +297,9 @@ namespace DotRecast.Recast.DemoTool.Tools float dz = epos.z - spos.z; float dist = (float)Math.Sqrt(dx * dx + dz * dz); - IPolygonByCircleConstraint constraint = constrainByCircle - ? StrictPolygonByCircleConstraint.Strict - : NoOpPolygonByCircleConstraint.Noop; + IDtPolygonByCircleConstraint constraint = constrainByCircle + ? DtStrictDtPolygonByCircleConstraint.Strict + : DtNoOpDtPolygonByCircleConstraint.Noop; var frand = new FRand(); var navQuery = _sample.GetNavMeshQuery(); diff --git a/test/DotRecast.Detour.Test/PolygonByCircleConstraintTest.cs b/test/DotRecast.Detour.Test/PolygonByCircleConstraintTest.cs index df356ac..a968e65 100644 --- a/test/DotRecast.Detour.Test/PolygonByCircleConstraintTest.cs +++ b/test/DotRecast.Detour.Test/PolygonByCircleConstraintTest.cs @@ -24,7 +24,7 @@ namespace DotRecast.Detour.Test; [Parallelizable] public class PolygonByCircleConstraintTest { - private readonly IPolygonByCircleConstraint _constraint = StrictPolygonByCircleConstraint.Strict; + private readonly IDtPolygonByCircleConstraint _constraint = DtStrictDtPolygonByCircleConstraint.Strict; [Test] public void ShouldHandlePolygonFullyInsideCircle()