Exemplo n.º 1
0
        // ----- ----- ----- ----- -----

        public static PosRotScale Interpolate(PosRotScale px0, PosRotScale px1, float x)
        {
            return(new PosRotScale(
                       px1.position * x + px0.position * (1 - x),
                       Quaternion.Slerp(px0.rotation, px1.rotation, x),
                       px1.scale * x + px0.scale * (1 - x)
                       ));
        }
Exemplo n.º 2
0
        public PosRotScale Inverse()
        {
            PosRotScale result = new PosRotScale();

            result.rotation = Quaternion.Inverse(rotation);
            result.scale    = scaleInv;
            result.position = -(rotation * Vector3.Scale(scale, position));
            return(result);
        }
Exemplo n.º 3
0
        public PosRotScale InverseTransformPosRotScale(PosRotScale posrotscale)
        {
            PosRotScale result = new PosRotScale();

            result.position = Quaternion.Inverse(rotation) * Vector3.Scale(scaleInv, (posrotscale.position - position));
            result.rotation = (Quaternion.Inverse(rotation) * posrotscale.rotation).normalized;
            result.scale    = Vector3.Scale(scaleInv, posrotscale.scale);
            return(result);
        }
Exemplo n.º 4
0
        public PosRotScale TransformPosRotScale(PosRotScale posrotscale)
        {
            PosRotScale result = new PosRotScale();

            result.position = position + rotation * Vector3.Scale(scale, posrotscale.position);
            result.rotation = (rotation * posrotscale.rotation).normalized;
            result.scale    = Vector3.Scale(scale, posrotscale.scale);
            return(result);
        }
Exemplo n.º 5
0
        public static PosRotScale Parse(string line)
        {
            var         data = line.Split(',').Select(s => float.Parse(s));
            PosRotScale pose = new PosRotScale();

            pose.position = new Vector3(data.ElementAt(0), data.ElementAt(1), data.ElementAt(2));
            pose.rotation = new Quaternion(data.ElementAt(3), data.ElementAt(4), data.ElementAt(5), data.ElementAt(6));
            pose.scale    = new Vector3(data.ElementAt(7), data.ElementAt(8), data.ElementAt(9));
            return(pose);
        }
Exemplo n.º 6
0
 public PosRotScale(PosRotScale p)
 {
     position = p.position; rotation = p.rotation; scale = p.scale;
 }