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


C# OpenTK.Normalize方法代码示例

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


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

示例1: CreateIrregularCone

        /// <summary>
        /// Draws an irregeular cone
        /// </summary>
        /// <param name="strains">The x,y,z,w radii</param>
        /// <param name="top">The position of the top of the cone</param>
        /// <param name="L1">The direction of the cone</param>
        /// <param name="rot">The rotation of the cone</param>
        /// <param name="resolution">The amount of lines the cone shoud be drawn from</param>
        /// <param name="scale">The height of the cone</param>
        public static void CreateIrregularCone(OpenTK.Vector4 strains, OpenTK.Vector3 top, OpenTK.Vector3 L1, OpenTK.Quaternion rot, int resolution, float scale)
        {
            L1.Normalize();
            List<OpenTK.Vector3> positions = new List<OpenTK.Vector3>();
            positions.AddRange(GetQuarter(strains.X, strains.Y, top, L1, rot, resolution, 1, scale));
            positions.AddRange(GetQuarter(strains.Z, strains.Y, top, L1, rot, resolution, 2, scale));
            positions.AddRange(GetQuarter(strains.Z, strains.W, top, L1, rot, resolution, 3, scale));
            positions.AddRange(GetQuarter(strains.X, strains.W, top, L1, rot, resolution, 4, scale));
            OpenTK.Vector3 prev = positions.First();
            Color c;
            Color c2 = Color.black;
            int i = 0;
            foreach (OpenTK.Vector3 v in positions)
            {
                float part = ((float)i % ((float)resolution / 4f)) / ((float)resolution / 4f);
                if (i < resolution * 0.25)
                {  //Q1
                    c = Color.Lerp(Color.blue, Color.red, part);
                }
                else if (i < resolution * 0.5)
                {   //Q4
                    c = Color.Lerp(Color.red, Color.green, part);
                }
                else if (i < resolution * 0.75)
                {   //Q3
                    c = Color.Lerp(Color.green, Color.yellow, part);
                }
                else
                {   //Q2
                    c = Color.Lerp(Color.yellow, Color.blue, part);
                }
                i++;
                DrawLine(v, prev , c2);
                DrawLine(top, v , c);
                prev = v;
            }

            c = Color.blue;
            DrawLine(prev, positions.First(), c);
            DrawLine(top, positions.First(), c);
            //return positions.ToArray();
        }
开发者ID:jamesrrowland,项目名称:Qualisys-Unity-SDK,代码行数:51,代码来源:UnityDebug.cs


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