Esempio n. 1
0
 static public void DrawCircleOutline(Vector3 center, float radius)
 {
     DrawLoop(
         Floats.Line(0.0f, 360.0f, 32, true)
         .Convert(a => center + Vector2Extensions.CreateDirectionFromDegrees(a).GetSpacar() * radius)
         );
 }
Esempio n. 2
0
        static public Mesh CreateCircleOutline(float width, int number_vertexs)
        {
            Mesh mesh = new Mesh();

            int ring_vertexs = number_vertexs / 2;

            mesh.vertices = Floats.Line(0.0f, 360.0f, ring_vertexs, true)
                            .Convert(a => Vector2Extensions.CreateDirectionFromDegrees(a).GetSpacar() * 0.5f)
                            .Append(
                Floats.Line(0.0f, 360.0f, ring_vertexs, true)
                .Convert(a => Vector2Extensions.CreateDirectionFromDegrees(a).GetSpacar() * (0.5f - width))
                )
                            .ToArray();

            mesh.triangles = Ints.Range(0, ring_vertexs, false)
                             .ConvertConnections((p1, p2) =>
                                                 Enumerable.New(
                                                     p1 + ring_vertexs, p2, p1,
                                                     p1 + ring_vertexs, p2 + ring_vertexs, p2
                                                     )
                                                 )
                             .ToArray();

            mesh.RecalculateNormals();
            mesh.RecalculateBounds();
            return(mesh);
        }
Esempio n. 3
0
 static public Path CreateRegularPolygon(int number_points, float radius)
 {
     return(CreatePolygon(
                Floats.Line(0.0f, 360.0f, number_points, false)
                .Convert(a => VectorF2Extensions.CreateDirectionFromDegrees(a) * radius)
                ));
 }
Esempio n. 4
0
 static public void DrawDegreeSectorOutline(float start_angle, float end_angle, Vector3 center, float radius)
 {
     DrawLoop(
         Floats.Line(start_angle, end_angle, 32, true)
         .Convert(a => center + Vector2Extensions.CreateDirectionFromDegrees(a).GetSpacar() * radius)
         .AppendIf(start_angle.GetDegreeAngleDistance(end_angle) <= 0.0f, center)
         );
 }
Esempio n. 5
0
        static public Mesh CreateDegreeSector(float start_angle, float end_angle, int number_vertexs)
        {
            Mesh mesh = new Mesh();

            mesh.vertices = Floats.Line(start_angle, end_angle, number_vertexs - 1, true)
                            .Convert(a => Vector2Extensions.CreateDirectionFromDegrees(a).GetSpacar() * 0.5f)
                            .Prepend(new Vector3(0.0f, 0.0f, 0.0f))
                            .ToArray();

            mesh.CalculateTrianglesAsFan();

            mesh.RecalculateNormals();
            mesh.RecalculateBounds();
            return(mesh);
        }
Esempio n. 6
0
        protected override void GenerateInternal(Rect r)
        {
            rect = r;

            directions = directions = Vector2s.RadialFromDegrees(
                Floats.Line(0.0f, 360.0f, max_number_branches, false)
                ).ToList();

            active_nodes = new Queue <PathNode2D>();
            Seed(origin, Pathfinding2D.GetInstance().GetPotentialClearingRadius(origin));

            while (active_nodes.IsNotEmpty())
            {
                GrowPathNode(active_nodes.Dequeue());
            }
        }