示例#1
0
 public static double Repeat(double t, double length)
 {
     return(t - Mathd.Floor(t / length) * length);
 }
示例#2
0
 public static double PingPong(double t, double length)
 {
     t = Mathd.Repeat(t, length * 2d);
     return(length - Mathd.Abs(t - length));
 }
示例#3
0
        public static double SmoothDampAngle(double current, double target, ref double currentVelocity, double smoothTime, double maxSpeed)
        {
            double deltaTime = (double)Time.deltaTime;

            return(Mathd.SmoothDampAngle(current, target, ref currentVelocity, smoothTime, maxSpeed, deltaTime));
        }
示例#4
0
 public static double SmoothDampAngle(double current, double target, ref double currentVelocity, double smoothTime, double maxSpeed, double deltaTime)
 {
     target = current + Mathd.DeltaAngle(current, target);
     return(Mathd.SmoothDamp(current, target, ref currentVelocity, smoothTime, maxSpeed, deltaTime));
 }
示例#5
0
 public static double SmoothStep(double from, double to, double t)
 {
     t = Mathd.Clamp01(t);
     t = (-2.0 * t * t * t + 3.0 * t * t);
     return(to * t + from * (1.0 - t));
 }
示例#6
0
 public static bool Approximately(double a, double b)
 {
     return(Mathd.Abs(b - a) < Mathd.Max(1E-06d * Mathd.Max(Mathd.Abs(a), Mathd.Abs(b)), 1.121039E-44d));
 }
示例#7
0
 public static double Lerp(double from, double to, double t)
 {
     return(from + (to - from) * Mathd.Clamp01(t));
 }
示例#8
0
 public static double MoveTowardsAngle(double current, double target, double maxDelta)
 {
     target = current + Mathd.DeltaAngle(current, target);
     return(Mathd.MoveTowards(current, target, maxDelta));
 }
示例#9
0
 public static double AngleBetween(Vector3d from, Vector3d to)
 {
     return(Mathd.Acos(Mathd.Clamp(Vector3d.Dot(from.normalized, to.normalized), -1d, 1d)));
 }
示例#10
0
 public static Vector3d Max(Vector3d lhs, Vector3d rhs)
 {
     return(new Vector3d(Mathd.Max(lhs.x, rhs.x), Mathd.Max(lhs.y, rhs.y), Mathd.Max(lhs.z, rhs.z)));
 }
示例#11
0
 public static double Angle(Vector3d from, Vector3d to)
 {
     return(Mathd.Acos(Mathd.Clamp(Vector3d.Dot(from.normalized, to.normalized), -1d, 1d)) * 57.29578d);
 }
示例#12
0
 public static Vector3d Lerp(Vector3d from, Vector3d to, double t)
 {
     t = Mathd.Clamp01(t);
     return(new Vector3d(from.x + (to.x - from.x) * t, from.y + (to.y - from.y) * t, from.z + (to.z - from.z) * t));
 }
示例#13
0
 public static Vector2d Max(Vector2d lhs, Vector2d rhs)
 {
     return(new Vector2d(Mathd.Max(lhs.x, rhs.x), Mathd.Max(lhs.y, rhs.y)));
 }