Exemplo n.º 1
0
        public GeneratedShape Do(ShapeOperation operation, Shape other)
        {
            switch (operation)
            {
            default:
            case ShapeOperation.Intersect:  return(Intersect(other));

            case ShapeOperation.Subtract:   return(Subtract(other));

            case ShapeOperation.Union:      return(Union(other));
            }
        }
Exemplo n.º 2
0
        public void ShapeOperations(ShapeOperation operation)
        {
            var result = RunMemoryTest("", () =>
            {
                var shape1 = new Cylinder(new Vector3(0, 0, 0), new Vector3(0, 1, 0));
                var shape2 = new Cylinder(new Vector3(1, 1, 0), new Vector3(0, 1, 0));
                return(shape1.Do(operation, shape2));
            });

            Assert.True(result.Cache.Vertices.Length > 0);
            Assert.True(result.Cache.Indices.Length > 0);

            output.WriteLine($"Result Cache: {result.Cache.ToString()}");
        }
Exemplo n.º 3
0
        public void ShapeOperationsOverlapping(ShapeOperation operation)
        {
            var result = RunMemoryTest("", () =>
            {
                var shape1 = new Cube(new Vector3(0, 0, 0), new Vector3(1.00f, 0.50f, 1.00f));
                var shape2 = new Cube(new Vector3(0, 0, 0), new Vector3(0.50f, 0.50f, 0.50f));
                return(shape1.Do(operation, shape2));
            });

            if (operation == ShapeOperation.Subtract)
            {
                Assert.True(result.Cache.Vertices.Length == 0);
                Assert.True(result.Cache.Indices.Length == 0);
            }
            else
            {
                Assert.True(result.Cache.Vertices.Length > 0);
                Assert.True(result.Cache.Indices.Length > 0);
            }

            output.WriteLine($"Result Cache: {result.Cache.ToString()}");
        }
Exemplo n.º 4
0
 public Group(ShapeOperation operation, Shape value1, Shape value2)
 {
     this.Operation = operation;
     this.Value1    = value1;
     this.Value2    = value2;
 }