DrawLine() public static method

public static DrawLine ( Vector3 from, Vector3 to ) : void
from Vector3
to Vector3
return void
コード例 #1
0
    private void DrawPendulum()
    {
        //Draw Pendulum
        float deg         = sine * maxDeg;
        float rad         = M.Deg2Rad * deg;
        V3    pundulumPos = new V3(M.Sin(rad * timeScale), -M.Cos(rad * timeScale), 0);

        G.DrawWireSphere(pundulumPos + V3.left * 3, .2f);
        G.DrawLine(V3.zero + V3.left * 3, pundulumPos + V3.left * 3);
    }
コード例 #2
0
    private void DrawGraph()
    {
        //Draw Graph of the curves
        G.color = C.white;
        V3 offset = V3.down * 2 + V3.right * -1;

        G.DrawRay(offset + V3.up * .5f, V3.down * 1);
        G.DrawRay(offset + V3.down * .5f, V3.right * 2);

        G.color = C.gray;
        G.DrawRay(offset + V3.up * .5f, V3.right * 2);
        G.DrawRay(offset, V3.right * 2);

        G.DrawRay(offset + V3.up * .5f + V3.right * M.Repeat(radians / M.PI, 2), V3.down * 1);

        //Draw Sine
        G.color = C.red;
        offset  = V3.down * 2 + V3.right * -1;
        V3 last = new V3(0, 0, 0) + offset;

        for (int i = 1; i <= 360; i++)
        {
            V3 point = new V3((float)i / 180, M.Sin(M.Deg2Rad * i) * .5f, 0) + offset;

            G.DrawLine(last, point);
            last = point;
        }
        //Draw Cosine
        G.color = C.blue;
        offset  = V3.down * 2 + V3.right * -1;
        last    = new V3(0, .5f, 0) + offset;
        for (int i = 1; i <= 360; i++)
        {
            V3 point = new V3((float)i / 180, M.Cos(M.Deg2Rad * i) * .5f, 0) + offset;

            G.DrawLine(last, point);
            last = point;
        }
        //Draw Tangent
        if (showTan)
        {
            G.color = C.yellow;
            offset  = V3.down * 2 + V3.right * -1;
            last    = new V3(0, .5f, 0) + offset;
            for (int i = 1; i <= 360; i++)
            {
                V3 point = new V3((float)i / 180, M.Tan(M.Deg2Rad * i) * .5f, 0) + offset;

                G.DrawLine(last, point);
                last = point;
            }
        }
    }
コード例 #3
0
 private void DrawBaseCircle()
 {
     //Draw Radius
     DebugDrawers.DrawCircle(V3.zero, 1, Axis.Z, C.white, 0, 64);
     //Construct a triangle
     G.color = C.blue;
     G.DrawLine(V3.zero, new V3(cosine, sine));
     G.color = C.red;
     G.DrawLine(V3.zero, V3.right * cosine);
     G.color = C.green;
     G.DrawRay(V3.zero + V3.right * cosine, V3.up * sine);
 }
コード例 #4
0
    private void AxialInput()
    {
        offset = axialOffset;

        if (M.Abs(Input.GetAxis("Horizontal")) > 0 || M.Abs(Input.GetAxis("Vertical")) > 0)
        {
            input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
        }

        G.DrawWireCube(offset, new V3(2, 2, 0));
        G.color = C.magenta;
        G.DrawLine(offset, (Vector3)input + offset);

        var x = input.x;
        var y = input.y;

        G.color = C.red;
        G.DrawLine(offset, offset + V3.right * x);
        G.color = C.green;
        G.DrawLine(offset, offset + V3.up * y);
        G.color = C.black * .5f;
        G.DrawRay(offset, new V3(x, y).normalized);
    }