コード例 #1
0
ファイル: RoomGroup.cs プロジェクト: vdubya/RoomKit
 /// <summary>
 /// Creates a Polygon perimeter derived from the supplied Room characteristics.
 /// </summary>
 /// <param name="room">The Room from which to derive the Polygon to place.</param>
 /// <returns>
 /// A new Polygon derived either from fixed dimensions or as a variably proportioned area.
 /// </returns>
 private Polygon RoomPerimeter(Room room)
 {
     if (room.Perimeter != null)
     {
         return(room.Perimeter);
     }
     if (room.DesignX > 0.0 && room.DesignY > 0.0)
     {
         return(Shaper.PolygonBox(room.DesignX, room.DesignY));
     }
     else
     {
         return(Shaper.AreaFromCorner(room.DesignArea, Shaper.RandomDouble(1, 2)));
     }
 }
コード例 #2
0
ファイル: Room.cs プロジェクト: vdubya/RoomKit
 /// <summary>
 /// Creates a Polygon perimeter at the origin with dimensions derived from Room characteristics. Assumes the Perimeter will be relocated and so omits setting the Room's Perimeter.
 /// </summary>
 /// <returns>
 /// A new rectilinear Polygon derived either from fixed dimensions or as a rectilinear target area of a randomly determined ratio between 1 and 2 between the Room's X and Y dimensions.
 /// </returns>
 public Polygon MakePerimeter()
 {
     if (Perimeter != null)
     {
         return(Perimeter);
     }
     if (DesignX > 0.0 && DesignY > 0.0)
     {
         return(Shaper.PolygonBox(DesignX, DesignY));
     }
     else
     {
         return(Shaper.AreaFromCorner(DesignArea, Shaper.RandomDouble(1, 2)));
     }
 }
コード例 #3
0
ファイル: Room.cs プロジェクト: vdubya/RoomKit
        /// <summary>
        /// Places a Polygon east of another Polygon, attempting to align bounding box corners or the horizontal bounding box axis.
        /// </summary>
        /// <param name="polygon">The Polygon to be placed adjacent to another Polygon.</param>
        /// <param name="adjTo">The Polygon adjacent to which the new Polygon will be located.</param>
        /// <param name="perimeter">The Polygon that must cover the resulting Polygon.</param>
        /// <param name="among">The collection of Polygons that must not intersect the resulting Polygon.</param>
        /// <returns>
        ///  A new Polygon or null if the conditions of placement cannot be satisfied.
        /// </returns>



        /// <summary>
        /// Creates and sets a rectangular Room Perimeter with dimensions derived from Room characteristics with its southwest corner at the supplied Vector3 point. If no point is supplied, the southwest corner is placed at the origin.
        /// </summary>
        /// <param name="moveTo">The Vector3 indication the location of new Polygon's southwest corner.</param>
        /// <returns>
        /// A new rectilinear Polygon derived either from fixed DesignX and DesignY dimensions or as a rectilinear target area of a random ratio between 1 and 2 of the Room's X to Y dimensions.
        /// </returns>
        public Polygon MakePerimeter(Vector3 moveTo = null)
        {
            if (DesignX > 0.0 && DesignY > 0.0)
            {
                Perimeter = Shaper.PolygonBox(DesignX, DesignY);
            }
            else
            {
                Perimeter = Shaper.AreaFromCorner(DesignArea, Shaper.RandomDouble(1, 2));
            }
            if (moveTo != null)
            {
                Perimeter = Perimeter.MoveFromTo(new Vector3(), moveTo);
            }
            return(Perimeter);
        }