BuildingCoder.CmdWallDimensions.getMaxDistanceAlongNormal C# (CSharp) Method

getMaxDistanceAlongNormal() private method

Calculate the maximum distance between the given set of points in the given normal direction.
private getMaxDistanceAlongNormal ( List pts, XYZ normal ) : double
pts List Points to compare
normal XYZ Normal direction
return double
        double getMaxDistanceAlongNormal(
            List<XYZ> pts,
            XYZ normal)
        {
            int i, j;
              int n = pts.Count;
              double dmax = 0;

              for( i = 0; i < n - 1; ++i )
              {
            for( j = i + 1; j < n; ++j )
            {
              XYZ v = pts[i].Subtract( pts[j] );
              double d = v.DotProduct( normal );
              if( d > dmax )
              {
            dmax = d;
              }
            }
              }
              return dmax;
        }