コード例 #1
0
        public Fixture CreateLineArc(float radians, int sides, float radius, bool closed)
        {
            Vertices arc = PolygonTools.CreateArc(radians, sides, radius);

            arc.Rotate((MathHelper.Pi - radians) / 2);
            return(closed ? CreateLoopShape(arc) : CreateChainShape(arc));
        }
コード例 #2
0
        public static Fixture AttachLineArc(float radians, int sides, float radius, bool closed, Body body)
        {
            var arc = PolygonTools.CreateArc(radians, sides, radius);

            arc.Rotate((MathF.PI - radians) / 2);
            return(closed ? AttachLoopShape(arc, body) : AttachChainShape(arc, body));
        }
コード例 #3
0
        public static Fixture AttachLineArc(float radians, int sides, float radius, Vector2 position, float angle, bool closed, Body body)
        {
            Vertices arc = PolygonTools.CreateArc(radians, sides, radius);

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

            return(closed ? AttachLoopShape(arc, body) : AttachChainShape(arc, body));
        }
コード例 #4
0
        public List <Fixture> CreateSolidArc(float density, float radians, int sides, float radius)
        {
            Vertices arc = PolygonTools.CreateArc(radians, sides, radius);

            arc.Rotate((MathHelper.Pi - radians) / 2);

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

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

            return(CreateCompoundPolygon(triangles, density));
        }
コード例 #5
0
        public static List <Fixture> AttachSolidArc(float density, float radians, int sides, float radius, Body body)
        {
            var arc = PolygonTools.CreateArc(radians, sides, radius);

            arc.Rotate((MathF.PI - radians) / 2);

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

            var triangles = Triangulate.ConvexPartition(arc, TriangulationAlgorithm.Earclip);

            return(AttachCompoundPolygon(triangles, density, body));
        }
コード例 #6
0
ファイル: FixtureFactory.cs プロジェクト: mikecrews/FFWD
        public static List <Fixture> AttachSolidArc(float density, float radians, int sides, float radius, Vector2 position, float angle, Body body)
        {
            Vertices arc = PolygonTools.CreateArc(radians, sides, radius);

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

            arc.Translate(ref position);

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

            List <Vertices> triangles = EarclipDecomposer.ConvexPartition(arc);

            return(AttachCompoundPolygon(triangles, density, body));
        }
コード例 #7
0
ファイル: FixtureFactory.cs プロジェクト: mikecrews/FFWD
        public static List <Fixture> AttachLineArc(float radians, int sides, float radius, Vector2 position, float angle, bool closed, Body body)
        {
            Vertices arc = PolygonTools.CreateArc(radians, sides, radius);

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

            List <Fixture> fixtures = new List <Fixture>(arc.Count);

            if (closed)
            {
                fixtures.Add(AttachLoopShape(arc, body));
            }

            for (int i = 1; i < arc.Count; i++)
            {
                fixtures.Add(AttachEdge(arc[i], arc[i - 1], body));
            }

            return(fixtures);
        }