Exemple #1
0
        public Geometry Output()
        {
            Vector3 scaleDelta = Vector3.one - Scale;

            Vector3 scale    = Scale;
            Vector3 position = Position;
            Vector3 rotation = Rotation;

            var merge = new Merge();

            for (int i = 0; i < Copies; i++)
            {
                var trans = new TransformGeometry(_geometry);
                if (i > 0)
                {
                    trans.Rotation = rotation;
                    trans.Position = position;
                    trans.Scale    = scale;
                }

                merge.Input.Add(trans.Output());

                if (i > 0)
                {
                    position += Position;
                    rotation += Rotation;
                    scale    += scaleDelta;
                }
            }

            return(merge.Output());
        }
Exemple #2
0
        public Geometry Output()
        {
            // Top
            var top = new Square();
            top.Center = new Vector3(Center.x, Center.y + Size.y/2, Center.z);
            top.Size = new Vector2(Size.x, Size.z);
            top.Surface = Surface.Triangulate;

            // Bottom
            var bottom = new Manipulate(top.Output());
            bottom.Position = new Vector3(0f, -Size.y, 0f);

            // Right wall
            var right = new Square();
            right.Orientation = OrientationPreset.ZY;
            right.Center = new Vector3(Center.x + Size.x/2, Center.y, Center.z);
            right.Size = new Vector2(Size.z, Size.y);
            right.Surface = Surface.Triangulate;

            // Left wall
            var left = new Manipulate(right.Output());
            left.Position = new Vector3(-Size.x, 0f, 0f);

            // Front wall
            var front = new Square();
            front.Orientation = OrientationPreset.XY;
            front.Center = new Vector3(Center.x, Center.y, Center.z + Size.z/2);
            front.Size = new Vector2(Size.x, Size.y);
            front.Surface = Surface.Triangulate;

            // Back wall
            var back = new Manipulate(front.Output());
            back.Position = new Vector3(0f, 0f, -Size.z);

            // Merge all sides
            Merge merge = new Merge();
            merge.Input.Add(Reverse.Process(bottom.Output()));
            merge.Input.Add(right.Output());
            merge.Input.Add(Reverse.Process(left.Output()));
            merge.Input.Add(front.Output());
            merge.Input.Add(Reverse.Process(back.Output()));
            merge.Input.Add(top.Output());

            return merge.Output();
        }
Exemple #3
0
		public Geometry Output() {
			// Top
			var top = new Square();
			top.Center = new Vector3(Center.x, Center.y + Size.y/2, Center.z);
			top.Size = new Vector2(Size.x, Size.z);
			top.Surface = Surface.Triangulate;

			// Bottom
			var bottom = new TransformGeometry(top.Output());
			bottom.Position = new Vector3(0f, -Size.y, 0f);

			// Right wall
			var right = new Square();
			right.Orientation = OrientationPreset.ZY;
			right.Center = new Vector3(Center.x + Size.x/2, Center.y, Center.z);
			right.Size = new Vector2(Size.z, Size.y);
			right.Surface = Surface.Triangulate;

			// Left wall
			var left = new TransformGeometry(right.Output());
			left.Position = new Vector3(-Size.x, 0f, 0f);

			// Front wall
			var front = new Square();
			front.Orientation = OrientationPreset.XY;
			front.Center = new Vector3(Center.x, Center.y, Center.z + Size.z/2);
			front.Size = new Vector2(Size.x, Size.y);
			front.Surface = Surface.Triangulate;

			// Back wall
			var back = new TransformGeometry(front.Output());
			back.Position = new Vector3(0f, 0f, -Size.z);

			// Merge all sides
			Merge merge = new Merge();
			merge.Input.Add(FlipFaces.Process(bottom.Output()));
			merge.Input.Add(right.Output());
			merge.Input.Add(FlipFaces.Process(left.Output()));
			merge.Input.Add(front.Output());
			merge.Input.Add(FlipFaces.Process(back.Output()));
			merge.Input.Add(top.Output());

			return merge.Output();
		}
Exemple #4
0
		public Geometry Output() {

			if (Segments <= 1) {
				OperatorError = "Segments must be greater than 1";
				return Geometry.Empty;
			} else {
				OperatorError = null;
			}

			var bottom = new Circle();
			bottom.Radius = Radius;
			bottom.Segments = Segments;
			bottom.Center = new Vector3(Center.x, Center.y - Height/2, Center.z);

			var top = new Circle();
			top.Radius = Radius;
			top.Segments = Segments;
			top.Center = new Vector3(Center.x, Center.y + Height/2, Center.z);

			var scaffold = new Merge(bottom.Output(), top.Output());

			var bridge = new Bridge(scaffold.Output());
			bridge.ClosePolygons = true;

			var cylinder = new Merge(bridge.Output());

			if (CapTop) {
				top.Surface = true;
				cylinder.Input.Add(top.Output());
			}

			if (CapBottom) {
				bottom.Surface = true;
				cylinder.Input.Add(Reverse.Process(bottom.Output()));
			}

			var geo = cylinder.Output();
			geo.ApplyOrientation(Orientation);
			return geo;
		}
Exemple #5
0
 public static Geometry Process(params Geometry[] geometries)
 {
     Merge merge = new Merge(geometries);
     return merge.Output();
 }
Exemple #6
0
        public static Geometry Process(params Geometry[] geometries)
        {
            Merge merge = new Merge(geometries);

            return(merge.Output());
        }