Polygon.AddVertex C# (CSharp) Method

AddVertex() public method

public AddVertex ( Vector3 v ) : void
v Vector3
return void
    public void AddVertex(Vector3 v)
    {
        vertices.Add(v);
    }

Usage Example

示例#1
0
        void Reset()
        {
            PhysicsSimulator.Game = game;
            sim          = new PhysicsSimulator();
            sim.Gravity *= 2.0f;
            lb           = new LineBrush(game.GraphicsDevice, 1);

            poly = new Polygon();
            poly.AddVertex(0, 0);
            poly.AddVertex(0, 150);
            poly.AddVertex(100, 150);
            poly.AddVertex(100, 0);/*
                                    * poly.AddVertex(50, 100);
                                    * poly.AddVertex(50, 50);
                                    * poly.AddVertex(100, 50);
                                    * poly.AddVertex(100, 0);*/
            poly.Triangulate();

            var poly2 = new Polygon();

            poly2.AddVertex(0, 500);
            poly2.AddVertex(500, 400);
            poly2.AddVertex(800, 500);
            poly2.AddVertex(800, 600);
            poly2.AddVertex(0, 600);
            poly2.Triangulate();

            var poly3 = new Polygon();

            poly3.AddVertex(700, 0);
            poly3.AddVertex(800, 0);
            poly3.AddVertex(800, 450);
            poly3.AddVertex(700, 450);
            poly3.Triangulate();

            var circle = Polygon.BuildCircle(20, new Vector2(600), 90);

            circle.Triangulate();

            bodies = new List <Body>();
            bodies.Add(new Body(sim, game, poly, 10));
            bodies.Add(new Body(sim, game, poly2, 10));
            bodies.Add(new Body(sim, game, poly3, 10));
            bodies.Add(new Body(sim, game, circle, 10));
            //body1.AttachToGravity = false;
            bodies[1].IsStatic = true;
            bodies[2].IsStatic = true;
            bodies[3].IsStatic = true;
            //body2.IsFree = true;

            palette = new List <Color>();
            for (int i = 0; i < 10; i++)
            {
                palette.Add(GraphicsHelper.GetRandomColor());
            }
        }
All Usage Examples Of Polygon::AddVertex