diff --git a/Source/OpenTK/Math/Functions.cs b/Source/OpenTK/Math/Functions.cs new file mode 100644 index 00000000..91104cfd --- /dev/null +++ b/Source/OpenTK/Math/Functions.cs @@ -0,0 +1,146 @@ +#region --- License --- +/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos + * See license.txt for license info + */ +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenTK.Math +{ + /// + /// Contains mathematical functions for the OpenTK.Math toolkit. + /// + public static class Functions + { + public static float SqrtFast(float p) + { + throw new Exception("The method or operation is not implemented."); + } + } + +#if false + public static partial class Math + { + #region --- Vectors --- + + #region --- Addition --- + + /// + /// Adds the given Vector2 to the current Vector3. + /// + /// The right operand of the addition. + /// A new Vector3 containing the result of the addition. + public static Vector2 Add(Vector2 left, Vector2 right) + { + return new Vector2(left).Add(right); + } + + /// + /// Adds the given Vector3 to the current Vector3. + /// + /// The right operand of the addition. + /// A new Vector3 containing the result of the addition. + public static Vector3 Add(Vector2 left, Vector3 right) + { + return new Vector3(left).Add(right); + } + + /// + /// Adds the given Vector4 to the current Vector3. W-coordinate remains unaffected. + /// + /// The right operand of the addition. + /// A new Vector4 containing the result of the addition. + public static Vector4 Add(Vector2 left, Vector4 right) + { + return new Vector4(left).Add(right); + } + + /// + /// Adds the given Vector2 to the current Vector3. + /// + /// The right operand of the addition. + /// A new Vector3 containing the result of the addition. + public static Vector3 Add(Vector3 left, Vector2 right) + { + return new Vector3(left).Add(right); + } + + /// + /// Adds the given Vector3 to the current Vector3. + /// + /// The right operand of the addition. + /// A new Vector3 containing the result of the addition. + public static Vector3 Add(Vector3 left, Vector3 right) + { + return new Vector3(left).Add(right); + } + + /// + /// Adds the given Vector4 to the current Vector3. W-coordinate remains unaffected. + /// + /// The right operand of the addition. + /// A new Vector4 containing the result of the addition. + public static Vector4 Add(Vector3 left, Vector4 right) + { + return new Vector4(left).Add(right); + } + + /// + /// Adds the given Vector2 to the current Vector3. + /// + /// The right operand of the addition. + /// A new Vector3 containing the result of the addition. + public static Vector4 Add(Vector4 left, Vector2 right) + { + return new Vector4(left).Add(right); + } + + /// + /// Adds the given Vector3 to the current Vector3. + /// + /// The right operand of the addition. + /// A new Vector3 containing the result of the addition. + public static Vector4 Add(Vector4 left, Vector3 right) + { + return new Vector4(left).Add(right); + } + + /// + /// Adds the given Vector4 to the current Vector3. W-coordinate remains unaffected. + /// + /// The right operand of the addition. + /// A new Vector4 containing the result of the addition. + public static Vector4 Add(Vector4 left, Vector4 right) + { + return new Vector4(left).Add(right); + } + + #endregion + + #region --- Subtraction --- + + + + #endregion + + #region --- Cross --- + + /// + /// Computes the cross product between the current and the given Vector3. The current Vector3 is set to the result of the computation. + /// + /// The right operand of the cross product + /// The current + public static Vector3 Cross(Vector3 left, Vector3 right) + { + return new Vector3(left).Cross(right); + } + + #endregion + + #endregion + } +#endif +} diff --git a/Source/OpenTK/Math/Vector2.cs b/Source/OpenTK/Math/Vector2.cs index 0b6f798a..b667e629 100644 --- a/Source/OpenTK/Math/Vector2.cs +++ b/Source/OpenTK/Math/Vector2.cs @@ -160,7 +160,7 @@ namespace OpenTK.Math { get { - return OpenTK.Math.SqrtFast(X * X + Y * Y); + return OpenTK.Math.Functions.SqrtFast(X * X + Y * Y); } }