Exemplo n.º 1
0
        public override Shape Clone()
        {
            ChainShape clone = new ChainShape();

            clone.ShapeType      = ShapeType;
            clone._density       = _density;
            clone._radius        = _radius;
            clone.PrevVertex     = _prevVertex;
            clone.NextVertex     = _nextVertex;
            clone._hasNextVertex = _hasNextVertex;
            clone._hasPrevVertex = _hasPrevVertex;
            clone.Vertices       = new Vertices(Vertices);
            clone.MassData       = MassData;
            return(clone);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Compare the chain to another chain
        /// </summary>
        /// <param name="shape">The other chain</param>
        /// <returns>True if the two chain shapes are the same</returns>
        public bool CompareTo(ChainShape shape)
        {
            if (Vertices.Count != shape.Vertices.Count)
            {
                return(false);
            }

            for (int i = 0; i < Vertices.Count; i++)
            {
                if (Vertices[i] != shape.Vertices[i])
                {
                    return(false);
                }
            }

            return(PrevVertex == shape.PrevVertex && NextVertex == shape.NextVertex);
        }