From 4199d1fcca55dbde9550a8ac11f74007fadcd59f Mon Sep 17 00:00:00 2001 From: "SND\\xToast_cp" Date: Thu, 3 Nov 2011 20:28:32 +0000 Subject: [PATCH] Added and extended different Unit-Tests --- .../ANX.Framework.TestCenter.csproj | 2 + .../Strukturen/BoundingBoxTest.cs | 451 +++++++++++++++++ .../Strukturen/BoundingSphereTest.cs | 460 ++++++++++++++++++ .../Strukturen/ColorTest.cs | 437 +++++++++++++++++ .../Strukturen/PointTests.cs | 11 + .../Strukturen/Vector4Test.cs | 2 +- ANX.Framework/BoundingFrustum.cs | 19 +- 7 files changed, 1376 insertions(+), 6 deletions(-) create mode 100644 ANX.Framework.TestCenter/Strukturen/BoundingBoxTest.cs create mode 100644 ANX.Framework.TestCenter/Strukturen/BoundingSphereTest.cs create mode 100644 ANX.Framework.TestCenter/Strukturen/ColorTest.cs create mode 100644 ANX.Framework.TestCenter/Strukturen/PointTests.cs diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj index 34e75541..6a74311c 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj @@ -59,7 +59,9 @@ + + diff --git a/ANX.Framework.TestCenter/Strukturen/BoundingBoxTest.cs b/ANX.Framework.TestCenter/Strukturen/BoundingBoxTest.cs new file mode 100644 index 00000000..aa9d3b83 --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/BoundingBoxTest.cs @@ -0,0 +1,451 @@ +#region UsingStatements +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +#endregion + +#region License + +// +// This file is part of the ANX.Framework created by the "ANX.Framework developer group". +// +// This file is released under the Ms-PL license. +// +// +// +// Microsoft Public License (Ms-PL) +// +// This license governs use of the accompanying software. If you use the software, you accept this license. +// If you do not accept the license, do not use the software. +// +// 1.Definitions +// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning +// here as under U.S. copyright law. +// A "contribution" is the original software, or any additions or changes to the software. +// A "contributor" is any person that distributes its contribution under this license. +// "Licensed patents" are a contributor's patent claims that read directly on its contribution. +// +// 2.Grant of Rights +// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations +// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to +// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution +// or any derivative works that you create. +// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in +// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed +// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution +// in the software or derivative works of the contribution in the software. +// +// 3.Conditions and Limitations +// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your +// patent license from such contributor to the software ends automatically. +// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution +// notices that are present in the software. +// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including +// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or +// object code form, you may only do so under a license that complies with this license. +// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, +// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the +// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a +// particular purpose and non-infringement. + +#endregion // License + +using XNABoundingBox = Microsoft.Xna.Framework.BoundingBox; +using XNAVector3 = Microsoft.Xna.Framework.Vector3; +using ANXBoundingBox = ANX.Framework.BoundingBox; +using ANXVector3 = ANX.Framework.Vector3; + +using NUnit.Framework; + +namespace ANX.Framework.TestCenter.Strukturen +{ + [TestFixture] + class BoundingBoxTest + { + #region Helper + private static Random r = new Random(); + + public static float RandomFloat + { + get { return (float)(r.NextDouble()); } + } + + static object[] sixfloat = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + }; + + static object[] ninefloat = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + }; + + static object[] tenfloat = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + }; + + static object[] twelvefloat = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + }; + + static object[] twentytwofloat = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + }; + + private void ConvertEquals(XNABoundingBox xna, ANXBoundingBox anx, String test) + { + if (xna.Min.X == anx.Min.X && + xna.Min.Y == anx.Min.Y && + xna.Min.Z == anx.Min.Z && + xna.Max.X == anx.Max.X && + xna.Max.Y == anx.Max.Y && + xna.Max.Z == anx.Max.Z) + { + Assert.Pass(test + " passed"); + } + else + { + Assert.Fail(String.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString())); + } + } + #endregion + + #region Constructors + [Test] + public void constructor0() + { + XNABoundingBox xna = new XNABoundingBox(); + + ANXBoundingBox anx = new ANXBoundingBox(); + + ConvertEquals(xna, anx, "constructor0"); + } + + [Test, TestCaseSource("sixfloat")] + public void constructor1(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax) + { + XNABoundingBox xna = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + + ANXBoundingBox anx = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + + ConvertEquals(xna, anx, "constructor0"); + } + #endregion + + #region Methods + [Test, TestCaseSource("twelvefloat")] + public void ContainsBoundingBox( + float xMin1, float yMin1, float zMin1, float xMax1, float yMax1, float zMax1, + float xRay, float yRay, float zRay, float xDir, float yDir, float zDir) + { + XNABoundingBox xnaBox1 = new XNABoundingBox(new XNAVector3(xMin1, yMin1, zMin1), new XNAVector3(xMax1, yMax1, zMax1)); + XNABoundingBox xnaBox2 = new XNABoundingBox(new XNAVector3(xRay, yRay, zRay), new XNAVector3(xDir, yDir, zDir)); + + ANXBoundingBox anxBox1 = new ANXBoundingBox(new ANXVector3(xMin1, yMin1, zMin1), new ANXVector3(xMax1, yMax1, zMax1)); + ANXBoundingBox anxBox2 = new ANXBoundingBox(new ANXVector3(xRay, yRay, zRay), new ANXVector3(xDir, yDir, zDir)); + + Microsoft.Xna.Framework.ContainmentType containsXNA = xnaBox1.Contains(xnaBox2); + ANX.Framework.ContainmentType containsANX = anxBox1.Contains(anxBox2); + + if (containsXNA.Equals(containsANX)) + Assert.Pass("ContainsBoundingBox passed"); + else + Assert.Fail(String.Format("ContainsBoundingBox failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("twentytwofloat")] + public void ContainsBoundingFrustum(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, + float xMin, float yMin, float zMin, float xMax, float yMax, float zMax) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + Microsoft.Xna.Framework.Matrix xnaMatrix = new Microsoft.Xna.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + Microsoft.Xna.Framework.BoundingFrustum xnaFrustum = new Microsoft.Xna.Framework.BoundingFrustum(xnaMatrix); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + ANX.Framework.Matrix anxMatrix = new ANX.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + ANX.Framework.BoundingFrustum anxFrustum = new ANX.Framework.BoundingFrustum(anxMatrix); + + Microsoft.Xna.Framework.ContainmentType containsXNA = xnaBox.Contains(xnaFrustum); + ANX.Framework.ContainmentType containsANX = anxBox.Contains(anxFrustum); + + if (containsXNA.Equals(containsANX)) + Assert.Pass("ContainsBoundingFrustum passed"); + else + Assert.Fail(String.Format("ContainsBoundingFrustum failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("tenfloat")] + public void ContainsBoundingSphere(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, float xS, float yS, float zS, float rS) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + Microsoft.Xna.Framework.BoundingSphere xnaSphere = new Microsoft.Xna.Framework.BoundingSphere(new XNAVector3(xS, yS, zS), rS); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + ANX.Framework.BoundingSphere anxSphere = new ANX.Framework.BoundingSphere(new ANXVector3(xS, yS, zS), rS); + + Microsoft.Xna.Framework.ContainmentType containsXNA = xnaBox.Contains(xnaSphere); + ANX.Framework.ContainmentType containsANX = anxBox.Contains(anxSphere); + + if (containsXNA.Equals(containsANX)) + Assert.Pass("ContainsBoundingSphere passed"); + else + Assert.Fail(String.Format("ContainsBoundingSphere failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("ninefloat")] + public void ContainsPoint(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, float xP, float yP, float zP) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + XNAVector3 xnaPoint = new XNAVector3(xP, yP, zP); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + ANXVector3 anxPoint = new ANXVector3(xP, yP, zP); + + Microsoft.Xna.Framework.ContainmentType containsXNA = xnaBox.Contains(xnaPoint); + ANX.Framework.ContainmentType containsANX = anxBox.Contains(anxPoint); + + if (containsXNA.Equals(containsANX)) + Assert.Pass("ContainsPoint passed"); + else + Assert.Fail(String.Format("ContainsPoint failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("ninefloat")] + public void CreateFromPointsStatic( + float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3) + { + List pointsXNA = new List(); + pointsXNA.Add(new XNAVector3(x1, y1, z1)); + pointsXNA.Add(new XNAVector3(x2, y2, z2)); + pointsXNA.Add(new XNAVector3(x3, y3, z3)); + + List pointsANX = new List(); + pointsANX.Add(new ANXVector3(x1, y1, z1)); + pointsANX.Add(new ANXVector3(x2, y2, z2)); + pointsANX.Add(new ANXVector3(x3, y3, z3)); + + XNABoundingBox xna = XNABoundingBox.CreateFromPoints(pointsXNA); + ANXBoundingBox anx = ANXBoundingBox.CreateFromPoints(pointsANX); + + ConvertEquals(xna, anx, "CreateFromPointsStatic"); + } + + [Test, TestCaseSource("ninefloat")] + public void CreateFromSphereStatic( + float x, float y, float z, float radius, + float a, float b, float c, float d, float e) + { + Microsoft.Xna.Framework.BoundingSphere xnaSphere = new Microsoft.Xna.Framework.BoundingSphere( + new XNAVector3(x, y, z), radius); + + ANX.Framework.BoundingSphere anxSphere = new ANX.Framework.BoundingSphere( + new ANXVector3(x, y, z), radius); + + XNABoundingBox xna = XNABoundingBox.CreateFromSphere(xnaSphere); + ANXBoundingBox anx = ANXBoundingBox.CreateFromSphere(anxSphere); + + ConvertEquals(xna, anx, "CreateFromSphereStatic"); + } + + [Test, TestCaseSource("twelvefloat")] + public void CreateMergedStatic( + float xMin1, float yMin1, float zMin1, float xMax1, float yMax1, float zMax1, + float xMin2, float yMin2, float zMin2, float xMax2, float yMax2, float zMax2) + { + XNABoundingBox xnaBox1 = new XNABoundingBox(new XNAVector3(xMin1, yMin1, zMin1), new XNAVector3(xMax1, yMax1, zMax1)); + XNABoundingBox xnaBox2 = new XNABoundingBox(new XNAVector3(xMin2, yMin2, zMin2), new XNAVector3(xMax2, yMax2, zMax2)); + + ANXBoundingBox anxBox1 = new ANXBoundingBox(new ANXVector3(xMin1, yMin1, zMin1), new ANXVector3(xMax1, yMax1, zMax1)); + ANXBoundingBox anxBox2 = new ANXBoundingBox(new ANXVector3(xMin2, yMin2, zMin2), new ANXVector3(xMax2, yMax2, zMax2)); + + XNABoundingBox xna = XNABoundingBox.CreateMerged(xnaBox1, xnaBox2); + ANXBoundingBox anx = ANXBoundingBox.CreateMerged(anxBox1, anxBox2); + + ConvertEquals(xna, anx, "CreateMergedStatic"); + } + + [Test, TestCaseSource("sixfloat")] + public void GetCorners(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + + XNAVector3[] xna = xnaBox.GetCorners(); + ANXVector3[] anx = anxBox.GetCorners(); + + if (xna.Equals(anx)) + Assert.Pass("GetCorners passed"); + else + Assert.Fail(String.Format("GetCorners failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + + [Test, TestCaseSource("twelvefloat")] + public void IntersectsBoundingBox( + float xMin1, float yMin1, float zMin1, float xMax1, float yMax1, float zMax1, + float xMin2, float yMin2, float zMin2, float xMax2, float yMax2, float zMax2) + { + XNABoundingBox xnaBox1 = new XNABoundingBox(new XNAVector3(xMin1, yMin1, zMin1), new XNAVector3(xMax1, yMax1, zMax1)); + XNABoundingBox xnaBox2 = new XNABoundingBox(new XNAVector3(xMin2, yMin2, zMin2), new XNAVector3(xMax2, yMax2, zMax2)); + + ANXBoundingBox anxBox1 = new ANXBoundingBox(new ANXVector3(xMin1, yMin1, zMin1), new ANXVector3(xMax1, yMax1, zMax1)); + ANXBoundingBox anxBox2 = new ANXBoundingBox(new ANXVector3(xMin2, yMin2, zMin2), new ANXVector3(xMax2, yMax2, zMax2)); + + bool xna = xnaBox1.Intersects(xnaBox2); + bool anx = anxBox1.Intersects(anxBox2); + + if (xna.Equals(anx)) + Assert.Pass("IntersectsBoundingBox passed"); + else + Assert.Fail(String.Format("IntersectsBoundingBox failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + + [Test, TestCaseSource("twentytwofloat")] + public void IntersctsFrustum(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, + float xMin, float yMin, float zMin, float xMax, float yMax, float zMax) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + Microsoft.Xna.Framework.Matrix xnaMtrix = new Microsoft.Xna.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + Microsoft.Xna.Framework.BoundingFrustum xnaFrustum = new Microsoft.Xna.Framework.BoundingFrustum(xnaMtrix); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + ANX.Framework.Matrix anxMatrix = new ANX.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + ANX.Framework.BoundingFrustum anxFrustum = new ANX.Framework.BoundingFrustum(anxMatrix); + + bool xna = xnaBox.Intersects(xnaFrustum); + bool anx = anxBox.Intersects(anxFrustum); + + if (xna.Equals(anx)) + Assert.Pass("IntersctsFrustum passed"); + else + Assert.Fail(String.Format("IntersctsFrustum failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + + [Test, TestCaseSource("tenfloat")] + public void IntersectsBoundingSphere(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, float xS, float yS, float zS, float rS) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + Microsoft.Xna.Framework.BoundingSphere xnaSphere = new Microsoft.Xna.Framework.BoundingSphere(new XNAVector3(xS, yS, zS), rS); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + ANX.Framework.BoundingSphere anxSphere = new ANX.Framework.BoundingSphere(new ANXVector3(xS, yS, zS), rS); + + bool xna = xnaBox.Intersects(xnaSphere); + bool anx = anxBox.Intersects(anxSphere); + + if (xna.Equals(anx)) + Assert.Pass("IntersectsBoundingSphere passed"); + else + Assert.Fail(String.Format("IntersectsBoundingSphere failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + + [Test, TestCaseSource("tenfloat")] + public void IntersectsPlane(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, float xP, float yP, float zP, float dP) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + Microsoft.Xna.Framework.Plane xnaPlane = new Microsoft.Xna.Framework.Plane(xP, yP, zP, dP); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + ANX.Framework.Plane anxPlane = new ANX.Framework.Plane(xP, yP, zP, dP); + + Microsoft.Xna.Framework.PlaneIntersectionType xna = xnaBox.Intersects(xnaPlane); + ANX.Framework.PlaneIntersectionType anx = anxBox.Intersects(anxPlane); + + if (xna.Equals(anx)) + Assert.Pass("IntersectsPlane passed"); + else + Assert.Fail(String.Format("IntersectsPlane failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + + [Test, TestCaseSource("twelvefloat")] + public void IntersectsRay( + float xMin1, float yMin1, float zMin1, float xMax1, float yMax1, float zMax1, + float xRay, float yRay, float zRay, float xDir, float yDir, float zDir) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin1, yMin1, zMin1), new XNAVector3(xMax1, yMax1, zMax1)); + Microsoft.Xna.Framework.Ray xnaRay = new Microsoft.Xna.Framework.Ray(new XNAVector3(xRay, yRay, zRay), new XNAVector3(xDir, yDir, zDir)); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin1, yMin1, zMin1), new ANXVector3(xMax1, yMax1, zMax1)); + ANX.Framework.Ray anxRay = new ANX.Framework.Ray(new ANXVector3(xRay, yRay, zRay), new ANXVector3(xDir, yDir, zDir)); + + float? xna = xnaBox.Intersects(xnaRay); + float? anx = anxBox.Intersects(anxRay); + + if (xna.Equals(anx)) + Assert.Pass("IntersectsRay passed"); + else + Assert.Fail(String.Format("IntersectsRay failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + #endregion + + #region Properties + [Test, TestCaseSource("sixfloat")] + public void Min(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + + XNAVector3 xna = xnaBox.Min; + XNAVector3 anx = xnaBox.Min; + + if (xna.X == anx.X && + xna.Y == anx.Y && + xna.Z == anx.Z) + Assert.Pass("Min passed"); + else + Assert.Fail(String.Format("Min failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + + [Test, TestCaseSource("sixfloat")] + public void Max(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax) + { + XNABoundingBox xnaBox = new XNABoundingBox(new XNAVector3(xMin, yMin, zMin), new XNAVector3(xMax, yMax, zMax)); + + ANXBoundingBox anxBox = new ANXBoundingBox(new ANXVector3(xMin, yMin, zMin), new ANXVector3(xMax, yMax, zMax)); + + XNAVector3 xna = xnaBox.Max; + XNAVector3 anx = xnaBox.Max; + + if (xna.X == anx.X && + xna.Y == anx.Y && + xna.Z == anx.Z) + Assert.Pass("Max passed"); + else + Assert.Fail(String.Format("Max failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + #endregion + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/BoundingSphereTest.cs b/ANX.Framework.TestCenter/Strukturen/BoundingSphereTest.cs new file mode 100644 index 00000000..44194399 --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/BoundingSphereTest.cs @@ -0,0 +1,460 @@ +#region UsingStatements +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +#endregion + +#region License + +// +// This file is part of the ANX.Framework created by the "ANX.Framework developer group". +// +// This file is released under the Ms-PL license. +// +// +// +// Microsoft Public License (Ms-PL) +// +// This license governs use of the accompanying software. If you use the software, you accept this license. +// If you do not accept the license, do not use the software. +// +// 1.Definitions +// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning +// here as under U.S. copyright law. +// A "contribution" is the original software, or any additions or changes to the software. +// A "contributor" is any person that distributes its contribution under this license. +// "Licensed patents" are a contributor's patent claims that read directly on its contribution. +// +// 2.Grant of Rights +// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations +// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to +// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution +// or any derivative works that you create. +// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in +// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed +// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution +// in the software or derivative works of the contribution in the software. +// +// 3.Conditions and Limitations +// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your +// patent license from such contributor to the software ends automatically. +// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution +// notices that are present in the software. +// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including +// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or +// object code form, you may only do so under a license that complies with this license. +// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, +// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the +// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a +// particular purpose and non-infringement. + +#endregion // License + +using XNABoundingSphere = Microsoft.Xna.Framework.BoundingSphere; +using XNAVector3 = Microsoft.Xna.Framework.Vector3; +using ANXBoundingSphere = ANX.Framework.BoundingSphere; +using ANXVector3 = ANX.Framework.Vector3; + +using NUnit.Framework; + +namespace ANX.Framework.TestCenter.Strukturen +{ + [TestFixture] + class BoundingSphereTest + { + #region Helper + private static Random r = new Random(); + + public static float RandomFloat + { + get { return (float)(r.NextDouble()); } + } + + static object[] fourfloat = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + }; + + static object[] eightfloat = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + }; + + static object[] tenfloat = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + }; + + static object[] twentyfloat = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, + RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + }; + + private void ConvertEquals(XNABoundingSphere xna, ANXBoundingSphere anx, String test) + { + if (xna.Center.X == anx.Center.X && + xna.Center.Y == anx.Center.Y && + xna.Center.Z == anx.Center.Z && + xna.Radius == anx.Radius) + { + Assert.Pass(test + " passed"); + } + else + { + Assert.Fail(String.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString())); + } + } + #endregion + + #region Constructors + [Test] + public void constructor0() + { + XNABoundingSphere xna = new XNABoundingSphere(); + + ANXBoundingSphere anx = new ANXBoundingSphere(); + + ConvertEquals(xna, anx, "constructor0"); + } + + [Test, TestCaseSource("fourfloat")] + public void constructor1(float x, float y, float z, float r) + { + XNABoundingSphere xna = new XNABoundingSphere(new XNAVector3(x, y, z), r); + + ANXBoundingSphere anx = new ANXBoundingSphere(new ANXVector3(x, y, z), r); + + ConvertEquals(xna, anx, "constructor0"); + } + #endregion + + #region Methods + [Test, TestCaseSource("tenfloat")] + public void ContainsBoundingBox(float xS, float yS, float zS, float rS, float xMin, float yMin, float zMin, float xMax, float yMax, float zMax) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(xS, yS, zS), rS); + Microsoft.Xna.Framework.BoundingBox xnaBox = new Microsoft.Xna.Framework.BoundingBox( + new XNAVector3(xMin, yMin, zMin), + new XNAVector3(xMax, yMax, zMax)); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(xS, yS, zS), rS); + ANX.Framework.BoundingBox anxBox = new ANX.Framework.BoundingBox( + new ANXVector3(xMin, yMin, zMin), + new ANXVector3(xMax, yMax, zMax)); + + Microsoft.Xna.Framework.ContainmentType containsXNA = xnaSphere.Contains(xnaBox); + ANX.Framework.ContainmentType containsANX = anxSphere.Contains(anxBox); + + if (containsANX.Equals(containsANX)) + Assert.Pass("ContainsBoundingBox passed"); + else + Assert.Fail(String.Format("ContainsBoundingBox failed: xna({0}) anx({1})", containsANX.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("twentyfloat")] + public void ContainsBoundingFrustum(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, + float xS, float yS, float zS, float r) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(xS, yS, zS), r); + Microsoft.Xna.Framework.Matrix xnaMatrix = new Microsoft.Xna.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + Microsoft.Xna.Framework.BoundingFrustum xnaFrustum = new Microsoft.Xna.Framework.BoundingFrustum(xnaMatrix); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(xS, yS, zS), r); + ANX.Framework.Matrix anxMatrix = new ANX.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + ANX.Framework.BoundingFrustum anxFrustum = new ANX.Framework.BoundingFrustum(anxMatrix); + + Microsoft.Xna.Framework.ContainmentType containsXNA = xnaSphere.Contains(xnaFrustum); + ANX.Framework.ContainmentType containsANX = anxSphere.Contains(anxFrustum); + + if (containsXNA.Equals(containsANX)) + Assert.Pass("ContainsBoundingFrustum passed"); + else + Assert.Fail(String.Format("ContainsBoundingFrustum failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("eightfloat")] + public void ContainsBoundingSphere(float x1, float y1, float z1, float r1, float x2, float y2, float z2, float r2) + { + XNABoundingSphere xnaSphere1 = new XNABoundingSphere(new XNAVector3(x1, y1, z1), r1); + XNABoundingSphere xnaSphere2 = new XNABoundingSphere(new XNAVector3(x2, y2, z2), r2); + + ANXBoundingSphere anxSphere1 = new ANXBoundingSphere(new ANXVector3(x1, y1, z1), r1); + ANXBoundingSphere anxSphere2 = new ANXBoundingSphere(new ANXVector3(x2, y2, z2), r2); + + Microsoft.Xna.Framework.ContainmentType containsXNA = xnaSphere1.Contains(xnaSphere2); + ANX.Framework.ContainmentType containsANX = anxSphere1.Contains(anxSphere2); + + if (containsANX.Equals(containsANX)) + Assert.Pass("ContainsBoundingSphere passed"); + else + Assert.Fail(String.Format("ContainsBoundingSphere failed: xna({0}) anx({1})", containsANX.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("eightfloat")] + public void ContainsPoint(float xS, float yS, float zS, float rS, float xP, float yP, float zP, float a) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(xS, yS, zS), rS); + XNAVector3 xnaPoint = new XNAVector3(xP, yP, zP); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(xS, yS, zS), rS); + ANXVector3 anxPoint = new ANXVector3(xP, yP, zP); + + Microsoft.Xna.Framework.ContainmentType containsXNA = xnaSphere.Contains(xnaPoint); + ANX.Framework.ContainmentType containsANX = anxSphere.Contains(anxPoint); + + if (containsANX.Equals(containsANX)) + Assert.Pass("ContainsPoint passed"); + else + Assert.Fail(String.Format("ContainsPoint failed: xna({0}) anx({1})", containsANX.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("eightfloat")] + public void CreateFromBoundingBox(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, float a, float b) + { + Microsoft.Xna.Framework.BoundingBox xnaBox = new Microsoft.Xna.Framework.BoundingBox( + new XNAVector3(xMin, yMin, zMin), + new XNAVector3(xMax, yMax, zMax)); + + ANX.Framework.BoundingBox anxBox = new ANX.Framework.BoundingBox( + new ANXVector3(xMin, yMin, zMin), + new ANXVector3(xMax, yMax, zMax)); + + XNABoundingSphere xna = XNABoundingSphere.CreateFromBoundingBox(xnaBox); + ANXBoundingSphere anx = ANXBoundingSphere.CreateFromBoundingBox(anxBox); + + ConvertEquals(xna, anx, "CreateFromBoundingBox"); + } + + [Test, TestCaseSource("twentyfloat")] + public void CreateFromFrustumStatic(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, + float a, float b, float c, float d) + { + Microsoft.Xna.Framework.Matrix xnaMatrix = new Microsoft.Xna.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + Microsoft.Xna.Framework.BoundingFrustum xnaFrustum = new Microsoft.Xna.Framework.BoundingFrustum(xnaMatrix); + + ANX.Framework.Matrix anxMatrix = new ANX.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + ANX.Framework.BoundingFrustum anxFrustum = new ANX.Framework.BoundingFrustum(anxMatrix); + + XNABoundingSphere xna = XNABoundingSphere.CreateFromFrustum(xnaFrustum); + ANXBoundingSphere anx = ANXBoundingSphere.CreateFromFrustum(anxFrustum); + + ConvertEquals(xna, anx, "CreateFromFrustumStatic"); + } + + [Test, TestCaseSource("tenfloat")] + public void CreateFromPointsStatic( + float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float a) + { + List pointsXNA = new List(); + pointsXNA.Add(new XNAVector3(x1, y1, z1)); + pointsXNA.Add(new XNAVector3(x2, y2, z2)); + pointsXNA.Add(new XNAVector3(x3, y3, z3)); + + List pointsANX = new List(); + pointsANX.Add(new ANXVector3(x1, y1, z1)); + pointsANX.Add(new ANXVector3(x2, y2, z2)); + pointsANX.Add(new ANXVector3(x3, y3, z3)); + + XNABoundingSphere xna = XNABoundingSphere.CreateFromPoints(pointsXNA); + ANXBoundingSphere anx = ANXBoundingSphere.CreateFromPoints(pointsANX); + + ConvertEquals(xna, anx, "CreateFromPointsStatic"); + } + + [Test, TestCaseSource("tenfloat")] + public void CreateMergedStatic( + float x1, float y1, float z1, float r1, + float x2, float y2, float z2, float r2, + float a, float b) + { + XNABoundingSphere xnaSphere1 = new XNABoundingSphere(new XNAVector3(x1, y1, z1), r1); + XNABoundingSphere xnaSphere2 = new XNABoundingSphere(new XNAVector3(x2, y2, z2), r2); + + ANXBoundingSphere anxSphere1 = new ANXBoundingSphere(new ANXVector3(x1, y1, z1), r1); + ANXBoundingSphere anxSphere2 = new ANXBoundingSphere(new ANXVector3(x2, y2, z2), r2); + + XNABoundingSphere xna = XNABoundingSphere.CreateMerged(xnaSphere1, xnaSphere2); + ANXBoundingSphere anx = ANXBoundingSphere.CreateMerged(anxSphere1, anxSphere2); + + ConvertEquals(xna, anx, "CreateMergedStatic"); + } + + [Test, TestCaseSource("tenfloat")] + public void IntersectsBoundingBox(float xS, float yS, float zS, float rS, float xMin, float yMin, float zMin, float xMax, float yMax, float zMax) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(xS, yS, zS), rS); + Microsoft.Xna.Framework.BoundingBox xnaBox = new Microsoft.Xna.Framework.BoundingBox( + new XNAVector3(xMin, yMin, zMin), + new XNAVector3(xMax, yMax, zMax)); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(xS, yS, zS), rS); + ANX.Framework.BoundingBox anxBox = new ANX.Framework.BoundingBox( + new ANXVector3(xMin, yMin, zMin), + new ANXVector3(xMax, yMax, zMax)); + + bool containsXNA = xnaSphere.Intersects(xnaBox); + bool containsANX = anxSphere.Intersects(anxBox); + + if (containsANX.Equals(containsANX)) + Assert.Pass("IntersectsBoundingBox passed"); + else + Assert.Fail(String.Format("IntersectsBoundingBox failed: xna({0}) anx({1})", containsANX.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("twentyfloat")] + public void IntersectsBoundingFrustum(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, + float xS, float yS, float zS, float r) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(xS, yS, zS), r); + Microsoft.Xna.Framework.Matrix xnaMatrix = new Microsoft.Xna.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + Microsoft.Xna.Framework.BoundingFrustum xnaFrustum = new Microsoft.Xna.Framework.BoundingFrustum(xnaMatrix); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(xS, yS, zS), r); + ANX.Framework.Matrix anxMatrix = new ANX.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + ANX.Framework.BoundingFrustum anxFrustum = new ANX.Framework.BoundingFrustum(anxMatrix); + + bool containsXNA = xnaSphere.Intersects(xnaFrustum); + bool containsANX = anxSphere.Intersects(anxFrustum); + + if (containsXNA.Equals(containsANX)) + Assert.Pass("IntersectsBoundingFrustum passed"); + else + Assert.Fail(String.Format("IntersectsBoundingFrustum failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("eightfloat")] + public void IntersectsBoundingSphere(float x1, float y1, float z1, float r1, float x2, float y2, float z2, float r2) + { + XNABoundingSphere xnaSphere1 = new XNABoundingSphere(new XNAVector3(x1, y1, z1), r1); + XNABoundingSphere xnaSphere2 = new XNABoundingSphere(new XNAVector3(x2, y2, z2), r2); + + ANXBoundingSphere anxSphere1 = new ANXBoundingSphere(new ANXVector3(x1, y1, z1), r1); + ANXBoundingSphere anxSphere2 = new ANXBoundingSphere(new ANXVector3(x2, y2, z2), r2); + + bool containsXNA = xnaSphere1.Intersects(xnaSphere2); + bool containsANX = anxSphere1.Intersects(anxSphere2); + + if (containsANX.Equals(containsANX)) + Assert.Pass("IntersectsBoundingSphere passed"); + else + Assert.Fail(String.Format("IntersectsBoundingSphere failed: xna({0}) anx({1})", containsANX.ToString(), containsANX.ToString())); + } + + [Test, TestCaseSource("eightfloat")] + public void IntersectsPlane(float xS, float yS, float zS, float r, float xP, float yP, float zP, float dP) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(xS, yS, zS), r); + Microsoft.Xna.Framework.Plane xnaPlane = new Microsoft.Xna.Framework.Plane(xP, yP, zP, dP); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(xS, yS, zS), r); + ANX.Framework.Plane anxPlane = new ANX.Framework.Plane(xP, yP, zP, dP); + + Microsoft.Xna.Framework.PlaneIntersectionType xna = xnaSphere.Intersects(xnaPlane); + ANX.Framework.PlaneIntersectionType anx = anxSphere.Intersects(anxPlane); + + if (xna.Equals(anx)) + Assert.Pass("IntersectsPlane passed"); + else + Assert.Fail(String.Format("IntersectsPlane failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + + [Test, TestCaseSource("tenfloat")] + public void IntersectsRay( + float xS, float yS, float zS, float r, + float xRay, float yRay, float zRay, float xDir, float yDir, float zDir) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(xS, yS, zS), r); + Microsoft.Xna.Framework.Ray xnaRay = new Microsoft.Xna.Framework.Ray(new XNAVector3(xRay, yRay, zRay), new XNAVector3(xDir, yDir, zDir)); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(xS, yS, zS), r); + ANX.Framework.Ray anxRay = new ANX.Framework.Ray(new ANXVector3(xRay, yRay, zRay), new ANXVector3(xDir, yDir, zDir)); + + float? xna = xnaSphere.Intersects(xnaRay); + float? anx = anxSphere.Intersects(anxRay); + + if (xna.Equals(anx)) + Assert.Pass("IntersectsRay passed"); + else + Assert.Fail(String.Format("IntersectsRay failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + + [Test, TestCaseSource("twentyfloat")] + public void Transform(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, + float xS, float yS, float zS, float r) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(xS, yS, zS), r); + Microsoft.Xna.Framework.Matrix xnaMatrix = new Microsoft.Xna.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(xS, yS, zS), r); + ANX.Framework.Matrix anxMatrix = new ANX.Framework.Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + + xnaSphere.Transform(xnaMatrix); + anxSphere.Transform(anxMatrix); + + ConvertEquals(xnaSphere, anxSphere, "Transform"); + } + #endregion + + #region Properties + [Test, TestCaseSource("fourfloat")] + public void Center(float x, float y, float z, float r) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(x, y, z), r); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(x, y, z), r); + + XNAVector3 xna = xnaSphere.Center; + XNAVector3 anx = xnaSphere.Center; + + if (xna.X == anx.X && + xna.Y == anx.Y && + xna.Z == anx.Z) + Assert.Pass("Center passed"); + else + Assert.Fail(String.Format("Center failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + + [Test, TestCaseSource("fourfloat")] + public void Radius(float x, float y, float z, float r) + { + XNABoundingSphere xnaSphere = new XNABoundingSphere(new XNAVector3(x, y, z), r); + + ANXBoundingSphere anxSphere = new ANXBoundingSphere(new ANXVector3(x, y, z), r); + + float xna = xnaSphere.Radius; + float anx = xnaSphere.Radius; + + if (xna.Equals(anx)) + Assert.Pass("Radius passed"); + else + Assert.Fail(String.Format("Radius failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + #endregion + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/ColorTest.cs b/ANX.Framework.TestCenter/Strukturen/ColorTest.cs new file mode 100644 index 00000000..4112f38e --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/ColorTest.cs @@ -0,0 +1,437 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +#endregion // Using Statements + +#region License + +// +// This file is part of the ANX.Framework created by the "ANX.Framework developer group". +// +// This file is released under the Ms-PL license. +// +// +// +// Microsoft Public License (Ms-PL) +// +// This license governs use of the accompanying software. If you use the software, you accept this license. +// If you do not accept the license, do not use the software. +// +// 1.Definitions +// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning +// here as under U.S. copyright law. +// A "contribution" is the original software, or any additions or changes to the software. +// A "contributor" is any person that distributes its contribution under this license. +// "Licensed patents" are a contributor's patent claims that read directly on its contribution. +// +// 2.Grant of Rights +// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations +// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to +// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution +// or any derivative works that you create. +// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in +// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed +// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution +// in the software or derivative works of the contribution in the software. +// +// 3.Conditions and Limitations +// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your +// patent license from such contributor to the software ends automatically. +// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution +// notices that are present in the software. +// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including +// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or +// object code form, you may only do so under a license that complies with this license. +// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, +// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the +// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a +// particular purpose and non-infringement. + +#endregion // License + +using XNAColor = Microsoft.Xna.Framework.Color; +using ANXColor = ANX.Framework.Color; + +using NUnit.Framework; + +namespace ANX.Framework.TestCenter.Strukturen +{ + [TestFixture] + class ColorTest + { + private static Random r = new Random(); + + public static float RandomFloat + { + get { return (float)(r.NextDouble()); } + } + + static object[] fourfloats = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat } + }; + + static object[] eightfloats = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat } + }; + + static object[] ninefloats = + { + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat }, + new object[] { RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat, RandomFloat } + }; + + private void ConvertEquals(XNAColor xna, ANXColor anx, String test) + { + if (xna.R == anx.R && + xna.G == anx.G && + xna.B == anx.B && + xna.A == anx.A) + { + Assert.Pass(test + " passed"); + } + else + { + Assert.Fail(String.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString())); + } + } + + #region Constructors + [Test] + public void constructor0() + { + XNAColor xna = new XNAColor(); + ANXColor anx = new ANXColor(); + + ConvertEquals(xna, anx, "constructor0"); + } + + [Test, TestCaseSource("fourfloats")] + public void constructor1(float r, float g, float b, float a) + { + XNAColor xna = new XNAColor(new Microsoft.Xna.Framework.Vector3(r, g, b)); + ANXColor anx = new ANXColor(new ANX.Framework.Vector3(r, g, b)); + + ConvertEquals(xna, anx, "constructor1"); + } + + [Test, TestCaseSource("fourfloats")] + public void constructor2(float r, float g, float b, float a) + { + XNAColor xna = new XNAColor(new Microsoft.Xna.Framework.Vector4(r, g, b, a)); + ANXColor anx = new ANXColor(new ANX.Framework.Vector4(r, g, b, a)); + + ConvertEquals(xna, anx, "constructor2"); + } + + [Test, TestCaseSource("fourfloats")] + public void constructor3(float r, float g, float b, float a) + { + XNAColor xna = new XNAColor(r, g, b); + ANXColor anx = new ANXColor(r, g, b); + + ConvertEquals(xna, anx, "constructor3"); + } + + [Test, TestCaseSource("fourfloats")] + public void constructor4(float r, float g, float b, float a) + { + XNAColor xna = new XNAColor((int)(r * 255), (int)(g * 255), (int)(b * 255)); + ANXColor anx = new ANXColor((int)(r * 255), (int)(g * 255), (int)(b * 255)); + + ConvertEquals(xna, anx, "constructor4"); + } + + [Test, TestCaseSource("fourfloats")] + public void constructor5(float r, float g, float b, float a) + { + XNAColor xna = new XNAColor(r, g, b) * a; + ANXColor anx = new ANXColor(r, g, b) * a; + + ConvertEquals(xna, anx, "constructor5"); + } + + [Test, TestCaseSource("fourfloats")] + public void constructor6(float r, float g, float b, float a) + { + XNAColor xna = new XNAColor((int)(r * 255), (int)(g * 255), (int)(b * 255), (int)(a * 255)); + ANXColor anx = new ANXColor((int)(r * 255), (int)(g * 255), (int)(b * 255), (int)(a * 255)); + + ConvertEquals(xna, anx, "constructor6"); + } + #endregion + + #region Methods + [Test, TestCaseSource("eightfloats")] + public void EqualOperator( + float r1, float g1, float b1, float a1, + float r2, float g2, float b2, float a2) + { + XNAColor xna1 = new XNAColor(r1, g1, b1) * a1; + XNAColor xna2 = new XNAColor(r2, g2, b2) * a2; + + ANXColor anx1 = new ANXColor(r1, g1, b1) * a1; + ANXColor anx2 = new ANXColor(r2, g2, b2) * a2; + + bool xna = xna1 == xna2; + bool anx = anx1 == anx2; + + if (xna == anx) + { + Assert.Pass("EqualsOperator passed"); + } + else + { + Assert.Fail(String.Format("EqualsOperator failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + } + + [Test, TestCaseSource("eightfloats")] + public void UnequalOperator( + float r1, float g1, float b1, float a1, + float r2, float g2, float b2, float a2) + { + XNAColor xna1 = new XNAColor(r1, g1, b1) * a1; + XNAColor xna2 = new XNAColor(r2, g2, b2) * a2; + + ANXColor anx1 = new ANXColor(r1, g1, b1) * a1; + ANXColor anx2 = new ANXColor(r2, g2, b2) * a2; + + bool xna = xna1 != xna2; + bool anx = anx1 != anx2; + + if (xna == anx) + { + Assert.Pass("UnequalsOperator passed"); + } + else + { + Assert.Fail(String.Format("EqualsOperator failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + } + + [Test, TestCaseSource("fourfloats")] + public void FromNonPremultipliedIntStatic(float r, float g, float b, float a) + { + XNAColor xna = XNAColor.FromNonPremultiplied((int)(r * 255), (int)(g * 255), (int)(b * 255), (int)(a * 255)); + + ANXColor anx = ANXColor.FromNonPremultiplied((int)(r * 255), (int)(g * 255), (int)(b * 255), (int)(a * 255)); + + ConvertEquals(xna, anx, "FromNonPremultipliedIntStatic"); + } + + [Test, TestCaseSource("fourfloats")] + public void FromNonPremultipliedVector4Static(float r, float g, float b, float a) + { + XNAColor xna = XNAColor.FromNonPremultiplied(new Microsoft.Xna.Framework.Vector4(r, g, b, a)); + + ANXColor anx = ANXColor.FromNonPremultiplied(new ANX.Framework.Vector4(r, g, b, a)); + + ConvertEquals(xna, anx, "FromNonPremultipliedVector4Static"); + } + + [Test, TestCaseSource("ninefloats")] + public void LerpStatic( + float r1, float g1, float b1, float a1, + float r2, float g2, float b2, float a2, float amount) + { + XNAColor xna1 = new XNAColor(r1, g1, b1) * a1; + XNAColor xna2 = new XNAColor(r2, g2, b2) * a2; + + ANXColor anx1 = new ANXColor(r1, g1, b1) * a1; + ANXColor anx2 = new ANXColor(r2, g2, b2) * a2; + + XNAColor xna = XNAColor.Lerp(xna1, xna2, amount); + ANXColor anx = ANXColor.Lerp(anx1, anx2, amount); + + ConvertEquals(xna, anx, "LerpStatic"); + } + + [Test, TestCaseSource("eightfloats")] + public void MultiplyStatic(float r, float g, float b, float a, float scale, float x, float y, float z) + { + XNAColor xna = new XNAColor(r, g, b) * a; + + ANXColor anx = new ANXColor(r, g, b) * a; + + XNAColor.Multiply(xna, scale); + ANXColor.Multiply(anx, scale); + + ConvertEquals(xna, anx, "MultiplyStatic"); + } + + [Test, TestCaseSource("eightfloats")] + public void MultiplyOperator(float r, float g, float b, float a, float scale, float x, float y, float z) + { + XNAColor xna = new XNAColor(r, g, b) * a; + + ANXColor anx = new ANXColor(r, g, b) * a; + + xna *= scale; + anx *= scale; + + ConvertEquals(xna, anx, "MultiplyOperator"); + } + + [Test, TestCaseSource("fourfloats")] + public void ToVector3(float r, float g, float b, float a) + { + XNAColor xnaColor = new XNAColor(r, g, b) * a; + + ANXColor anxColor = new ANXColor(r, g, b) * a; + + Microsoft.Xna.Framework.Vector3 xna = xnaColor.ToVector3(); + ANX.Framework.Vector3 anx = anxColor.ToVector3(); + + if (xna.Equals(anx)) + { + Assert.Pass("ToVector3 passed"); + } + else + { + Assert.Fail(String.Format("ToVector3 failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + } + + [Test, TestCaseSource("fourfloats")] + public void ToVector4(float r, float g, float b, float a) + { + XNAColor xnaColor = new XNAColor(r, g, b) * a; + + ANXColor anxColor = new ANXColor(r, g, b) * a; + + Microsoft.Xna.Framework.Vector4 xna = xnaColor.ToVector4(); + ANX.Framework.Vector4 anx = anxColor.ToVector4(); + + if (xna.Equals(anx)) + { + Assert.Pass("ToVector4 passed"); + } + else + { + Assert.Fail(String.Format("ToVector4 failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + } + + #endregion // Methods + + #region Properties + + [Test, TestCaseSource("fourfloats")] + public void PackedValue(float r, float g, float b, float a) + { + XNAColor xnaColor = new XNAColor(r, g, b) * a; + + ANXColor anxColor = new ANXColor(r, g, b) * a; + + uint xna = xnaColor.PackedValue; + uint anx = anxColor.PackedValue; + + if (xna.Equals(anx)) + { + Assert.Pass("PackedValue passed"); + } + else + { + Assert.Fail(String.Format("PackedValue failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + } + + [Test, TestCaseSource("fourfloats")] + public void R(float r, float g, float b, float a) + { + XNAColor xnaColor = new XNAColor(r, g, b) * a; + + ANXColor anxColor = new ANXColor(r, g, b) * a; + + byte xna = xnaColor.R; + byte anx = anxColor.R; + + if (xna.Equals(anx)) + { + Assert.Pass("R passed"); + } + else + { + Assert.Fail(String.Format("R failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + } + + [Test, TestCaseSource("fourfloats")] + public void G(float r, float g, float b, float a) + { + XNAColor xnaColor = new XNAColor(r, g, b) * a; + + ANXColor anxColor = new ANXColor(r, g, b) * a; + + byte xna = xnaColor.G; + byte anx = anxColor.G; + + if (xna.Equals(anx)) + { + Assert.Pass("G passed"); + } + else + { + Assert.Fail(String.Format("G failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + } + + [Test, TestCaseSource("fourfloats")] + public void B(float r, float g, float b, float a) + { + XNAColor xnaColor = new XNAColor(r, g, b) * a; + + ANXColor anxColor = new ANXColor(r, g, b) * a; + + byte xna = xnaColor.B; + byte anx = anxColor.B; + + if (xna.Equals(anx)) + { + Assert.Pass("B passed"); + } + else + { + Assert.Fail(String.Format("B failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + } + + [Test, TestCaseSource("fourfloats")] + public void A(float r, float g, float b, float a) + { + XNAColor xnaColor = new XNAColor(r, g, b) * a; + + ANXColor anxColor = new ANXColor(r, g, b) * a; + + byte xna = xnaColor.A; + byte anx = anxColor.A; + + if (xna.Equals(anx)) + { + Assert.Pass("A passed"); + } + else + { + Assert.Fail(String.Format("A failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); + } + #endregion + } + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/PointTests.cs b/ANX.Framework.TestCenter/Strukturen/PointTests.cs new file mode 100644 index 00000000..b6031ee4 --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/PointTests.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ANX.Framework.TestCenter.Strukturen +{ + class PointTests + { + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/Vector4Test.cs b/ANX.Framework.TestCenter/Strukturen/Vector4Test.cs index a3fb23e2..af2a60eb 100644 --- a/ANX.Framework.TestCenter/Strukturen/Vector4Test.cs +++ b/ANX.Framework.TestCenter/Strukturen/Vector4Test.cs @@ -516,7 +516,7 @@ namespace ANX.Framework.TestCenter.Strukturen } [Test, TestCaseSource("seventeenFloats")] - public void SmoothStep(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float amount, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7) + public void SmoothStep(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float amount, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8) { XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1); XNAVector4 xna2 = new XNAVector4(x2, y2, z2, w2); diff --git a/ANX.Framework/BoundingFrustum.cs b/ANX.Framework/BoundingFrustum.cs index f89c7ce3..fc6c2651 100644 --- a/ANX.Framework/BoundingFrustum.cs +++ b/ANX.Framework/BoundingFrustum.cs @@ -58,7 +58,6 @@ namespace ANX.Framework public const int CornerCount = 8; #endregion - #region properties public Plane Bottom { @@ -118,7 +117,6 @@ namespace ANX.Framework } #endregion - #region constructors public BoundingFrustum(Matrix value) { @@ -126,32 +124,37 @@ namespace ANX.Framework } #endregion - #region public methods public ContainmentType Contains(BoundingBox box) { throw new Exception("method has not yet been implemented"); } + public void Contains(ref BoundingBox box, out ContainmentType result) { throw new Exception("method has not yet been implemented"); } + public ContainmentType Contains(BoundingFrustum frustum) { throw new Exception("method has not yet been implemented"); } + public ContainmentType Contains(BoundingSphere sphere) { throw new Exception("method has not yet been implemented"); } + public void Contains(ref BoundingSphere sphere, out ContainmentType result) { throw new Exception("method has not yet been implemented"); } + public ContainmentType Contains(Vector3 point) { throw new Exception("method has not yet been implemented"); } + public void Contains(ref Vector3 point, out ContainmentType result) { throw new Exception("method has not yet been implemented"); @@ -161,6 +164,7 @@ namespace ANX.Framework { throw new Exception("method has not yet been implemented"); } + public void GetCorners(Vector3[] corners) { throw new Exception("method has not yet been implemented"); @@ -175,14 +179,17 @@ namespace ANX.Framework { throw new Exception("method has not yet been implemented"); } + public void Intersects(ref BoundingBox box, out bool result) { throw new Exception("method has not yet been implemented"); } + public bool Intersects(BoundingFrustum frustum) { throw new Exception("method has not yet been implemented"); } + public bool Intersects(BoundingSphere sphere) { throw new Exception("method has not yet been implemented"); @@ -191,18 +198,22 @@ namespace ANX.Framework { throw new Exception("method has not yet been implemented"); } + public PlaneIntersectionType Intersects(Plane plane) { throw new Exception("method has not yet been implemented"); } + public void Intersects(ref Plane plane, out PlaneIntersectionType result) { throw new Exception("method has not yet been implemented"); } + public Nullable Intersects(Ray ray) { throw new Exception("method has not yet been implemented"); } + public void Intersects(ref Ray ray, out Nullable result) { throw new Exception("method has not yet been implemented"); @@ -214,7 +225,6 @@ namespace ANX.Framework } #endregion - #region IEquatable implementation public override bool Equals(Object obj) { @@ -235,7 +245,6 @@ namespace ANX.Framework } #endregion - #region operator overloading public static bool operator ==(BoundingFrustum a, BoundingFrustum b) {