/***************************************************/ public static double AreaIntegration(List <IntegrationSlice> slices, double curve, double from, double to, ref double centroid) { double result = 0; double max = System.Math.Max(from, to); double min = System.Math.Min(from, to); double sumAreaLength = 0; for (int i = 0; i < slices.Count; i++) { IntegrationSlice slice = slices[i]; if (slice.Centre + slice.Width / 2 > min && slice.Centre - slice.Width / 2 < max) { double botSlice = System.Math.Max(min, slice.Centre - slice.Width / 2); double topSlice = System.Math.Min(max, slice.Centre + slice.Width / 2); double currentCentre = (topSlice + botSlice) / 2; double currentValue = curve; double sliceWidth = (topSlice - botSlice); result += currentValue * slice.Length * sliceWidth; sumAreaLength += currentValue * slice.Length * sliceWidth * currentCentre; } } centroid = result != 0 ? sumAreaLength / result : 0; return(result); }
public static double WidthAt(this IProfile section, double y) { IntegrationSlice slice = Engine.Geometry.Query.SliceAt(section.Edges, y, 1, oM.Geometry.Plane.XZ); //Slice slice = SliceAt(y, 1, Plane.XZ());// new Plane(Point.Origin, Vector.YAxis())); return(slice.Length); }
public static double WidthAt(this IProfile section, double y, ref double[] range) { IntegrationSlice slice = Engine.Geometry.Query.SliceAt(section.Edges, y, 1, oM.Geometry.Plane.XZ); //Slice slice = SliceAt(y, 1, Plane.XZ()); range = slice.Placement; return(slice.Length); }
public static double DepthAt(this IProfile section, double x) { if (section.IsNull()) { return(0); } IntegrationSlice slice = Engine.Geometry.Query.SliceAt(section.Edges, x, 1, oM.Geometry.Plane.YZ); //Slice slice = SliceAt(x, 1, Plane.YZ());// new Plane(Point.Origin, Vector.XAxis())); return(slice.Length); }
public static double DepthAt(this IProfile section, double x, ref double[] range) { if (section.IsNull()) { return(0); } IntegrationSlice slice = Engine.Geometry.Query.SliceAt(section.Edges, x, 1, oM.Geometry.Plane.YZ); //Slice slice = SliceAt(x, 1, Plane.YZ()); range = slice.Placement; return(slice.Length); }
/***************************************************/ public static double AreaIntegration(List <IntegrationSlice> slices, double constant, double xPower, double yPower, double origin = 0) { double result = 0; for (int i = 0; i < slices.Count; i++) { IntegrationSlice slice = slices[i]; double dx = slice.Width; result += constant * System.Math.Pow(slice.Centre - origin, xPower) * System.Math.Pow(slice.Length, yPower) * dx; } return(result); }
/***************************************************/ public static double AreaIntegration(List <IntegrationSlice> slices, Vector direction, ICurve curve, double from, double to, ref double centroid) { double result = 0; double max = System.Math.Max(from, to); double min = System.Math.Min(from, to); double sumAreaLength = 0; Point origin = Point.Origin; Plane plane = new Plane { Origin = origin, Normal = direction }; for (int i = 0; i < slices.Count; i++) { IntegrationSlice slice = slices[i]; if (slice.Centre + slice.Width / 2 > min && slice.Centre - slice.Width / 2 < max) { double botSlice = System.Math.Max(min, slice.Centre - slice.Width / 2); double topSlice = System.Math.Min(max, slice.Centre + slice.Width / 2); double currentCentre = (topSlice + botSlice) / 2; double sliceWidth = (topSlice - botSlice); plane.Origin = (origin + plane.Normal * currentCentre); List <Point> points = curve.IPlaneIntersections(plane, 0.001); double currentValue = 0; if (points.Count == 2) { currentValue = System.Math.Abs(points[0].Y - points[1].Y); } else if (points.Count == 1) { currentValue = points[0].Y; } result += currentValue * slice.Length * sliceWidth; sumAreaLength += currentValue * slice.Length * sliceWidth * currentCentre; } } centroid = result != 0 ? sumAreaLength / result : 0; return(result); }
/***************************************************/ public static double AreaIntegration(List <IntegrationSlice> slices, double constant, double xPower, double yPower, double from = double.MinValue, double to = double.MaxValue, double origin = 0) { double result = 0; double max = System.Math.Max(from, to); double min = System.Math.Min(from, to); for (int i = 0; i < slices.Count; i++) { IntegrationSlice slice = slices[i]; if (slice.Centre + slice.Width / 2 > min && slice.Centre - slice.Width / 2 < max) { double botSlice = System.Math.Max(min, slice.Centre - slice.Width / 2); double topSlice = System.Math.Min(max, slice.Centre + slice.Width / 2); double sliceCentre = (topSlice + botSlice) / 2; double dx = (topSlice - botSlice); result += constant * System.Math.Pow(sliceCentre - origin, xPower) * System.Math.Pow(slice.Length, yPower) * dx; } } return(result); }
public static double PlasticModulus(List <IntegrationSlice> slices, double area, double max, double min) { double result = 0; slices = slices.OrderBy(x => x.Centre).ToList(); double plasticNeutralAxis = 0; for (int i = 0; i < slices.Count; i++) { IntegrationSlice slice = slices[i]; double sliceArea = slice.Length * slice.Width; if (result + sliceArea < area / 2) { result += sliceArea; } else { plasticNeutralAxis = slices[i - 1].Centre + slices[i - 1].Width / 2; double diff = area / 2 - result; double ratio = diff / sliceArea; plasticNeutralAxis += ratio * slice.Width; break; } } double centreTop = 0; double centreBot = 0; double areaTop = Geometry.Query.AreaIntegration(slices, 1, max, plasticNeutralAxis, ref centreTop); double areaBot = Geometry.Query.AreaIntegration(slices, 1, min, plasticNeutralAxis, ref centreBot); return(areaTop * Math.Abs(centreTop - plasticNeutralAxis) + areaBot * Math.Abs(centreBot - plasticNeutralAxis)); }