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