Exemplo n.º 1
0
        /// <summary>
        /// Returns a copy of the supplied Space displaced by the supplied Vector3.
        /// </summary>
        /// <param name="space">The Space instance to be copied.</param>
        /// <param name="moveBy">Displacement of each Space from the previous instance.</param>
        /// <returns>
        /// A new space.
        /// </returns>
        public static Space CopyPlace(Space space, Vector3 moveBy)
        {
            var vertices = new List <Vector3>();

            foreach (Vector3 vertex in space.Profile.Perimeter.Vertices)
            {
                vertices.Add(new Vector3(vertex.X + moveBy.X, vertex.Y + moveBy.Y));
            }
            var polygon    = new Polygon(vertices);
            var elevation  = space.Elevation + moveBy.Z;
            var movedSpace = new Space(new Profile(polygon), elevation, space.Height, space.Material);

            foreach (string key in space.Parameters.Keys)
            {
                movedSpace.AddParameter(key, (Parameter)space.Parameters[key]);
            }
            return(movedSpace);
        }