コード例 #1
0
        private NativeArray <int> Triangulate(int index)
        {
            var iGeom = IntGeom.DefGeom;

            var data = ComplexTests.data[index];

            var hull  = iGeom.Int(data[0]);
            var holes = new IntVector[data.Length - 1][];

            for (int i = 1; i < data.Length; ++i)
            {
                holes[i - 1] = iGeom.Int(data[i]);
            }

            var iShape = new IntShape(hull, holes);
            var pShape = new PlainShape(iShape, Allocator.Temp);

            var triangles = pShape.Triangulate(Allocator.Temp);

            Assert.IsTrue(Triangle.IsCCW(pShape.points, triangles));

            pShape.Dispose();

            return(triangles);
        }
コード例 #2
0
        private NativeArray <int> Triangulate(int index)
        {
            var iGeom = IntGeom.DefGeom;

            var data    = MonotoneTests.data[index];
            var iPoints = iGeom.Int(data);

            var iShape = new IntShape(iPoints, new IntVector[0][]);
            var pShape = new PlainShape(iShape, Allocator.Temp);

            var triangles = pShape.Triangulate(Allocator.Temp);

            Assert.IsTrue(Triangle.IsCCW(pShape.points, triangles));

            pShape.Dispose();

            return(triangles);
        }