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


C# Vertices.Rotate方法代码示例

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


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

示例1: CreateFanPiece

    public static PolygonShape CreateFanPiece(float sideLength, float interiorAngle, float rotationAngle)
    {
        FVector2[] pointList = new FVector2[3];

        interiorAngle = Mathf.PI/180.0f*interiorAngle;
        rotationAngle = Mathf.PI/180.0f*rotationAngle;

        pointList[0] = new FVector2(0.0f, 0.0f);
        pointList[1] = new FVector2(sideLength, 0.0f);
        pointList[2] = new FVector2(sideLength*Mathf.Cos(interiorAngle), sideLength*Mathf.Sin(interiorAngle));

        Vertices vertices = new Vertices(pointList);
        vertices.Rotate(rotationAngle);

        return new PolygonShape(vertices, 1.0f);
    }
开发者ID:JazzMcFly,项目名称:GreenRabbit,代码行数:16,代码来源:TriangleIsosceles.cs

示例2: CreateFanSet

    //More efficient b/c uses Sin/Cos only once
    public static PolygonShape[] CreateFanSet(float radius, float fanAngle, int shardCount, int density)
    {
        PolygonShape[] shapeList = new PolygonShape[shardCount];

        float interiorAngle = fanAngle / ((float) shardCount) * Mathf.PI/180.0f;

        FVector2[] pointList = new FVector2[3];
        pointList[0] = new FVector2(0.0f, 0.0f);
        pointList[1] = new FVector2(radius, 0.0f);
        pointList[2] = new FVector2(radius*Mathf.Cos(interiorAngle), radius*Mathf.Sin(interiorAngle));

        Vertices vertices = new Vertices(pointList);

        for(int index = 0; index < shardCount; index++) {
            shapeList[index] = new PolygonShape(vertices, density); //PolygonShape makes a deep copy of vertices so I can reuse this sucker
            vertices.Rotate(interiorAngle);
        }

        return shapeList;
    }
开发者ID:JazzMcFly,项目名称:GreenRabbit,代码行数:21,代码来源:TriangleIsosceles.cs

示例3: ObstacleVertices

 private static Vertices ObstacleVertices(int width, float rotate, bool flip)
 {
     var corners = flip ? new Vector2[] {
         new Vector2(0f,0f),
         new Vector2(width*60f, -60f),
         new Vector2(width*60f, 0f),
     } : new Vector2[] {
         new Vector2(0f,0f),
         new Vector2(width*60f, 0f),
         new Vector2(width*60f, 60f),
     };
     var vert = new Vertices(corners);
     vert.Rotate(rotate.ToRadians());
     var flipVect = new Vector2(1f, -1f);
     return vert;
 }
开发者ID:rbrother,项目名称:seikkailulaakso,代码行数:16,代码来源:Obstacle.cs


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