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


C# Point3D.InvertY方法代码示例

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


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

示例1: DrawSection

        private static List<Line3D> DrawSection(AVL_File.Surface.Section sec1, AVL_File.Surface.Section sec2, int Nchord, int Cspace, int Nspan, int Sspace, double ydup, bool highlight)
        {
            //these could be defined for the entire surface, or by the section, so check
            if (Nspan == 0)
                Nspan = sec1.Nspanwise;
            if (Sspace == 0)
                Sspace = sec1.Sspace;

            Point3D LE_Sec1 = new Point3D(sec1.X_LeadingEdge, sec1.Y_LeadingEdge, sec1.Z_LeadingEdge);
            Point3D LE_Sec2 = new Point3D(sec2.X_LeadingEdge, sec2.Y_LeadingEdge, sec2.Z_LeadingEdge);

            Point3D TE_Sec1 = new Point3D(sec1.X_LeadingEdge + sec1.Chord, sec1.Y_LeadingEdge, sec1.Z_LeadingEdge);
            Point3D TE_Sec2 = new Point3D(sec2.X_LeadingEdge + sec2.Chord, sec2.Y_LeadingEdge, sec2.Z_LeadingEdge);

            List<Line3D> lines = new List<Line3D>();

            //chord-length lines stepping along the span, has to be Nspan-1 since for loop starts at 0, otherwise there will be one extra line
            Point3D d_le = (LE_Sec2 - LE_Sec1) / Nspan;
            Point3D d_te = (TE_Sec2 - TE_Sec1) / Nspan;
            for (int i = 0; i < Nspan; i++)
            {
                double space_mod = i;
                if (Sspace == 1 || Sspace == -1)//cosine distribution of lines
                    space_mod = (double)Nspan / 2 * (1 - Math.Cos(Math.PI * i / (Nspan-1)));
                else if (Sspace == -2)//negative sine distribution of lines
                    space_mod = (double)Nspan * Math.Sin((Math.PI / 2) * i / (Nspan-1));
                else if (Sspace == 2)//positive sine distribution of lines
                    space_mod = (double)Nspan + ((double)Nspan * Math.Sin((-Math.PI / 2) * i / (Nspan-1)));

                Point3D le_point = LE_Sec1 + (d_le * space_mod);
                Point3D te_point = TE_Sec1 + (d_te * space_mod);

                lines.Add(new Line3D(new Point3D[] { le_point, te_point }, highlight ? SelectedColor : LatticeColor));
                if (!double.IsNaN(ydup))
                    lines.Add(new Line3D(new Point3D[] { le_point.InvertY(ydup), te_point.InvertY(ydup) }, highlight ? SelectedColor : LatticeColor));
            }

            //span-length lines stepping down the chord
            double dx_root = sec1.Chord / (Nchord - 1);
            double dx_tip = sec2.Chord / (Nchord - 1);
            for (int i = 0; i < Nchord; i++)
            {
                double space_mod = i;
                if (Cspace == 1 || Cspace == -1)//cosine distribution of lines
                    space_mod = Nchord / 2 * (1 - Math.Cos(Math.PI * i / Nchord));
                else if (Cspace == -2)//negative sine distribution of lines
                    space_mod = Nchord * Math.Sin((Math.PI / 2) * i / Nchord);
                else if (Cspace == 2)//positive sine distribution of lines
                    space_mod = Nchord + (Nchord * Math.Sin((-Math.PI / 2) * i / Nchord));
                Point3D root_point = new Point3D(LE_Sec1.X + dx_root * i, LE_Sec1.Y, LE_Sec1.Z);
                Point3D tip_point = new Point3D(LE_Sec2.X + dx_tip * i, LE_Sec2.Y, LE_Sec2.Z);

                double controlFractionRoot = 1;
                double controlFractionTip = 1;
                foreach (AVL_File.Surface.Section.Control csurfroot in sec1.control_surfaces)
                {
                    foreach (AVL_File.Surface.Section.Control csurftip in sec2.control_surfaces)
                    {
                        if (csurfroot.Name == csurftip.Name)
                        {
                            if (csurfroot.Xhinge < controlFractionRoot)
                                controlFractionRoot = csurfroot.Xhinge;
                            if (csurftip.Xhinge < controlFractionTip)
                                controlFractionTip = csurftip.Xhinge;
                        }
                    }
                }

                Color c = LatticeColor;
                if (controlFractionTip < 1 && (root_point.X - sec1.X_LeadingEdge) / sec1.Chord > controlFractionRoot)
                    c = ControlSurfColor;
                if (controlFractionRoot < 1 && (tip_point.X - sec2.X_LeadingEdge) / sec2.Chord > controlFractionTip)
                    c = ControlSurfColor;
                if (highlight)
                    c = SelectedColor;

                lines.Add(new Line3D(new Point3D[] { root_point, tip_point }, c));//highlight ? SelectedColor : LatticeColor));
                if (!double.IsNaN(ydup))
                    lines.Add(new Line3D(new Point3D[] { root_point.InvertY(ydup), tip_point.InvertY(ydup) }, c));//highlight ? SelectedColor : LatticeColor));
            }

            return lines;
        }
开发者ID:Bome1,项目名称:AVLInterface,代码行数:83,代码来源:GeometryModeler.cs


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