public double CalculateValue(SlabModelImpl aSlabModel) { if (aSlabModel == null) { throw new ArgumentNullException("aSlabModel"); } var indent = 30.0; // 3 см. // вычисляем середину слитка. var coordinateX = aSlabModel.GetLeftLimit() + 300; // отступ 30 см слева. var leftPoint = aSlabModel.GetTopSidePoint(coordinateX, indent); var rightPoint = aSlabModel.GetTopSidePoint(coordinateX, aSlabModel.GetLengthLimit() - indent); var middlePoint = aSlabModel.GetTopSidePoint(coordinateX, aSlabModel.GetLengthLimit()/2); return Math.Round(middlePoint.DistanceToLine(leftPoint, rightPoint), 4); }
public double CalculateValue(SlabModelImpl aSlabModel) { if (aSlabModel == null) { throw new ArgumentNullException("aSlabModel"); } // вычисляем середину слитка. var positionX = 0.5 * (aSlabModel.GetRightLimit() + aSlabModel.GetLeftLimit()); //var positionX = 0; // отступаем 10 см от торца слитка. var positionZ = 100; var topPoint = aSlabModel.GetTopSidePoint(positionX, positionZ); var bottomPoint = aSlabModel.GetBottomSidePoint(positionX, positionZ); var height = Math.Round(topPoint.Y - bottomPoint.Y, 4, MidpointRounding.ToEven); return height; }