|
|
|
|
|
|
float dlx = dy; |
|
|
|
float dly = -dx; |
|
|
|
|
|
|
|
|
|
|
|
dst.Add(new Vector2(px + dlx * w, py + dly * w)); |
|
|
|
dst.Add(new Vector2(px - dlx * w, py - dly * w)); |
|
|
|
float a = i / (ncap - 1) * Mathf.PI; |
|
|
|
float a = (float) i / (ncap - 1) * Mathf.PI; |
|
|
|
dst.Add(new Vector2(px - dlx * ax - dx * ay, py - dly * ax - dy * ay)); |
|
|
|
dst.Add(new Vector2(px - dlx * ax + dx * ay, py - dly * ax + dy * ay)); |
|
|
|
|
|
|
|
dst.Add(new Vector2(px + dlx * w, py + dly * w)); |
|
|
|
dst.Add(new Vector2(px - dlx * w, py - dly * w)); |
|
|
|
} |
|
|
|
|
|
|
|
public static void roundCapEnd(this List<Vector3> dst, PathPoint p, |
|
|
|
|
|
|
float dlx = dy; |
|
|
|
float dly = -dx; |
|
|
|
|
|
|
|
dst.Add(new Vector2(px + dlx * w, py + dly * w)); |
|
|
|
dst.Add(new Vector2(px - dlx * w, py - dly * w)); |
|
|
|
|
|
|
|
float a = i / (ncap - 1) * Mathf.PI; |
|
|
|
float a = (float) i / (ncap - 1) * Mathf.PI; |
|
|
|
dst.Add(new Vector2(px - dlx * ax - dx * ay, py - dly * ax - dy * ay)); |
|
|
|
dst.Add(new Vector2(px - dlx * ax + dx * ay, py - dly * ax + dy * ay)); |
|
|
|
|
|
|
|
dst.Add(new Vector2(px + dlx * w, py + dly * w)); |
|
|
|
dst.Add(new Vector2(px - dlx * w, py - dly * w)); |
|
|
|
} |
|
|
|
|
|
|
|
public static void chooseBevel(bool bevel, PathPoint p0, PathPoint p1, float w, |
|
|
|
|
|
|
|
|
|
|
var n = Mathf.CeilToInt((a0 - a1) / Mathf.PI * ncap).clamp(2, ncap); |
|
|
|
for (var i = 0; i < n; i++) { |
|
|
|
float u = i / (n - 1); |
|
|
|
float u = (float) i / (n - 1); |
|
|
|
float a = a0 + u * (a1 - a0); |
|
|
|
float rx = p1.x + Mathf.Cos(a) * rw; |
|
|
|
float ry = p1.y + Mathf.Sin(a) * rw; |
|
|
|
|
|
|
|
|
|
|
var n = Mathf.CeilToInt((a1 - a0) / Mathf.PI * ncap).clamp(2, ncap); |
|
|
|
for (var i = 0; i < n; i++) { |
|
|
|
float u = i / (n - 1); |
|
|
|
float u = (float) i / (n - 1); |
|
|
|
float a = a0 + u * (a1 - a0); |
|
|
|
float lx = p1.x + Mathf.Cos(a) * lw; |
|
|
|
float ly = p1.y + Mathf.Sin(a) * lw; |
|
|
|