With this solution, I assume that your points form a curve loop in the XY plane.
Here is a slight cleanup of your solution:
/// <summary>
/// Create a new CurveLoop from a list of points.
/// </summary>
public static CurveLoop CreateCurveLoop(
List<XYZ> pts )
{
int n = pts.Count;
CurveLoop curveLoop = new CurveLoop();
for( int i = 1; i < n; ++i )
{
curveLoop.Append( Line.CreateBound(
pts[i - 1], pts[i] ) );
}
curveLoop.Append( Line.CreateBound(
pts[n], pts[0] ) );
return curveLoop;
}
/// <summary>
/// Offset a list of points by a distance in a
/// given direction in or out of the curve loop.
/// </summary>
public static IEnumerable<XYZ> OffsetPoints(
List<XYZ> pts,
double offset,
XYZ normal )
{
CurveLoop curveLoop = CreateCurveLoop( pts );
CurveLoop curveLoop2 = CurveLoop.CreateViaOffset(
curveLoop, offset, normal );
return curveLoop2.Select<Curve, XYZ>(
c => c.GetEndPoint( 0 ) );
}
Cheers,
Jeremy