private void MergeWalls(Wall wall1, Wall wall2) { Point intersection; if (wall1.Beginning().Equals(wall2.Beginning()) || wall1.Beginning().Equals(wall2.End())) { intersection = wall1.Beginning(); } else { intersection = wall1.End(); } Wall newWall = wall1.MergeCollinearContinuous(wall2); materials.RemoveWall(wall1); materials.RemoveWall(wall2); RemoveBeamInPoint(intersection); materials.AddWall(newWall); }