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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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); }