private void CalcLoadPoint(double v, ref Polyline pl)
 {
     _n_Ed = v;
     M_Edy_NomStiff.CalcLoading();
     M_Edz_NomStiff.CalcLoading();
     double M_Ed = new Vector3d(M_Edz_NomStiff.M_Ed, M_Edy_NomStiff.M_Ed, 0).Length;
     pl.Add(new Point3d(N_Ed, 0, M_Ed));
 }
        private void CalcUtilizationNominalStiffness2()
        {

            Polyline pl_Mz = Col.CrossSec.CalculateStrengthCurve(Plane.WorldXY,Ls);

            BoundingBox bb = pl_Mz.BoundingBox;
            double N_Rdmin = bb.Min.X;

            if (M_Edy_NomStiff != null && M_Edz_NomStiff != null)
            {
                //Save original loads
                double N_temp = N_Ed;

                //Check is the bigger utilization when the eccentricity is in z, or y-direction and choose that
                ZorY = true;
                M_Edy_NomStiff.CalcLoading();
                M_Edz_NomStiff.CalcLoading();

                Vector3d direction = new Vector3d(M_Edz_NomStiff.M_Ed, M_Edy_NomStiff.M_Ed, 0);
                M_EdComb = direction.Length;
                bool success = Col.CrossSec.CalculateStresses(N_Ed, M_Edz_NomStiff.M_Ed, M_Edy_NomStiff.M_Ed, Name,Ls);
                if (!success)
                {
                    Utilization[ColumnCalculationMethod.NominalStiffness2] = 999;
                    return;
                }
                    

                //Plane calcPlane = new Plane(Point3d.Origin, direction,
                //    Vector3d.CrossProduct(direction, Vector3d.ZAxis));
                Plane calcPlane = LoadPlane;
                if (calcPlane.ZAxis.Z < 0) calcPlane.Flip();
                Plane testPlane = new Plane(calcPlane);
                testPlane.Transform(Transform.PlaneToPlane(Plane.WorldXY, Plane.WorldYZ));


                Polyline pl_temp = Col.CrossSec.CalculateStrengthCurve(calcPlane,Ls);
                pl_temp.Transform(Transform.PlaneToPlane(testPlane, Plane.WorldYZ));
                pl_temp.Transform(Transform.PlanarProjection(Plane.WorldZX));
                NMCurve = pl_temp;

                /*
                Curve pl_M = Col.CrossSec.CalculateStrengthCurve(calcPlane).ToNurbsCurve();

                pl_M.Transform(Transform.PlaneToPlane(testPlane, Plane.WorldYZ));
                pl_M.Transform(Transform.PlanarProjection(Plane.WorldZX));
                */
                Curve pl_M = pl_temp.ToNurbsCurve();
                BoundingBox bbox = pl_M.GetBoundingBox(false);
                double MinNormalForce = bbox.Min.X;

                double[] NormalForceRange = Enumerable.Range(0, 100).ToList().Select(o => (double)o).ToList().Select(o => o * MinNormalForce/100).ToArray();

                Polyline pl = new Polyline();

                CalcLoadPoint(NormalForceRange[0], ref pl);
                int i = 1;

                
                while (pl_M.Contains(pl[pl.Count - 1],Plane.WorldZX) ==PointContainment.Inside)
                {
                    CalcLoadPoint(NormalForceRange[i], ref pl);
                    i++;
                }

                //Save original values back
                _n_Ed = N_temp;
                M_Edy_NomStiff.CalcLoading();
                M_Edz_NomStiff.CalcLoading();

                Utilization[ColumnCalculationMethod.NominalStiffness2] = N_Ed / pl[pl.Count - 1].X;

                LoadCurve = pl;
            }
            else
                Utilization[ColumnCalculationMethod.NominalStiffness2] = 999;
        }