本文整理汇总了C#中System.Vector2.ToRadians方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.ToRadians方法的具体用法?C# Vector2.ToRadians怎么用?C# Vector2.ToRadians使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector2
的用法示例。
在下文中一共展示了Vector2.ToRadians方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawEllipse
public static void DrawEllipse(GLPen p, Vector2 firstPoint, Vector2 secondPoint, float height)
{
Vector2 deltaPoint = new Vector2(firstPoint.X - secondPoint.X, firstPoint.Y - secondPoint.Y);
double angle = deltaPoint.ToRadians();
deltaPoint = deltaPoint.Rotate90();
//Vector2 thirdPoint = deltaPoint.Normalize() * height;
float length = (float)firstPoint.DistanceTo(secondPoint);
Vector2 PreRotDrawpoint = new Vector2(0, 0);
Vector2 PostRotDrawPoint = new Vector2(0, 0);
p.GLApplyPen();
Gl.glPushMatrix();
Gl.glTranslatef((float)firstPoint.X, (float)firstPoint.Y, 0);
Gl.glBegin(Gl.GL_LINE_LOOP);
for (double i = 0; i < Math.PI * 2; i += 0.05)
{
PreRotDrawpoint = new Vector2((float)(Math.Cos(i) * length), (float)(Math.Sin(i) * height));
PostRotDrawPoint = PreRotDrawpoint.Rotate(angle);
Gl.glVertex2f((float)PostRotDrawPoint.X, (float)PostRotDrawPoint.Y);
}
Gl.glEnd();
Gl.glPopMatrix();
}