BuildingCoder.CmdWallProfile.GetProfile C# (CSharp) Метод

GetProfile() статический приватный Метод

Determine the elevation boundary profile polygons of the exterior vertical planar face of the given wall solid.
static private GetProfile ( List polygons, Solid solid, XYZ v, XYZ w ) : bool
polygons List Return polygonal boundary /// loops of exterior vertical planar face, i.e. /// profile of wall elevation incl. holes
solid Solid Input solid
v XYZ
w XYZ Vector pointing along /// wall centre line
Результат bool
        static bool GetProfile(
            List<List<XYZ>> polygons,
            Solid solid,
            XYZ v,
            XYZ w)
        {
            double d, dmax = 0;
              PlanarFace outermost = null;
              FaceArray faces = solid.Faces;
              foreach( Face f in faces )
              {
            PlanarFace pf = f as PlanarFace;
            if( null != pf
              && Util.IsVertical( pf )
              && Util.IsZero( v.DotProduct( pf.FaceNormal ) ) )
            {
              d = pf.Origin.DotProduct( w );
              if( ( null == outermost )
            || ( dmax < d ) )
              {
            outermost = pf;
            dmax = d;
              }
            }
              }

              if( null != outermost )
              {
            XYZ voffset = _offset * w;
            XYZ p, q = XYZ.Zero;
            bool first;
            int i, n;
            EdgeArrayArray loops = outermost.EdgeLoops;
            foreach( EdgeArray loop in loops )
            {
              List<XYZ> vertices = new List<XYZ>();
              first = true;
              foreach( Edge e in loop )
              {
            IList<XYZ> points = e.Tessellate();
            p = points[0];
            if( !first )
            {
              Debug.Assert( p.IsAlmostEqualTo( q ),
                "expected subsequent start point"
                + " to equal previous end point" );
            }
            n = points.Count;
            q = points[n - 1];
            for( i = 0; i < n - 1; ++i )
            {
              XYZ a = points[i];
              a += voffset;
              vertices.Add( a );
            }
              }
              q += voffset;
              Debug.Assert( q.IsAlmostEqualTo( vertices[0] ),
            "expected last end point to equal"
            + " first start point" );
              polygons.Add( vertices );
            }
              }
              return null != outermost;
        }