本文整理汇总了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();
}