/// <summary> /// 绘制相贯线 /// </summary> protected virtual void DrawRadialLines(VertexHelper vh) { int radialLineCount = Mathf.FloorToInt(360 / graphInfo.angleSpan); for (int i = 0; i < radialLineCount; i++) { var angle = (i / (radialLineCount + 0f)) * 2 * Mathf.PI; var point = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) * Radius; vh.AddUIVertexQuad(ChartUtil.GetLine(Vector3.zero, point, graphInfo.angleLineInfo.width, graphInfo.angleLineInfo.color * color)); } }
/// <summary> /// 绘制圆环 /// </summary> protected virtual void DrawCurcles(VertexHelper vh) { for (int i = 1; i <= graphInfo.radialCount; i++) { var radius = Radius * i / (graphInfo.radialCount + 0f); var points = GetCurclePoints(radius, graphInfo.accuracy); for (int j = 0; j < points.Length - 1; j++) { var p1 = points[j]; var p2 = points[j + 1]; vh.AddUIVertexQuad(ChartUtil.GetLine(p1, p2, graphInfo.radialLineInfo.width, graphInfo.radialLineInfo.color * color)); } } }
/// <summary> /// 绘制相贯线 /// </summary> protected virtual void DrawRadialLines(VertexHelper vh) { int radialLineCount = Mathf.FloorToInt(360 / graphInfo.angleSpan); radialPoints = new Vector3[radialLineCount]; for (int i = 0; i < radialLineCount; i++) { var angle = (i / (radialLineCount + 0f)) * 360; angle += graphInfo.startAngle; if (graphInfo.clockwise) { angle = -angle; } radialPoints[i] = new Vector2(Mathf.Cos(angle * Mathf.Deg2Rad), Mathf.Sin(angle * Mathf.Deg2Rad)) * Radius; vh.AddUIVertexQuad(ChartUtil.GetLine(Vector3.zero, radialPoints[i], graphInfo.angleLineInfo.width, graphInfo.angleLineInfo.color * color)); } }
/// <summary> /// 绘制用户自定义线 /// </summary> /// <param name="vh"></param> protected virtual void DrawCustomLines(VertexHelper vh) { for (int i = 0; i < lines.Count; i++) { var line = lines[i]; var points = lines[i].positions; for (int j = 0; j < points.Length - 1; j++) { var p1 = points[j]; var p2 = points[j + 1]; vh.AddUIVertexQuad(ChartUtil.GetLine(p1, p2, line.lineInfo.width, line.lineInfo.color * color)); } if (points.Length > 2) { var p1 = points[0]; var p2 = points[points.Length - 1]; vh.AddUIVertexQuad(ChartUtil.GetLine(p1, p2, line.lineInfo.width, line.lineInfo.color * color)); } } }