public static V3d[] TransformedDirArray(this M44d mat, V3d[] directions) { var result = new V3d[directions.Length]; for (int i = 0; i < directions.Length; i++) { result[i] = mat.TransformDir(directions[i]); } return(result); }
/// <summary> /// Copies from the direction array indexed by a backward map into /// a target array, starting at the supplied offset, thereby /// transforming all directions using the supplied matrix. /// </summary> /// <returns>target array</returns> public static V3f[] BackwardIndexedTransformDirAndCopyTo( this V3f[] source, V3f[] target, int[] backwardMap, int offset, M44d m44d) { var count = backwardMap.Length; for (int i = 0; i < count; i++) { target[i + offset] = (V3f)m44d.TransformDir((V3d)source[backwardMap[i]]); } return(target); }
/// <summary> /// Returns the ray transformed with the given matrix. /// </summary> public Ray3d Transformed(M44d mat) { return(new Ray3d(mat.TransformPos(Origin), mat.TransformDir(Direction))); }