From 2989ea1c3a01247d2c072c494079939cf39d5c24 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 20 Feb 2016 15:16:37 +0200 Subject: [PATCH] Added operators for Mat * Vec --- Source/OpenTK/Math/Vector3.cs | 22 ++++++++++++++++++++++ Source/OpenTK/Math/Vector4.cs | 11 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/Source/OpenTK/Math/Vector3.cs b/Source/OpenTK/Math/Vector3.cs index 7fc286ea..de2b6642 100644 --- a/Source/OpenTK/Math/Vector3.cs +++ b/Source/OpenTK/Math/Vector3.cs @@ -1585,6 +1585,28 @@ namespace OpenTK return result; } + /// Transform a Vector by the given Matrix using right-handed notation + /// The vector to transform + /// The desired transformation + /// The transformed vector + public static Vector3 operator *(Matrix3 mat, Vector3 vec) + { + Vector3 result; + Vector3.RightHandedTransform(ref vec, ref mat, out result); + return result; + } + + /// Transform a Vector by the given Matrix using right-handed notation + /// The vector to transform + /// The desired transformation + /// The transformed vector + public static Vector3 operator *(Matrix4 mat, Vector3 vec) + { + Vector3 result; + Vector3.RightHandedTransform(ref vec, ref mat, out result); + return result; + } + /// /// Transforms a vector by a quaternion rotation. /// diff --git a/Source/OpenTK/Math/Vector4.cs b/Source/OpenTK/Math/Vector4.cs index ba641110..d19ad77c 100644 --- a/Source/OpenTK/Math/Vector4.cs +++ b/Source/OpenTK/Math/Vector4.cs @@ -1543,6 +1543,17 @@ namespace OpenTK return result; } + /// Transform a Vector by the given Matrix using right-handed notation + /// The vector to transform + /// The desired transformation + /// The transformed vector + public static Vector4 operator *(Matrix4 mat, Vector4 vec) + { + Vector4 result; + Vector4.RightHandedTransform(ref vec, ref mat, out result); + return result; + } + /// /// Transforms a vector by a quaternion rotation. ///