コード例 #1
0
ファイル: FixtureFactory.cs プロジェクト: yuruyigit/TrueSync
        public static Fixture AttachLineArc(FP radians, int sides, FP radius, TSVector2 position, FP angle, bool closed, Body body)
        {
            Vertices vertices = PolygonTools.CreateArc(radians, sides, radius);

            vertices.Rotate((MathHelper.Pi - radians) / 2 + angle);
            vertices.Translate(ref position);
            return(closed ? FixtureFactory.AttachLoopShape(vertices, body, null) : FixtureFactory.AttachChainShape(vertices, body, null));
        }
コード例 #2
0
        public static Fixture AttachLineArc(FP radians, int sides, FP radius, TSVector2 position, FP angle, bool closed, Body body)
        {
            Vertices arc = PolygonTools.CreateArc(radians, sides, radius);

            arc.Rotate((FP.Pi - radians) / 2 + angle);
            arc.Translate(ref position);

            return(closed ? AttachLoopShape(arc, body) : AttachChainShape(arc, body));
        }
コード例 #3
0
ファイル: FixtureFactory.cs プロジェクト: yuruyigit/TrueSync
        public static List <Fixture> AttachSolidArc(FP density, FP radians, int sides, FP radius, TSVector2 position, FP angle, Body body)
        {
            Vertices vertices = PolygonTools.CreateArc(radians, sides, radius);

            vertices.Rotate((MathHelper.Pi - radians) / 2 + angle);
            vertices.Translate(ref position);
            vertices.Add(vertices[0]);
            List <Vertices> list = Triangulate.ConvexPartition(vertices, TriangulationAlgorithm.Earclip, true, FP.EN3);

            return(FixtureFactory.AttachCompoundPolygon(list, density, body, null));
        }
コード例 #4
0
        public static List <Fixture> AttachSolidArc(FP density, FP radians, int sides, FP radius, TSVector2 position, FP angle, Body body)
        {
            Vertices arc = PolygonTools.CreateArc(radians, sides, radius);

            arc.Rotate((FP.Pi - radians) / 2 + angle);

            arc.Translate(ref position);

            //Close the arc
            arc.Add(arc[0]);

            List <Vertices> triangles = Triangulate.ConvexPartition(arc, TriangulationAlgorithm.Earclip, true, FP.EN3);

            return(AttachCompoundPolygon(triangles, density, body));
        }