BuildingCoder.CmdWallDimensions.getFaceNaos C# (CSharp) Method

getFaceNaos() private method

Retrieve the planar face normal and origin from all of the solid's planar faces and insert them into the map mapping face normals to a list of all origins of different faces sharing this normal.
private getFaceNaos ( Dictionary naos, Solid solid ) : void
naos Dictionary Map mapping each normal vector /// to a list of the origins of all planar faces /// sharing this normal direction
solid Solid Input solid
return void
        void getFaceNaos(
            Dictionary<XYZ, List<XYZ>> naos,
            Solid solid)
        {
            foreach( Face face in solid.Faces )
              {
            PlanarFace planarFace = face as PlanarFace;
            if( null != planarFace )
            {
              XYZ normal = planarFace.FaceNormal;
              XYZ origin = planarFace.Origin;
              List<XYZ> normals = new List<XYZ>( naos.Keys );
              int i = normals.FindIndex(
            delegate( XYZ v )
            {
              return XyzParallel( v, normal );
            } );

              if( -1 == i )
              {
            Debug.Print(
                "Face at {0} has new normal {1}",
                Util.PointString( origin ),
                Util.PointString( normal ) );

            naos.Add( normal, new List<XYZ>() );
            naos[normal].Add( origin );
              }
              else
              {
            Debug.Print(
                "Face at {0} normal {1} matches {2}",
                Util.PointString( origin ),
                Util.PointString( normal ),
                Util.PointString( normals[i] ) );

            naos[normals[i]].Add( origin );
              }
            }
              }
        }