コード例 #1
0
    public void TestAddRemove()
    {
        Vector3[] rndVectors = Enumerable.Range(1, 11).Select(x => Random.insideUnitCircle.toVec3()).ToArray();
        //IndexedTriangleMesh.Triangle[] trgs = Enumerable.Range(1, numTriagsPerRound * numRounds).Select( x => new IndexedTriangleMesh.Triangle( rndVectors[Random.Range(0,999)], rndVectors[Random.Range(0, 999)], rndVectors[Random.Range(0, 999)])  ).ToArray();

        C5.ArrayList <IndexedTriangleMesh.Triangle> triags = new C5.ArrayList <IndexedTriangleMesh.Triangle>();

        IndexedTriangleMesh itm = new IndexedTriangleMesh();

        for (int j = 0; j < 100; j++)
        {
            for (int i = 0; i < 10; i++)
            {
                if (triags.Count > 0 & Random.value < 0.33f)
                {
                    IndexedTriangleMesh.Triangle t = triags[Random.Range(0, triags.Count - 1)];
                    itm.RemoveTriangle(t);
                    triags.Remove(t);
                }
                else
                {
                    itm.AddTriangleByReference(new IndexedTriangleMesh.Triangle(rndVectors[Random.Range(0, rndVectors.Length - 1)],
                                                                                rndVectors[Random.Range(0, rndVectors.Length - 1)], rndVectors[Random.Range(0, rndVectors.Length - 1)]));
                }
            }
            NUnit.Framework.Assert.IsTrue(itm.SanityCheck(), "Sanity check failed");
        }
    }
コード例 #2
0
 public static void Main()
 {
     C5.ArrayList <int> array = new C5.ArrayList <int> ();
 }