コード例 #1
0
ファイル: StructureType.cs プロジェクト: KaVisscher/MiStrAn
        public void AlignMaterialAxisWithCurves(Curve[] dirCurves)
        {
            for (int i = 0; i < elements.Count; i++)
            {
                ShellElement elem     = elements[i];
                Point3d      centroid = elem.Centroid.ToRhinoPoint3d();
                double       t;
                Curve        dirCurve = FindClosestCurve(dirCurves, centroid, out t);

                Vector3d dirVec = dirCurve.TangentAt(t);

                Vector3D e1_, e2_, e3_;
                elem.GetLocalCoordinateSystem(out e1_, out e2_, out e3_);
                Vector3d e1 = e1_.ToRhinoVector3d(), e2 = e2_.ToRhinoVector3d(), e3 = e3_.ToRhinoVector3d();
                Plane    P = new Plane(centroid, e3);

                double alpha = Vector3d.VectorAngle(e1, dirVec, P);

                if (Double.IsNaN(alpha) || Double.IsInfinity(alpha) || Math.Abs(alpha) > Math.PI * 2)
                {
                    SetDefaultMaterialOrientationAngle(i);
                }

                else
                {
                    elem.MaterialOrientationAngle = (alpha / (2 * Math.PI)) * 360;
                }
            }
        }
コード例 #2
0
ファイル: StructureType.cs プロジェクト: KaVisscher/MiStrAn
        public void GeneratePrincipalStressLines()
        {
            PrincipalStressLinesX = new List <Line>();
            PrincipalStressLinesY = new List <Line>();


            for (int i = 0; i < NumberOfElements; i++)
            {
                Vector3D     e1, e2, e3;
                ShellElement ele = elements[i];

                ele.GetLocalCoordinateSystem(out e1, out e2, out e3);

                double L      = ele.GetPerimeterLength();
                double scaler = 0.1 * L;

                Point3d C = ele.Centroid.ToRhinoPoint3d();

                Transform T = Transform.Rotation(PrincipalAngles[i], e3.ToRhinoVector3d(), C);

                //Vector3d p1 = e1.ToRhinoVector3d();
                //Vector3d p2 = e2.ToRhinoVector3d();
                //p1.Transform(T);
                //p2.Transform(T);

                Line X = new Line(C - scaler * e1.ToRhinoVector3d(), C + scaler * e1.ToRhinoVector3d());
                Line Y = new Line(C - scaler * e2.ToRhinoVector3d(), C + scaler * e2.ToRhinoVector3d());

                X.Transform(T);
                Y.Transform(T);

                PrincipalStressLinesX.Add(X);
                PrincipalStressLinesY.Add(Y);
            }
        }
コード例 #3
0
ファイル: StructureType.cs プロジェクト: KaVisscher/MiStrAn
        public void SetDefaultMaterialOrientationAngle(int elementIndex)
        {
            Vector3D e1, e2, e3, C;

            ShellElement ele = elements[elementIndex];

            ele.GetLocalCoordinateSystem(out e1, out e2, out e3);
            C = ele.Centroid;

            Plane  P     = new Plane(C.ToRhinoPoint3d(), e3.ToRhinoVector3d());
            double alpha = Vector3d.VectorAngle(e1.ToRhinoVector3d(), Vector3d.XAxis, P);

            if (Double.IsNaN(alpha) || Double.IsInfinity(alpha) || Math.Abs(alpha) > Math.PI * 2)
            {
                alpha = Vector3d.VectorAngle(e1.ToRhinoVector3d(), Vector3d.YAxis, P);
            }

            ele.MaterialOrientationAngle = (alpha / (2 * Math.PI)) * 360;
        }