From db369a362d6d9ba92613361341fc64ff5dbe7f3a Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sat, 23 Jun 2012 17:23:39 -0500 Subject: [PATCH] Adding double extension Adding Texture2D comments --- axios/Engine/Extensions/Double.cs | 22 ++++++++++++++++++++++ axios/Engine/Extensions/Texture2D.cs | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 axios/Engine/Extensions/Double.cs diff --git a/axios/Engine/Extensions/Double.cs b/axios/Engine/Extensions/Double.cs new file mode 100644 index 0000000..51c70b1 --- /dev/null +++ b/axios/Engine/Extensions/Double.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Axios.Engine.Extensions +{ + public static class AxiosExtension_Double + { + //http://www.vcskicks.com/csharp_net_angles.php + public static double DegreeToRadian(this double angle) + { + return Math.PI * angle / 180.0; + } + + //http://www.vcskicks.com/csharp_net_angles.php + public static double RadianToDegree(double angle) + { + return angle * (180.0 / Math.PI); + } + } +} diff --git a/axios/Engine/Extensions/Texture2D.cs b/axios/Engine/Extensions/Texture2D.cs index 6b0cc91..0979556 100644 --- a/axios/Engine/Extensions/Texture2D.cs +++ b/axios/Engine/Extensions/Texture2D.cs @@ -23,6 +23,8 @@ namespace Axios.Engine.Extensions /// A multidimensional array represting the rows/coulmns in the texture. public static Texture2D[,] Split(this Texture2D original, int partWidth, int partHeight, out int xCount, out int yCount) { + // This is buggy, there is an issue where it is out of bounds => r[curryidx, currxidx] = part; + // -- Nathan Adams [adamsna@datanethost.net] - 6/21/2012 yCount = original.Height / partHeight; //+ (partHeight % original.Height == 0 ? 0 : 1);//The number of textures in each horizontal row xCount = original.Width / partWidth; //+(partWidth % original.Width == 0 ? 0 : 1);//The number of textures in each vertical column Texture2D[,] r = new Texture2D[yCount,xCount];//Number of parts = (area of original) / (area of each part).