Example #1
0
        /// <summary>Transform a Vector by the given Matrix</summary>
        /// <param name="vec">The vector to transform</param>
        /// <param name="mat">The desired transformation</param>
        /// <returns>The transformed vector</returns>
        public static SCNVector4 Transform(SCNVector3 vec, SCNMatrix4 mat)
        {
            SCNVector4 v4 = new SCNVector4(vec.X, vec.Y, vec.Z, 1.0f);
            SCNVector4 result;

            result.X = SCNVector4.Dot(v4, mat.Column0);
            result.Y = SCNVector4.Dot(v4, mat.Column1);
            result.Z = SCNVector4.Dot(v4, mat.Column2);
            result.W = SCNVector4.Dot(v4, mat.Column3);
            return(result);
        }