コード例 #1
0
ファイル: AnalysisModel.cs プロジェクト: oozcitak/BoxCulvert
 /// <summary>
 /// Adds a new frame to the model.
 /// </summary>
 public Frame AddFrame(FrameSection section, Node n1, Node n2)
 {
     Frame n = new Frame(section, n1, n2);
     Frames.Add(n);
     return n;
 }
コード例 #2
0
ファイル: AnalysisModel.cs プロジェクト: oozcitak/BoxCulvert
 /// <summary>
 /// Divides the given frame so that it is shorter than the given length.
 /// </summary>
 public void DivideFrame(Frame f, double maxFrameSize)
 {
     int n = (int)Math.Ceiling(f.Length / maxFrameSize);
     DivideFrame(f, n);
 }
コード例 #3
0
ファイル: AnalysisModel.cs プロジェクト: oozcitak/BoxCulvert
        /// <summary>
        /// Divides the given frame into given number of pieces.
        /// </summary>
        public void DivideFrame(Frame f, int n)
        {
            Node n1 = f.NodeI;
            Node n2 = f.NodeJ;

            double xStep = (n2.X - n1.X) / (double)n;
            double zStep = (n2.Z - n1.Z) / (double)n;

            Node[] nodes = new Node[n + 1];
            nodes[0] = n1;
            nodes[nodes.Length - 1] = n2;

            double x = n1.X + xStep;
            double z = n1.Z + zStep;
            for (int i = 0; i < n - 1; i++)
            {
                nodes[i + 1] = AddNode(x, z);
                x += xStep;
                z += zStep;
            }

            Frames.Remove(f);
            for (int i = 0; i < n; i++)
            {
                Frame newFrame = AddFrame(f.Section, nodes[i], nodes[i + 1]);
                // Transfer loads
                // Uniform loads
                foreach (FrameLoad masterLoad in f.Loads.FindAll((e) => e is FrameUniformLoad))
                {
                    FrameUniformLoad masterUniformLoad = masterLoad as FrameUniformLoad;
                    newFrame.AddUniformLoad(masterUniformLoad.AnalysisCase, masterUniformLoad.FX, masterUniformLoad.FZ);
                }
                // Trapezoidal loads
                foreach (FrameLoad masterLoad in f.Loads.FindAll((e) => e is FrameTrapezoidalLoad))
                {
                    FrameTrapezoidalLoad masterTrapezoidalLoad = masterLoad as FrameTrapezoidalLoad;
                    double mxi = masterTrapezoidalLoad.FXI;
                    double mzi = masterTrapezoidalLoad.FZI;
                    double mxj = masterTrapezoidalLoad.FXJ;
                    double mzj = masterTrapezoidalLoad.FZJ;
                    double xTotal = f.Length;
                    double xStart = newFrame.NodeI.DistanceTo(f.NodeI);
                    double xEnd = newFrame.NodeJ.DistanceTo(f.NodeI);
                    double fxi = xStart / xTotal * (mxj - mxi) + mxi;
                    double fzi = xStart / xTotal * (mzj - mzi) + mzi;
                    double fxj = xEnd / xTotal * (mxj - mxi) + mxi;
                    double fzj = xEnd / xTotal * (mzj - mzi) + mzi;
                    newFrame.AddTrapezoidalLoad(masterTrapezoidalLoad.AnalysisCase, fxi, fzi, fxj, fzj);
                }
            }
        }
コード例 #4
0
ファイル: AnalysisModel.cs プロジェクト: oozcitak/BoxCulvert
 /// <summary>
 /// Adds a new frame uniform load.
 /// </summary>
 public void AddFrameUniformLoad(AnalysisCase analysisCase, Frame frame, double fx, double fz)
 {
     frame.AddUniformLoad(analysisCase, fx, fz);
 }
コード例 #5
0
ファイル: AnalysisModel.cs プロジェクト: oozcitak/BoxCulvert
 /// <summary>
 /// Adds a new frame trapezoidal load.
 /// </summary>
 public void AddFrameTrapezoidalLoad(AnalysisCase analysisCase, Frame frame, double fxi, double fzi, double fxj, double fzj)
 {
     frame.AddTrapezoidalLoad(analysisCase, fxi, fzi, fxj, fzj);
 }
コード例 #6
0
ファイル: AnalysisModel.cs プロジェクト: oozcitak/BoxCulvert
 /// <summary>
 /// Adds frame self weight load.
 /// </summary>
 public void AddFrameSelfWeight(AnalysisCase analysisCase, Frame frame)
 {
     frame.AddUniformLoad(analysisCase, 0, -frame.WeightPerLength);
 }
コード例 #7
0
ファイル: CulvertView.cs プロジェクト: oozcitak/BoxCulvert
        private void DrawInternalForce(Frame f, float forceI, float forceJ, float scale)
        {
            float x1 = (float)f.NodeI.X;
            float y1 = (float)f.NodeI.Z;
            float x2 = (float)f.NodeJ.X;
            float y2 = (float)f.NodeJ.Z;
            float orientation = (float)f.Angle;
            float loadOrientation = orientation + (float)Math.PI / 2;
            float textAngle = orientation * 180 / (float)Math.PI + 90;

            int fillAlpha = (int)((1 - mFillTransparency) * 255);
            Color negativeColor = Color.FromArgb(fillAlpha, NegativeForceColor);
            Color positiveColor = Color.FromArgb(fillAlpha, PositiveForceColor);

            float loadx1 = x1 + (float)(forceI * scale * Math.Cos(loadOrientation));
            float loady1 = y1 + (float)(forceI * scale * Math.Sin(loadOrientation));
            float loadx2 = x2 + (float)(forceJ * scale * Math.Cos(loadOrientation));
            float loady2 = y2 + (float)(forceJ * scale * Math.Sin(loadOrientation));

            if ((Math.Abs(forceI - forceJ) < float.Epsilon) || (Math.Sign(forceI) * Math.Sign(forceJ) > 0))
            {
                SimpleCAD.Polygon poly = new SimpleCAD.Polygon(new PointF[] { new PointF(x1, y1), new PointF(x2, y2), new PointF(loadx2, loady2), new PointF(loadx1, loady1) });
                poly.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent);
                poly.FillStyle = new SimpleCAD.FillStyle(forceI < 0 ? negativeColor : positiveColor);
                Model.Add(poly);
            }
            else
            {
                float xmid = Math.Abs(forceI) / Math.Abs(forceI - forceJ) * (x2 - x1) + x1;
                float ymid = Math.Abs(forceI) / Math.Abs(forceI - forceJ) * (y2 - y1) + y1;

                SimpleCAD.Polygon polyI = new SimpleCAD.Polygon(new PointF[] { new PointF(x1, y1), new PointF(xmid, ymid), new PointF(loadx1, loady1) });
                polyI.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent);
                polyI.FillStyle = new SimpleCAD.FillStyle(forceI < 0 ? negativeColor : positiveColor);
                Model.Add(polyI);

                SimpleCAD.Polygon polyJ = new SimpleCAD.Polygon(new PointF[] { new PointF(xmid, ymid), new PointF(x2, y2), new PointF(loadx2, loady2) });
                polyJ.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent);
                polyJ.FillStyle = new SimpleCAD.FillStyle(forceJ < 0 ? negativeColor : positiveColor);
                Model.Add(polyJ);
            }

            SimpleCAD.Line line1 = new SimpleCAD.Line(x1, y1, loadx1, loady1);
            line1.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line1);
            SimpleCAD.Line line2 = new SimpleCAD.Line(x2, y2, loadx2, loady2);
            line2.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line2);
            SimpleCAD.Line line3 = new SimpleCAD.Line(loadx1, loady1, loadx2, loady2);
            line3.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line3);
            SimpleCAD.Line line4 = new SimpleCAD.Line(x1, y1, x2, y2);
            line4.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line4);

            SimpleCAD.Text textI = new SimpleCAD.Text(loadx1, loady1, forceI.ToString("0.0"), TextSize);
            textI.HorizontalAlignment = StringAlignment.Near;
            textI.VerticalAlignment = StringAlignment.Center;
            textI.Rotation = textAngle;
            textI.FontFamily = Font.Name;
            textI.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(textI);

            SimpleCAD.Text textJ = new SimpleCAD.Text(loadx2, loady2, forceJ.ToString("0.0"), TextSize);
            textJ.HorizontalAlignment = StringAlignment.Near;
            textJ.VerticalAlignment = StringAlignment.Center;
            textJ.Rotation = textAngle;
            textJ.FontFamily = Font.Name;
            textJ.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(textJ);
        }
コード例 #8
0
ファイル: CulvertView.cs プロジェクト: oozcitak/BoxCulvert
        private void DrawInternalForce(Frame f, float minForceI, float minForceJ, float maxForceI, float maxForceJ, float scale)
        {
            float x1 = (float)f.NodeI.X;
            float y1 = (float)f.NodeI.Z;
            float x2 = (float)f.NodeJ.X;
            float y2 = (float)f.NodeJ.Z;
            float orientation = (float)f.Angle;
            float loadOrientation = orientation + (float)Math.PI / 2;
            float textAngle = orientation * 180 / (float)Math.PI + 90;
            int fillAlpha = (int)((1 - mFillTransparency) * 255);
            Color negativeColor = Color.FromArgb(fillAlpha, NegativeForceColor);
            Color positiveColor = Color.FromArgb(fillAlpha, PositiveForceColor);
            Color envelopeColor = Color.FromArgb(fillAlpha, EnvelopeForceColor);

            float minLoadx1 = x1 + (float)(minForceI * scale * Math.Cos(loadOrientation));
            float minLoady1 = y1 + (float)(minForceI * scale * Math.Sin(loadOrientation));
            float minLoadx2 = x2 + (float)(minForceJ * scale * Math.Cos(loadOrientation));
            float minLoady2 = y2 + (float)(minForceJ * scale * Math.Sin(loadOrientation));
            float maxLoadx1 = x1 + (float)(maxForceI * scale * Math.Cos(loadOrientation));
            float maxLoady1 = y1 + (float)(maxForceI * scale * Math.Sin(loadOrientation));
            float maxLoadx2 = x2 + (float)(maxForceJ * scale * Math.Cos(loadOrientation));
            float maxLoady2 = y2 + (float)(maxForceJ * scale * Math.Sin(loadOrientation));

            SimpleCAD.Polygon range = new SimpleCAD.Polygon(new PointF[] { new PointF(minLoadx1, minLoady1), new PointF(minLoadx2, minLoady2), new PointF(maxLoadx2, maxLoady2), new PointF(maxLoadx1, maxLoady1) });
            range.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent);
            range.FillStyle = new SimpleCAD.FillStyle(envelopeColor);
            Model.Add(range);

            if (minForceI < 0 && maxForceI < 0 && minForceI < 0 && minForceJ < 0)
            {
                SimpleCAD.Polygon poly = new SimpleCAD.Polygon(new PointF[] { new PointF(maxLoadx1, maxLoady1), new PointF(maxLoadx2, maxLoady2), new PointF(x2, y2), new PointF(x1, y1) });
                poly.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent);
                poly.FillStyle = new SimpleCAD.FillStyle(negativeColor);
                Model.Add(poly);
            }
            else if (minForceI > 0 && maxForceI > 0 && minForceI > 0 && minForceJ > 0)
            {
                SimpleCAD.Polygon poly = new SimpleCAD.Polygon(new PointF[] { new PointF(minLoadx1, minLoady1), new PointF(minLoadx2, minLoady2), new PointF(x2, y2), new PointF(x1, y1) });
                poly.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent);
                poly.FillStyle = new SimpleCAD.FillStyle(positiveColor);
                Model.Add(poly);
            }

            SimpleCAD.Line line1 = new SimpleCAD.Line(minLoadx1, minLoady1, minLoadx2, minLoady2);
            line1.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line1);
            SimpleCAD.Line line2 = new SimpleCAD.Line(maxLoadx1, maxLoady1, maxLoadx2, maxLoady2);
            line2.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line2);
            SimpleCAD.Line line3 = new SimpleCAD.Line(x1, y1, x2, y2);
            line3.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line3);
            SimpleCAD.Line line4 = new SimpleCAD.Line(minLoadx1, minLoady1, x1, y1);
            line4.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line4);
            SimpleCAD.Line line5 = new SimpleCAD.Line(minLoadx2, minLoady2, x2, y2);
            line5.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line5);
            SimpleCAD.Line line6 = new SimpleCAD.Line(maxLoadx1, maxLoady1, x1, y1);
            line6.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line6);
            SimpleCAD.Line line7 = new SimpleCAD.Line(maxLoadx2, maxLoady2, x2, y2);
            line7.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor);
            Model.Add(line7);
        }