private void DrawRod(Vector3 pos, Quaternion rot) { Vector3 axisX = rot * Vector3.right; Vector3 axisY = rot * Vector3.up; Vector3 axisZ = rot * Vector3.forward; Vector3 offsetX = 0.5f * kRodThickness * axisX; Vector3 offsetY = 0.5f * (kRodLegnth - kRodThickness) * axisY; Vector3 offsetZ = 0.5f * kRodThickness * axisZ; Vector2 dimsSide = new Vector2(kRodThickness, kRodLegnth); Vector2 dimsCap = new Vector2(kRodThickness, kRodThickness); Quaternion q = Quaternion.AngleAxis(90.0f, Vector3.right); Quaternion r = Quaternion.AngleAxis(90.0f, Vector3.up); // sides DebugUtil.DrawRect(pos + offsetZ + offsetY, rot * q, dimsSide, Color.red, true, DebugUtil.Style.FlatShaded); DebugUtil.DrawRect(pos + offsetX + offsetY, rot * r * q, dimsSide, Color.green, true, DebugUtil.Style.FlatShaded); DebugUtil.DrawRect(pos - offsetZ + offsetY, rot * r * r * q, dimsSide, Color.red, true, DebugUtil.Style.FlatShaded); DebugUtil.DrawRect(pos - offsetX + offsetY, rot * r * r * r * q, dimsSide, Color.green, true, DebugUtil.Style.FlatShaded); // caps DebugUtil.DrawRect(pos - (0.5f * kRodThickness) * axisY, rot, dimsCap, Color.yellow, true, DebugUtil.Style.FlatShaded); DebugUtil.DrawRect(pos + (kRodLegnth - 0.5f * kRodThickness) * axisY, rot, dimsCap, Color.yellow, true, DebugUtil.Style.FlatShaded); // rotationAxis DebugUtil.DrawArrow(pos, pos + 1.2f * m_rotDiffAxis, 0.1f, 0.3f, 32, 0.03f, Color.cyan, true, DebugUtil.Style.SmoothShaded); }
private void Draw(Vector3[] value) { for (int x = 0; x < value.GetLength(0); ++x) { Vector3 p = ComputePoint(x); Color c = ComputeColor(p, ComputePoint(0), ComputePoint(m_gridExtent - 1), 0.8f); DebugUtil.DrawArrow(p, p + m_elementSize * value[x], 0.05f, c, true, DebugUtil.Style.FlatShaded); } }
private void DrawArrowSegments(Vector3 center) { Vector3 v0 = center + m_basePos - 0.7f * (m_baseRotQuat * Vector3.up); Vector3 v1 = center + m_basePos + 0.7f * (m_baseRotQuat * Vector3.up); int numSegments = (int)Mathf.Floor(6.0f + 8.0f * (1.0f + Mathf.Sin(m_phase))); Color color = (m_style == DebugUtil.Style.Wireframe ? m_wireframeColor : new Color(0.9f, 0.9f, 0.1f)); DebugUtil.DrawArrow(v0, v1, 0.4f, 0.8f, numSegments, 0.0f, color, true, m_style); }
private void Draw(Vector2[,] value) { for (int y = 0; y < value.GetLength(1); ++y) { for (int x = 0; x < value.GetLength(0); ++x) { Vector3 p = ComputePoint(x, y); Color c = ComputeColor(p, ComputePoint(0, 0), ComputePoint(m_gridExtent - 1, m_gridExtent - 1), 0.6f); DebugUtil.DrawArrow(p, p + m_elementSize * (new Vector3(value[y, x].x, value[y, x].y, 0.0f)), 0.05f, c, true, DebugUtil.Style.FlatShaded); } } }
private void DrawArrowDimensions(Vector3 center) { float height = 1.1f + 0.3f * Mathf.Sin(m_phase); float radius = 0.3f - 0.1f * Mathf.Cos(m_phase); Vector3 v0 = center + m_basePos - 0.5f * height * (m_baseRotQuat * Vector3.up); Vector3 v1 = center + m_basePos + 0.5f * height * (m_baseRotQuat * Vector3.up); int numSegments = (int)Mathf.Floor(6.0f + 8.0f * (1.0f + Mathf.Sin(m_phase))); Color color = (m_style == DebugUtil.Style.Wireframe ? m_wireframeColor : new Color(0.9f, 0.9f, 0.1f)); DebugUtil.DrawArrow(v0, v1, radius, 2.0f * radius, numSegments, radius * 0.4f, color, true, m_style); }
private void Draw(Vector3[,,] value) { for (int z = 0; z < value.GetLength(2); ++z) { for (int y = 0; y < value.GetLength(1); ++y) { for (int x = 0; x < value.GetLength(0); ++x) { Vector3 p = ComputePoint(x, y, z); Color c = ComputeColor(p, ComputePoint(0, 0, m_gridExtent - 1), ComputePoint(m_gridExtent - 1, m_gridExtent - 1, 0), 0.1f); DebugUtil.DrawArrow(p, p + m_elementSize * value[z, y, x], 0.05f, c, true, DebugUtil.Style.FlatShaded); } } } }
private void Draw(Vector2[] input, Vector3[] value) { for (int i = 0; i < input.Length; ++i) { float farMult = (input.Length == m_gridExtent) ? 0.8f : 0.6f; Vector3 p = (input.Length == m_gridExtent) ? ComputePoint((int)input[i].x) : ComputePoint((int)input[i].x, (int)input[i].y); Color c = ComputeColor(p, ComputePoint(0, 0, m_gridExtent - 1), ComputePoint(m_gridExtent - 1, m_gridExtent - 1, 0), farMult); DebugUtil.DrawArrow(p, p + m_elementSize * value[i], 0.05f, c, true, DebugUtil.Style.FlatShaded); } }