本文整理汇总了C#中Engine3D.Object3d.Rotate方法的典型用法代码示例。如果您正苦于以下问题:C# Object3d.Rotate方法的具体用法?C# Object3d.Rotate怎么用?C# Object3d.Rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine3D.Object3d
的用法示例。
在下文中一共展示了Object3d.Rotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Sphere
public static Object3d Sphere(float radius, int rings, int sectors)
{
try
{
Object3d sp = new Object3d();
sp.Name = "Sphere";
float R = 1f/(float)(rings-1);
float S = 1f/(float)(sectors-1);
float M_PI = (float)Math.PI;// *0.0174532925f; // with deg2rad
float M_PI_2 = M_PI / 2;
for(int r = 0; r < rings; r++)
{
for(int s = 0; s < sectors; s++)
{
float y =(float) Math.Sin( - M_PI_2 + M_PI * r * R );
float x = (float)Math.Cos(2 * M_PI * s * S) * (float)Math.Sin(M_PI * r * R);
float z = (float)Math.Sin(2 * M_PI * s * S) * (float)Math.Sin(M_PI * r * R);
Point3d pnt = new Point3d(x * radius, y * radius, z * radius);
sp.m_lstpoints.Add(pnt);
}
}
//indices.resize(rings * sectors * 4);
//std::vector<GLushort>::iterator i = indices.begin();
for(int r = 0; r < rings - 1; r++)
{
for (int s = 0; s < sectors - 1; s++)
{
Polygon p1 = new Polygon();
Polygon p2 = new Polygon();
sp.m_lstpolys.Add(p1);
sp.m_lstpolys.Add(p2);
p1.m_points = new Point3d[3];
p2.m_points = new Point3d[3];
p1.m_points[2] = sp.m_lstpoints[r * sectors + s];
p1.m_points[1] = sp.m_lstpoints[r * sectors + (s + 1)];
p1.m_points[0] = sp.m_lstpoints[(r + 1) * sectors + (s + 1)];
p2.m_points[2] = sp.m_lstpoints[(r + 1) * sectors + (s + 1)];
p2.m_points[1] = sp.m_lstpoints[(r + 1) * sectors + s];
p2.m_points[0] = sp.m_lstpoints[r * sectors + s];
}
}
sp.Update();
sp.Rotate(90 * 0.0174532925f, 0, 0);
sp.Update();
return sp;
}
catch(Exception ex)
{
DebugLogger.Instance().LogError(ex);
return null;
}
}