Пример #1
0
        public Pants Clone()
        {
            Pants pants = new Pants();

            pants.Hexagon      = Hexagon.Clone();
            pants.TestCircle   = TestCircle.Clone();
            pants.CircumCircle = CircumCircle.Clone();
            return(pants);
        }
Пример #2
0
        /// <summary>
        /// Helper to check if we will affect a sticker, and cache in our list if so.
        /// </summary>
        public void WillAffectSticker(Sticker sticker, bool sphericalPuzzle)
        {
            if (AffectedStickers == null)
            {
                AffectedStickers = new List <StickerList>();
                for (int slice = 0; slice < this.NumSlices; slice++)
                {
                    AffectedStickers.Add(new List <Sticker>());
                }
            }

            if (Earthquake)
            {
                Vector3D cen = sticker.Poly.Center;
                if (Pants.IsPointInsideOptimized(cen))
                {
                    AffectedStickers[0].Add(sticker);
                }
                return;
            }

            // Slices are ordered by depth.
            // We cycle from the inner slice outward.
            for (int slice = 0; slice < this.Circles.Length; slice++)
            {
                CircleNE circle   = this.Circles[slice];
                bool     isInside = sphericalPuzzle ?
                                    circle.IsPointInsideNE(sticker.Poly.Center) :
                                    circle.IsPointInsideFast(sticker.Poly.Center);
                if (isInside)
                {
                    AffectedStickers[slice].Add(sticker);
                    return;
                }
            }

            // If we made it here for spherical puzzles, we are in the last slice.
            // Second check was needed for {3,5} 8C
            if (sphericalPuzzle &&
                (this.NumSlices != this.Circles.Length))
            {
                AffectedStickers[this.NumSlices - 1].Add(sticker);
            }
        }