コード例 #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)
         );
 }
コード例 #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);
        }
コード例 #3
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)
         );
 }
コード例 #4
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);
        }
コード例 #5
0
 static public void AdjustLocalRadialPlanarPositionAndRotation(this Transform item, float angle, float magnitude, float angle_offset = 0.0f)
 {
     item.AdjustLocalPlanarPositionAndRotation(Vector2Extensions.CreateDirectionFromDegrees(angle) * magnitude);
 }
コード例 #6
0
 static public void AdjustRadialPlanarPosition(this Transform item, float angle, float magnitude)
 {
     item.AdjustPlanarPosition(Vector2Extensions.CreateDirectionFromDegrees(angle) * magnitude);
 }
コード例 #7
0
        static public IEnumerable <Vector2> RadialFromPercent(float angle, IEnumerable <float> magnitudes)
        {
            Vector2 direction = Vector2Extensions.CreateDirectionFromPercent(angle);

            return(magnitudes.Convert(m => direction * m));
        }
コード例 #8
0
 static public IEnumerable <Vector2> RadialFromPercent(IEnumerable <float> angles)
 {
     return(angles.Convert(a => Vector2Extensions.CreateDirectionFromPercent(a)));
 }
コード例 #9
0
 public Vector2 GetOnArc(float low_angle, float high_angle, float radius)
 {
     return(Vector2Extensions.CreateDirectionFromDegrees(source.GetBetween(low_angle, high_angle)) * radius);
 }