Exemplo n.º 1
0
        //this method uses vector algebra to get the piece of wall ocuppied by an opening
        private Wall PieceOfOccupiedWall(Opening anOpening, Wall itsWall)
        {
            float opLength         = anOpening.Length();
            Point beginning        = itsWall.Beginning();
            Point end              = itsWall.End();
            Point positiveVector   = beginning - end;
            Point negativeVector   = end - beginning;
            Point beginningOfPiece = anOpening.GetPosition().PointInSameLineAtSomeDistance(negativeVector, opLength / 2);
            Point endOfPiece       = anOpening.GetPosition().PointInSameLineAtSomeDistance(positiveVector, opLength / 2);
            Wall  piece            = new Wall(beginningOfPiece, endOfPiece);

            return(piece);
        }
        public override bool Equals(object obj)
        {
            bool areEqual;

            if (obj == null)
            {
                areEqual = false;
            }
            else
            {
                Opening otherOpening = (Opening)obj;
                areEqual = position.Equals(otherOpening.GetPosition());
            }
            return(areEqual);
        }