예제 #1
0
        static public Vector2 Map(this Vector2 valA, Vector2 minA, Vector2 maxA, Vector2 minB, Vector2 maxB)
        {
            var v = Vector2.zero;

            v.x = MathR.Map(valA.x, minA.x, maxA.x, minB.x, maxB.x);
            v.y = MathR.Map(valA.y, minA.y, maxA.y, minB.y, maxB.y);
            return(v);
        }
예제 #2
0
        static public Vector3 Smooth(this Vector3 self, Vector3 previous, float amount)
        {
            Vector3 pp = previous;
            Vector3 cp = self;
            Vector3 rp = Vector3.zero;

            rp.x = MathR.Smooth(cp.x, pp.x, amount);
            rp.y = MathR.Smooth(cp.y, pp.y, amount);
            rp.z = MathR.Smooth(cp.z, pp.z, amount);
            return(rp);
        }
예제 #3
0
        public static Quaternion Smooth(this Quaternion self, Quaternion previous, float amount)
        {
            Quaternion pq = previous;
            Quaternion cq = self;
            Quaternion rq = Quaternion.identity;

            rq.x = MathR.Smooth(cq.x, pq.x, amount);
            rq.y = MathR.Smooth(cq.y, pq.y, amount);
            rq.z = MathR.Smooth(cq.z, pq.z, amount);
            rq.w = MathR.Smooth(cq.w, pq.w, amount);
            return(rq);
        }
예제 #4
0
 static public Vector2 Normalize(this Vector2 self, Vector2 min, Vector2 max)
 {
     self.x = MathR.Map(self.x, min.x, max.x, 0, 1);
     self.y = MathR.Map(self.y, min.y, max.y, 0, 1);
     return(self);
 }