当前位置: 首页>>代码示例>>C#>>正文


C# BoundingBox.Inflate方法代码示例

本文整理汇总了C#中Rhino.Geometry.BoundingBox.Inflate方法的典型用法代码示例。如果您正苦于以下问题:C# BoundingBox.Inflate方法的具体用法?C# BoundingBox.Inflate怎么用?C# BoundingBox.Inflate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rhino.Geometry.BoundingBox的用法示例。


在下文中一共展示了BoundingBox.Inflate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Clear lists
            _dispCrvN.Clear();
            _dispCrvVy.Clear();
            _dispCrvVz.Clear();
            _dispCrvT.Clear();
            _dispCrvMyy.Clear();
            _dispCrvMzz.Clear();
            _bbPts.Clear();

            ////// INDATA //////
            List<ResultElement> res = new List<ResultElement>();
            List<bool> dispToggles = new List<bool>();
            List<double> sFacs = new List<double>();
            string name = null;
            // Result element
            if (!DA.GetDataList(0, res)) { return; }

            // Display toggles
            if (!DA.GetDataList(1, dispToggles)) { return; }
            if (dispToggles.Count != 6)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Number of bools in input should be 6");
                return;
            }

            // Scaling factors
            if (!DA.GetDataList(2, sFacs)) { return; }
            bool sFacInputCorrect = false;
            if (sFacs.Count == 6)
                sFacInputCorrect = true;
            else if (sFacs.Count == 1)
            {
                sFacs.AddRange(new List<double> { sFacs[0], sFacs[0], sFacs[0], sFacs[0], sFacs[0] });
                sFacInputCorrect = true;
            }
            if (!sFacInputCorrect)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Number of scale factors in input should be 1 or 6");
                return;
            }

            if (!DA.GetData(3, ref name))
            {
                if (res.Count > 0)
                {
                    name = res[0].N1.First().Key;
                }
            }

            // Now it is assumed that all inputs are correct

            // Get toggles and scaling factors
            bool bN = dispToggles[0];       double sfN = sFacs[0];
            bool bVy = dispToggles[1];      double sfVy = sFacs[1];
            bool bVz = dispToggles[2];      double sfVz = sFacs[2];
            bool bT = dispToggles[3];       double sfT = sFacs[3];
            bool bMyy = dispToggles[4];     double sfMyy = sFacs[4];
            bool bMzz = dispToggles[5];     double sfMzz = sFacs[5];

            foreach (ResultElement re in res)
            {
                // Get element orientation
                Vector3d elX = re.LocalX;
                Vector3d elY = re.LocalY;
                Vector3d elZ = re.elNormal;

                ////// START DRAWING STUFF //////

                // Normal force
                if (bN)
                    _dispCrvN.AddRange(CreateCurvesFromResults(re, re.N1[name], elZ, sfN));

                // Shear force in weak direction
                if (bVy)
                    _dispCrvVy.AddRange(CreateCurvesFromResults(re, re.Vy[name], elY, sfVy));

                // Shear force in strong direction
                if (bVz)
                    _dispCrvVz.AddRange(CreateCurvesFromResults(re, re.Vz[name], elZ, sfVz));

                // Torsion
                if (bT)
                    _dispCrvT.AddRange(CreateCurvesFromResults(re, re.T[name], elZ, sfT));

                // Moment around minor axis (bending in strong direction)
                if (bMyy)
                    _dispCrvMyy.AddRange(CreateCurvesFromResults(re, re.My[name], elZ, sfMyy));

                // Moment around major axis (bending in weak direction)
                if (bMzz)
                    _dispCrvMzz.AddRange(CreateCurvesFromResults(re, re.Mz[name], elY, sfMzz));
            }

            // Set bounding box
            _bb = new BoundingBox(_bbPts);
            _bb.Inflate(1.2); //Increase size by 20% to include all parts of all curves
        }
开发者ID:IsakNaslund,项目名称:MasterThesis,代码行数:99,代码来源:DisplayResultElementsComponent.cs


注:本文中的Rhino.Geometry.BoundingBox.Inflate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。