forked from kaka3286/RoadRunner
24 lines
568 B
C#
24 lines
568 B
C#
using UnityEngine;
|
|
|
|
namespace Gley.UrbanSystem.Editor
|
|
{
|
|
internal class BezierCurve
|
|
{
|
|
internal static Vector3 CalculateCubicBezierPoint(float t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3)
|
|
{
|
|
float u = 1 - t;
|
|
float tt = t * t;
|
|
float uu = u * u;
|
|
float uuu = uu * u;
|
|
float ttt = tt * t;
|
|
|
|
Vector3 p = uuu * p0;
|
|
p += 3 * uu * t * p1;
|
|
p += 3 * u * tt * p2;
|
|
p += ttt * p3;
|
|
|
|
return p;
|
|
}
|
|
}
|
|
}
|