Here are the examples of the csharp api XCharts.ChartDrawer.DrawPolygon(UnityEngine.UI.VertexHelper, UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Color32) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
19
Source : ChartDrawer.cs
with MIT License
from huanzi-qch
with MIT License
from huanzi-qch
public static void DrawBorder(VertexHelper vh, Vector3 p, float rectWidth, float rectHeight,
float borderWidth, Color32 color)
{
var halfWid = rectWidth / 2;
var halfHig = rectHeight / 2;
var p1In = new Vector3(p.x - halfWid, p.y - halfHig);
var p1Ot = new Vector3(p.x - halfWid - borderWidth, p.y - halfHig - borderWidth);
var p2In = new Vector3(p.x - halfWid, p.y + halfHig);
var p2Ot = new Vector3(p.x - halfWid - borderWidth, p.y + halfHig + borderWidth);
var p3In = new Vector3(p.x + halfWid, p.y + halfHig);
var p3Ot = new Vector3(p.x + halfWid + borderWidth, p.y + halfHig + borderWidth);
var p4In = new Vector3(p.x + halfWid, p.y - halfHig);
var p4Ot = new Vector3(p.x + halfWid + borderWidth, p.y - halfHig - borderWidth);
DrawPolygon(vh, p1In, p1Ot, p2Ot, p2In, color);
DrawPolygon(vh, p2In, p2Ot, p3Ot, p3In, color);
DrawPolygon(vh, p3In, p3Ot, p4Ot, p4In, color);
DrawPolygon(vh, p4In, p4Ot, p1Ot, p1In, color);
}
19
Source : ChartDrawer.cs
with MIT License
from huanzi-qch
with MIT License
from huanzi-qch
public static void DrawDoughnut(VertexHelper vh, Vector3 p, float insideRadius, float outsideRadius,
Color32 color, Color emptyColor, float smoothness = 2f, float startDegree = 0, float toDegree = 360)
{
if (insideRadius <= 0)
{
DrawSector(vh, p, outsideRadius, color, startDegree, toDegree, smoothness);
return;
}
Vector3 p1, p2, p3, p4;
int segments = (int)((2 * Mathf.PI * outsideRadius) / (smoothness < 0 ? 2f : smoothness));
float startAngle = startDegree * Mathf.Deg2Rad;
float angle = (toDegree - startDegree) * Mathf.Deg2Rad / segments;
p1 = new Vector3(p.x + insideRadius * Mathf.Sin(startAngle),
p.y + insideRadius * Mathf.Cos(startAngle));
p2 = new Vector3(p.x + outsideRadius * Mathf.Sin(startAngle),
p.y + outsideRadius * Mathf.Cos(startAngle));
for (int i = 0; i <= segments; i++)
{
float currAngle = startAngle + i * angle;
p3 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle),
p.y + outsideRadius * Mathf.Cos(currAngle));
p4 = new Vector3(p.x + insideRadius * Mathf.Sin(currAngle),
p.y + insideRadius * Mathf.Cos(currAngle));
if (emptyColor != Color.clear) DrawTriangle(vh, p, p1, p4, emptyColor);
DrawPolygon(vh, p1, p2, p3, p4, color);
p1 = p4;
p2 = p3;
}
}