From c1c535641c97d9078f98050f50be5599b4f8ed76 Mon Sep 17 00:00:00 2001 From: ikpil Date: Wed, 5 Apr 2023 17:33:36 +0900 Subject: [PATCH] remove Vector2f.SetElement --- src/DotRecast.Core/Vector2f.cs | 20 ------------------- .../Geom/ChunkyTriMesh.cs | 12 +++++------ src/DotRecast.Recast/Geom/ChunkyTriMesh.cs | 12 +++++------ 3 files changed, 12 insertions(+), 32 deletions(-) diff --git a/src/DotRecast.Core/Vector2f.cs b/src/DotRecast.Core/Vector2f.cs index e743569..c2a745d 100644 --- a/src/DotRecast.Core/Vector2f.cs +++ b/src/DotRecast.Core/Vector2f.cs @@ -6,25 +6,5 @@ namespace DotRecast.Core { public float x; public float y; - - public float this[int index] - { - set => SetElement(index, value); - } - - public void SetElement(int index, float value) - { - switch (index) - { - case 0: - x = value; - break; - case 1: - y = value; - break; - - default: throw new IndexOutOfRangeException($"{index}-{value}"); - } - } } } \ No newline at end of file diff --git a/src/DotRecast.Recast.Demo/Geom/ChunkyTriMesh.cs b/src/DotRecast.Recast.Demo/Geom/ChunkyTriMesh.cs index c39fe57..d64ed1f 100644 --- a/src/DotRecast.Recast.Demo/Geom/ChunkyTriMesh.cs +++ b/src/DotRecast.Recast.Demo/Geom/ChunkyTriMesh.cs @@ -140,29 +140,29 @@ public class ChunkyTriMesh BoundsItem it = items[i] = new BoundsItem(); it.i = i; // Calc triangle XZ bounds. - it.bmin[0] = it.bmax[0] = verts[tris[t] * 3 + 0]; - it.bmin[1] = it.bmax[1] = verts[tris[t] * 3 + 2]; + it.bmin.x = it.bmax.x = verts[tris[t] * 3 + 0]; + it.bmin.y = it.bmax.y = verts[tris[t] * 3 + 2]; for (int j = 1; j < 3; ++j) { int v = tris[t + j] * 3; if (verts[v] < it.bmin.x) { - it.bmin[0] = verts[v]; + it.bmin.x = verts[v]; } if (verts[v + 2] < it.bmin.y) { - it.bmin[1] = verts[v + 2]; + it.bmin.y = verts[v + 2]; } if (verts[v] > it.bmax.x) { - it.bmax[0] = verts[v]; + it.bmax.x = verts[v]; } if (verts[v + 2] > it.bmax.y) { - it.bmax[1] = verts[v + 2]; + it.bmax.y = verts[v + 2]; } } } diff --git a/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs b/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs index ed432c5..74aa064 100644 --- a/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs +++ b/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs @@ -163,29 +163,29 @@ namespace DotRecast.Recast.Geom BoundsItem it = items[i] = new BoundsItem(); it.i = i; // Calc triangle XZ bounds. - it.bmin[0] = it.bmax[0] = verts[tris[t] * 3 + 0]; - it.bmin[1] = it.bmax[1] = verts[tris[t] * 3 + 2]; + it.bmin.x = it.bmax.x = verts[tris[t] * 3 + 0]; + it.bmin.y = it.bmax.y = verts[tris[t] * 3 + 2]; for (int j = 1; j < 3; ++j) { int v = tris[t + j] * 3; if (verts[v] < it.bmin.x) { - it.bmin[0] = verts[v]; + it.bmin.x = verts[v]; } if (verts[v + 2] < it.bmin.y) { - it.bmin[1] = verts[v + 2]; + it.bmin.y = verts[v + 2]; } if (verts[v] > it.bmax.x) { - it.bmax[0] = verts[v]; + it.bmax.x = verts[v]; } if (verts[v + 2] > it.bmax.y) { - it.bmax[1] = verts[v + 2]; + it.bmax.y = verts[v + 2]; } } }