From da8bac596aa99d3e61974b4427ef49a0096c3361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=EC=B5=9C=EC=9D=B5=ED=95=84?= Date: Fri, 18 Aug 2023 14:04:56 +0900 Subject: [PATCH] [Upstream] Typo fixes (recastnavigation #660) --- .editorconfig | 3 + src/DotRecast.Detour.Crowd/DtCrowd.cs | 4 +- .../DtObstacleAvoidanceQuery.cs | 2 +- .../DtTileCacheBuilder.cs | 2 +- src/DotRecast.Detour/DtNavMeshBuilder.cs | 2 +- src/DotRecast.Detour/DtNavMeshCreateParams.cs | 68 ++++++------------- src/DotRecast.Detour/DtNavMeshQuery.cs | 28 ++++---- src/DotRecast.Detour/DtQueryDefaultFilter.cs | 6 +- src/DotRecast.Detour/DtQueryNoOpFilter.cs | 5 +- src/DotRecast.Recast/RecastBuilder.cs | 4 +- src/DotRecast.Recast/RecastContour.cs | 4 +- src/DotRecast.Recast/RecastFilter.cs | 2 +- src/DotRecast.Recast/RecastMesh.cs | 4 +- src/DotRecast.Recast/RecastMeshDetail.cs | 4 +- src/DotRecast.Recast/RecastRegion.cs | 6 +- .../RecastSoloMeshTest.cs | 4 +- 16 files changed, 61 insertions(+), 87 deletions(-) diff --git a/.editorconfig b/.editorconfig index a4a2f57..37ea066 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,3 +20,6 @@ dotnet_sort_system_directives_first = true csharp_preserve_single_line_statements = false csharp_preserve_single_line_blocks = true +# +resharper_csharp_space_before_trailing_comment = true +resharper_csharp_space_after_operator_keyword = true diff --git a/src/DotRecast.Detour.Crowd/DtCrowd.cs b/src/DotRecast.Detour.Crowd/DtCrowd.cs index e3165b5..2e02ef2 100644 --- a/src/DotRecast.Detour.Crowd/DtCrowd.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowd.cs @@ -91,7 +91,7 @@ namespace DotRecast.Detour.Crowd * @var dtCrowdAgentParams::pathOptimizationRange * @par * - * Only applicalbe if #updateFlags includes the #DT_CROWD_OPTIMIZE_VIS flag. + * Only applicable if #updateFlags includes the #DT_CROWD_OPTIMIZE_VIS flag. * * This value is often based on the agent radius. E.g. radius * 30 * @@ -235,7 +235,7 @@ namespace DotRecast.Detour.Crowd * @param pos * The requested position of the agent. [(x, y, z)] * @param params - * The configutation of the agent. + * The configuration of the agent. * @return The newly created agent object */ public DtCrowdAgent AddAgent(RcVec3f pos, DtCrowdAgentParams option) diff --git a/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs b/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs index 77bd898..d7df4bc 100644 --- a/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs +++ b/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs @@ -222,7 +222,7 @@ namespace DotRecast.Detour.Crowd float vcpen = m_params.weightCurVel * (RcVec3f.Dist2D(vcand, vel) * m_invVmax); // find the threshold hit time to bail out based on the early out penalty - // (see how the penalty is calculated below to understnad) + // (see how the penalty is calculated below to understand) float minPen = minPenalty - vpen - vcpen; float tThresold = (m_params.weightToi / minPen - 0.1f) * m_params.horizTime; if (tThresold - m_params.horizTime > -float.MinValue) diff --git a/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs b/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs index 6403f78..6169a94 100644 --- a/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs @@ -1005,7 +1005,7 @@ namespace DotRecast.Detour.TileCache } // Returns T iff (a,b,c) are collinear and point c lies - // on the closed segement ab. + // on the closed segment ab. private bool Between(int[] verts, int a, int b, int c) { if (!Collinear(verts, a, b, c)) diff --git a/src/DotRecast.Detour/DtNavMeshBuilder.cs b/src/DotRecast.Detour/DtNavMeshBuilder.cs index 9311fdf..8898012 100644 --- a/src/DotRecast.Detour/DtNavMeshBuilder.cs +++ b/src/DotRecast.Detour/DtNavMeshBuilder.cs @@ -345,7 +345,7 @@ namespace DotRecast.Detour } } - // Off-mesh connectionss are stored as polygons, adjust values. + // Off-mesh connections are stored as polygons, adjust values. int totPolyCount = option.polyCount + storedOffMeshConCount; int totVertCount = option.vertCount + storedOffMeshConCount * 2; diff --git a/src/DotRecast.Detour/DtNavMeshCreateParams.cs b/src/DotRecast.Detour/DtNavMeshCreateParams.cs index c09cb51..f50bc5e 100644 --- a/src/DotRecast.Detour/DtNavMeshCreateParams.cs +++ b/src/DotRecast.Detour/DtNavMeshCreateParams.cs @@ -23,52 +23,34 @@ using DotRecast.Core; namespace DotRecast.Detour { /// Represents the source data used to build an navigation mesh tile. + /// @ingroup detour public class DtNavMeshCreateParams { /// @name Polygon Mesh Attributes /// Used to create the base navigation graph. /// See #rcPolyMesh for details related to these attributes. /// @{ - public int[] verts; + public int[] verts; // < The polygon mesh vertices. [(x, y, z) * #vertCount] [Unit: vx] - /// < The polygon mesh vertices. [(x, y, z) * #vertCount] [Unit: vx] - public int vertCount; + public int vertCount; // < The number vertices in the polygon mesh. [Limit: >= 3] + public int[] polys; // < The polygon data. [Size: #polyCount * 2 * #nvp] + public int[] polyFlags; // < The user defined flags assigned to each polygon. [Size: #polyCount] + public int[] polyAreas; // < The user defined area ids assigned to each polygon. [Size: #polyCount] + public int polyCount; // < Number of polygons in the mesh. [Limit: >= 1] + public int nvp; // < Number maximum number of vertices per polygon. [Limit: >= 3] - /// < The number vertices in the polygon mesh. [Limit: >= 3] - public int[] polys; - - /// < The polygon data. [Size: #polyCount * 2 * #nvp] - public int[] polyFlags; - - /// < The user defined flags assigned to each polygon. [Size: #polyCount] - public int[] polyAreas; - - /// < The user defined area ids assigned to each polygon. [Size: #polyCount] - public int polyCount; - - /// < Number of polygons in the mesh. [Limit: >= 1] - public int nvp; - - /// < Number maximum number of vertices per polygon. [Limit: >= 3] /// @} /// @name Height Detail Attributes (Optional) /// See #rcPolyMeshDetail for details related to these attributes. /// @{ - public int[] detailMeshes; + /// + public int[] detailMeshes; // < The height detail sub-mesh data. [Size: 4 * #polyCount] - /// < The height detail sub-mesh data. [Size: 4 * #polyCount] - public float[] detailVerts; + public float[] detailVerts; // < The detail mesh vertices. [Size: 3 * #detailVertsCount] [Unit: wu] + public int detailVertsCount; // < The number of vertices in the detail mesh. + public int[] detailTris; // < The detail mesh triangles. [Size: 4 * #detailTriCount] + public int detailTriCount; // < The number of triangles in the detail mesh. - /// < The detail mesh vertices. [Size: 3 * #detailVertsCount] [Unit: wu] - public int detailVertsCount; - - /// < The number of vertices in the detail mesh. - public int[] detailTris; - - /// < The detail mesh triangles. [Size: 4 * #detailTriCount] - public int detailTriCount; - - /// < The number of triangles in the detail mesh. /// @} /// @name Off-Mesh Connections Attributes (Optional) /// Used to define a custom point-to-point edge within the navigation graph, an @@ -103,24 +85,14 @@ namespace DotRecast.Detour /// @name Tile Attributes /// @note The tile grid/layer data can be left at zero if the destination is a single tile mesh. /// @{ - public int userId; + public int userId; // < The user defined id of the tile. - /// < The user defined id of the tile. - public int tileX; + public int tileX; // < The tile's x-grid location within the multi-tile destination mesh. (Along the x-axis.) + public int tileZ; // < The tile's y-grid location within the multi-tile destination mesh. (Along the z-axis.) + public int tileLayer; // < The tile's layer within the layered destination mesh. [Limit: >= 0] (Along the y-axis.) + public RcVec3f bmin; // < The minimum bounds of the tile. [(x, y, z)] [Unit: wu] + public RcVec3f bmax; // < The maximum bounds of the tile. [(x, y, z)] [Unit: wu] - /// < The tile's x-grid location within the multi-tile destination mesh. (Along the x-axis.) - public int tileZ; - - /// < The tile's y-grid location within the multi-tile desitation mesh. (Along the z-axis.) - public int tileLayer; - - /// < The tile's layer within the layered destination mesh. [Limit: >= 0] (Along the y-axis.) - public RcVec3f bmin; - - /// < The minimum bounds of the tile. [(x, y, z)] [Unit: wu] - public RcVec3f bmax; - - /// < The maximum bounds of the tile. [(x, y, z)] [Unit: wu] /// @} /// @name General Configuration Attributes /// @{ diff --git a/src/DotRecast.Detour/DtNavMeshQuery.cs b/src/DotRecast.Detour/DtNavMeshQuery.cs index dafd1fe..8d8bcda 100644 --- a/src/DotRecast.Detour/DtNavMeshQuery.cs +++ b/src/DotRecast.Detour/DtNavMeshQuery.cs @@ -98,7 +98,7 @@ namespace DotRecast.Detour continue; } - // Choose random tile using reservoi sampling. + // Choose random tile using reservoir sampling. float area = 1.0f; // Could be tile area too. tsum += area; float u = frand.Next(); @@ -145,7 +145,7 @@ namespace DotRecast.Detour polyArea += DtUtils.TriArea2D(tile.data.verts, va, vb, vc); } - // Choose random polygon weighted by area, using reservoi sampling. + // Choose random polygon weighted by area, using reservoir sampling. areaSum += polyArea; float u = frand.Next(); if (u * areaSum <= polyArea) @@ -271,7 +271,7 @@ namespace DotRecast.Detour bestNode.flags &= ~DT_NODE_OPEN; bestNode.flags |= DT_NODE_CLOSED; // Get poly and tile. - // The API input has been cheked already, skip checking internal data. + // The API input has been checked already, skip checking internal data. long bestRef = bestNode.id; m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly); @@ -298,7 +298,7 @@ namespace DotRecast.Detour polyArea += DtUtils.TriArea2D(constrainedVerts, va, vb, vc); } - // Choose random polygon weighted by area, using reservoi sampling. + // Choose random polygon weighted by area, using reservoir sampling. areaSum += polyArea; float u = frand.Next(); if (u * areaSum <= polyArea) @@ -752,7 +752,7 @@ namespace DotRecast.Detour * The start and end positions are used to calculate traversal costs. (The y-values impact the result.) * * @param startRef - * The refrence id of the start polygon. + * The reference id of the start polygon. * @param endRef * The reference id of the end polygon. * @param startPos @@ -829,7 +829,7 @@ namespace DotRecast.Detour } // Get current poly and tile. - // The API input has been cheked already, skip checking internal data. + // The API input has been checked already, skip checking internal data. long bestRef = bestNode.id; m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly); @@ -875,7 +875,7 @@ namespace DotRecast.Detour } // Get neighbour poly and tile. - // The API input has been cheked already, skip checking internal data. + // The API input has been checked already, skip checking internal data. m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly); if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly)) @@ -1130,7 +1130,7 @@ namespace DotRecast.Detour } // Get current poly and tile. - // The API input has been cheked already, skip checking internal + // The API input has been checked already, skip checking internal // data. long bestRef = bestNode.id; var status = m_nav.GetTileAndPolyByRef(bestRef, out var bestTile, out var bestPoly); @@ -1194,7 +1194,7 @@ namespace DotRecast.Detour } // Get neighbour poly and tile. - // The API input has been cheked already, skip checking internal + // The API input has been checked already, skip checking internal // data. m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly); @@ -1840,7 +1840,7 @@ namespace DotRecast.Detour stack.RemoveFirst(); // Get poly and tile. - // The API input has been cheked already, skip checking internal data. + // The API input has been checked already, skip checking internal data. long curRef = curNode.id; m_nav.GetTileAndPolyByRefUnsafe(curRef, out var curTile, out var curPoly); @@ -2490,7 +2490,7 @@ namespace DotRecast.Detour bestNode.flags |= DtNode.DT_NODE_CLOSED; // Get poly and tile. - // The API input has been cheked already, skip checking internal data. + // The API input has been checked already, skip checking internal data. long bestRef = bestNode.id; m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly); @@ -2667,7 +2667,7 @@ namespace DotRecast.Detour bestNode.flags |= DtNode.DT_NODE_CLOSED; // Get poly and tile. - // The API input has been cheked already, skip checking internal data. + // The API input has been checked already, skip checking internal data. long bestRef = bestNode.id; m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly); @@ -2840,7 +2840,7 @@ namespace DotRecast.Detour stack.RemoveFirst(); // Get poly and tile. - // The API input has been cheked already, skip checking internal data. + // The API input has been checked already, skip checking internal data. long curRef = curNode.id; m_nav.GetTileAndPolyByRefUnsafe(curRef, out var curTile, out var curPoly); @@ -3170,7 +3170,7 @@ namespace DotRecast.Detour bestNode.flags |= DtNode.DT_NODE_CLOSED; // Get poly and tile. - // The API input has been cheked already, skip checking internal data. + // The API input has been checked already, skip checking internal data. long bestRef = bestNode.id; m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly); diff --git a/src/DotRecast.Detour/DtQueryDefaultFilter.cs b/src/DotRecast.Detour/DtQueryDefaultFilter.cs index 3ac0da1..6852ca6 100644 --- a/src/DotRecast.Detour/DtQueryDefaultFilter.cs +++ b/src/DotRecast.Detour/DtQueryDefaultFilter.cs @@ -50,9 +50,9 @@ namespace DotRecast.Detour */ public class DtQueryDefaultFilter : IDtQueryFilter { - private int m_excludeFlags; - private int m_includeFlags; - private readonly float[] m_areaCost = new float[DtNavMesh.DT_MAX_AREAS]; + private readonly float[] m_areaCost = new float[DtNavMesh.DT_MAX_AREAS]; //< Cost per area type. (Used by default implementation.) + private int m_includeFlags; //< Flags for polygons that can be visited. (Used by default implementation.) + private int m_excludeFlags; //< Flags for polygons that should not be visited. (Used by default implementation.) public DtQueryDefaultFilter() { diff --git a/src/DotRecast.Detour/DtQueryNoOpFilter.cs b/src/DotRecast.Detour/DtQueryNoOpFilter.cs index 058693e..c782583 100644 --- a/src/DotRecast.Detour/DtQueryNoOpFilter.cs +++ b/src/DotRecast.Detour/DtQueryNoOpFilter.cs @@ -5,12 +5,11 @@ namespace DotRecast.Detour public class DtQueryNoOpFilter : IDtQueryFilter { public static readonly DtQueryNoOpFilter Shared = new DtQueryNoOpFilter(); - + private DtQueryNoOpFilter() { - } - + public bool PassFilter(long refs, DtMeshTile tile, DtPoly poly) { return true; diff --git a/src/DotRecast.Recast/RecastBuilder.cs b/src/DotRecast.Recast/RecastBuilder.cs index 2a36c04..e13eb73 100644 --- a/src/DotRecast.Recast/RecastBuilder.cs +++ b/src/DotRecast.Recast/RecastBuilder.cs @@ -174,7 +174,7 @@ namespace DotRecast.Recast // Partition the heightfield so that we can use simple algorithm later // to triangulate the walkable areas. - // There are 3 martitioning methods, each with some pros and cons: + // There are 3 partitioning methods, each with some pros and cons: // 1) Watershed partitioning // - the classic Recast partitioning // - creates the nicest tessellation @@ -187,7 +187,7 @@ namespace DotRecast.Recast // (triangulation can handle this) // - overlaps may occur if you have narrow spiral corridors (i.e // stairs), this make triangulation to fail - // * generally the best choice if you precompute the nacmesh, use this + // * generally the best choice if you precompute the navmesh, use this // if you have large open areas // 2) Monotone partioning // - fastest diff --git a/src/DotRecast.Recast/RecastContour.cs b/src/DotRecast.Recast/RecastContour.cs index dd84a87..48488d9 100644 --- a/src/DotRecast.Recast/RecastContour.cs +++ b/src/DotRecast.Recast/RecastContour.cs @@ -407,7 +407,7 @@ namespace DotRecast.Recast if (dx * dx + dz * dz > maxEdgeLen * maxEdgeLen) { // Round based on the segments in lexilogical order so that the - // max tesselation is consistent regardles in which direction + // max tesselation is consistent regardless in which direction // segments are traversed. int n = bi < ai ? (bi + pn - ai) : (bi - ai); if (n > 1) @@ -643,7 +643,7 @@ namespace DotRecast.Recast for (int iter = 0; iter < hole.nverts; iter++) { // Find potential diagonals. - // The 'best' vertex must be in the cone described by 3 cosequtive vertices of the outline. + // The 'best' vertex must be in the cone described by 3 consecutive vertices of the outline. // ..o j-1 // | // | * best diff --git a/src/DotRecast.Recast/RecastFilter.cs b/src/DotRecast.Recast/RecastFilter.cs index 821d074..1e48f1b 100644 --- a/src/DotRecast.Recast/RecastFilter.cs +++ b/src/DotRecast.Recast/RecastFilter.cs @@ -32,7 +32,7 @@ namespace DotRecast.Recast /// Allows the formation of walkable regions that will flow over low lying /// objects such as curbs, and up structures such as stairways. /// - /// Two neighboring spans are walkable if: RcAbs(currentSpan.smax - neighborSpan.smax) < waklableClimb + /// Two neighboring spans are walkable if: RcAbs(currentSpan.smax - neighborSpan.smax) < walkableClimb /// /// @warning Will override the effect of #rcFilterLedgeSpans. So if both filters are used, call /// #rcFilterLedgeSpans after calling this filter. diff --git a/src/DotRecast.Recast/RecastMesh.cs b/src/DotRecast.Recast/RecastMesh.cs index efff93e..d34d47a 100644 --- a/src/DotRecast.Recast/RecastMesh.cs +++ b/src/DotRecast.Recast/RecastMesh.cs @@ -199,7 +199,7 @@ namespace DotRecast.Recast } // Returns T iff (a,b,c) are collinear and point c lies - // on the closed segement ab. + // on the closed segment ab. private static bool Between(int[] verts, int a, int b, int c) { if (!Collinear(verts, a, b, c)) @@ -961,7 +961,7 @@ namespace DotRecast.Recast /// @par /// /// @note If the mesh data is to be used to construct a Detour navigation mesh, then the upper - /// limit must be retricted to <= #DT_VERTS_PER_POLYGON. + /// limit must be restricted to <= #DT_VERTS_PER_POLYGON. /// /// @see rcAllocPolyMesh, rcContourSet, rcPolyMesh, rcConfig public static RcPolyMesh BuildPolyMesh(RcTelemetry ctx, RcContourSet cset, int nvp) diff --git a/src/DotRecast.Recast/RecastMeshDetail.cs b/src/DotRecast.Recast/RecastMeshDetail.cs index 811991f..b8a3e3e 100644 --- a/src/DotRecast.Recast/RecastMeshDetail.cs +++ b/src/DotRecast.Recast/RecastMeshDetail.cs @@ -787,8 +787,8 @@ namespace DotRecast.Recast // Triangulate the polygon by moving left or right, // depending on which triangle has shorter perimeter. - // This heuristic was chose emprically, since it seems - // handle tesselated straight edges well. + // This heuristic was chose empirically, since it seems + // handle tessellated straight edges well. while (RecastMesh.Next(left, nhull) != right) { // Check to see if se should advance left or right. diff --git a/src/DotRecast.Recast/RecastRegion.cs b/src/DotRecast.Recast/RecastRegion.cs index 9c3a4c6..cb00d5e 100644 --- a/src/DotRecast.Recast/RecastRegion.cs +++ b/src/DotRecast.Recast/RecastRegion.cs @@ -1466,7 +1466,7 @@ namespace DotRecast.Recast /// re-assigned to the zero (null) region. /// /// Partitioning can result in smaller than necessary regions. @p mergeRegionArea helps - /// reduce unecessarily small regions. + /// reduce unnecessarily small regions. /// /// See the #rcConfig documentation for more information on the configuration parameters. /// @@ -1645,7 +1645,7 @@ namespace DotRecast.Recast /// re-assigned to the zero (null) region. /// /// Watershed partitioning can result in smaller than necessary regions, especially in diagonal corridors. - /// @p mergeRegionArea helps reduce unecessarily small regions. + /// @p mergeRegionArea helps reduce unnecessarily small regions. /// /// See the #rcConfig documentation for more information on the configuration parameters. /// @@ -1759,7 +1759,7 @@ namespace DotRecast.Recast ctx.StartTimer(RcTimerLabel.RC_TIMER_BUILD_REGIONS_FILTER); - // Merge regions and filter out smalle regions. + // Merge regions and filter out small regions. List overlaps = new List(); chf.maxRegions = MergeAndFilterRegions(ctx, minRegionArea, mergeRegionArea, regionId, chf, srcReg, overlaps); diff --git a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs index 3d075fa..e84b0dd 100644 --- a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs @@ -169,7 +169,7 @@ public class RecastSoloMeshTest // Partition the heightfield so that we can use simple algorithm later // to triangulate the walkable areas. - // There are 3 martitioning methods, each with some pros and cons: + // There are 3 partitioning methods, each with some pros and cons: // 1) Watershed partitioning // - the classic Recast partitioning // - creates the nicest tessellation @@ -182,7 +182,7 @@ public class RecastSoloMeshTest // (triangulation can handle this) // - overlaps may occur if you have narrow spiral corridors (i.e // stairs), this make triangulation to fail - // * generally the best choice if you precompute the nacmesh, use this + // * generally the best choice if you precompute the navmesh, use this // if you have large open areas // 2) Monotone partioning // - fastest