forked from mirror/DotRecast
[개발/최익필] new float[] -> Vector3f
This commit is contained in:
parent
dfafb03103
commit
c388e8087b
|
@ -33,8 +33,8 @@ namespace DotRecast.Core
|
|||
int hull = 0;
|
||||
for (int i = 1; i < npts; ++i)
|
||||
{
|
||||
float[] a = new float[] { pts[i * 3], pts[i * 3 + 1], pts[i * 3 + 2] };
|
||||
float[] b = new float[] { pts[hull * 3], pts[hull * 3 + 1], pts[hull * 3 + 2] };
|
||||
Vector3f a = Vector3f.Of(pts[i * 3], pts[i * 3 + 1], pts[i * 3 + 2]);
|
||||
Vector3f b = Vector3f.Of(pts[hull * 3], pts[hull * 3 + 1], pts[hull * 3 + 2]);
|
||||
if (cmppt(a, b))
|
||||
{
|
||||
hull = i;
|
||||
|
@ -49,9 +49,9 @@ namespace DotRecast.Core
|
|||
endpt = 0;
|
||||
for (int j = 1; j < npts; ++j)
|
||||
{
|
||||
float[] a = new float[] { pts[hull * 3], pts[hull * 3 + 1], pts[hull * 3 + 2] };
|
||||
float[] b = new float[] { pts[endpt * 3], pts[endpt * 3 + 1], pts[endpt * 3 + 2] };
|
||||
float[] c = new float[] { pts[j * 3], pts[j * 3 + 1], pts[j * 3 + 2] };
|
||||
Vector3f a = Vector3f.Of(pts[hull * 3], pts[hull * 3 + 1], pts[hull * 3 + 2]);
|
||||
Vector3f b = Vector3f.Of(pts[endpt * 3], pts[endpt * 3 + 1], pts[endpt * 3 + 2]);
|
||||
Vector3f c = Vector3f.Of(pts[j * 3], pts[j * 3 + 1], pts[j * 3 + 2]);
|
||||
if (hull == endpt || left(a, b, c))
|
||||
{
|
||||
endpt = j;
|
||||
|
@ -65,7 +65,7 @@ namespace DotRecast.Core
|
|||
}
|
||||
|
||||
// Returns true if 'a' is more lower-left than 'b'.
|
||||
private static bool cmppt(float[] a, float[] b)
|
||||
private static bool cmppt(Vector3f a, Vector3f b)
|
||||
{
|
||||
if (a[0] < b[0])
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ namespace DotRecast.Core
|
|||
}
|
||||
|
||||
// Returns true if 'c' is left of line 'a'-'b'.
|
||||
private static bool left(float[] a, float[] b, float[] c)
|
||||
private static bool left(Vector3f a, Vector3f b, Vector3f c)
|
||||
{
|
||||
float u1 = b[0] - a[0];
|
||||
float v1 = b[2] - a[2];
|
||||
|
|
|
@ -455,7 +455,7 @@ namespace DotRecast.Core
|
|||
}
|
||||
|
||||
|
||||
public static float vDot2D(float[] u, float[] v, int vi)
|
||||
public static float vDot2D(Vector3f u, float[] v, int vi)
|
||||
{
|
||||
return u[0] * v[vi] + u[2] * v[vi + 2];
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ namespace DotRecast.Core
|
|||
return c;
|
||||
}
|
||||
|
||||
public static float[] projectPoly(float[] axis, float[] poly, int npoly)
|
||||
public static float[] projectPoly(Vector3f axis, float[] poly, int npoly)
|
||||
{
|
||||
float rmin, rmax;
|
||||
rmin = rmax = vDot2D(axis, poly, 0);
|
||||
|
@ -702,7 +702,7 @@ namespace DotRecast.Core
|
|||
int va = j * 3;
|
||||
int vb = i * 3;
|
||||
|
||||
float[] n = new float[] { polya[vb + 2] - polya[va + 2], 0, -(polya[vb + 0] - polya[va + 0]) };
|
||||
Vector3f n = Vector3f.Of(polya[vb + 2] - polya[va + 2], 0, -(polya[vb + 0] - polya[va + 0]));
|
||||
|
||||
float[] aminmax = projectPoly(n, polya, npolya);
|
||||
float[] bminmax = projectPoly(n, polyb, npolyb);
|
||||
|
@ -718,7 +718,7 @@ namespace DotRecast.Core
|
|||
int va = j * 3;
|
||||
int vb = i * 3;
|
||||
|
||||
float[] n = new float[] { polyb[vb + 2] - polyb[va + 2], 0, -(polyb[vb + 0] - polyb[va + 0]) };
|
||||
Vector3f n = Vector3f.Of(polyb[vb + 2] - polyb[va + 2], 0, -(polyb[vb + 0] - polyb[va + 0]));
|
||||
|
||||
float[] aminmax = projectPoly(n, polya, npolya);
|
||||
float[] bminmax = projectPoly(n, polyb, npolyb);
|
||||
|
|
Loading…
Reference in New Issue