diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-09-08 17:29:12 +0000 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-09-08 17:29:12 +0000 |
| commit | 85445c6b6b659094c4b6ff8b99cc666bb6eeca0b (patch) | |
| tree | 6643b1f6a575bad3cb10bbb8327398f47cd6965c /src/ExtensionMethods.cs | |
| parent | d36205befa1e2bf45a3c6283ace18259bce12377 (diff) | |
debug and refinements
Diffstat (limited to 'src/ExtensionMethods.cs')
| -rw-r--r-- | src/ExtensionMethods.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ExtensionMethods.cs b/src/ExtensionMethods.cs new file mode 100644 index 0000000..d240078 --- /dev/null +++ b/src/ExtensionMethods.cs @@ -0,0 +1,19 @@ +using System.Numerics; + +namespace vkChess +{ + public static class ExtensionMethods { + public static Vector3 ParseVec3 (string str) { + if (string.IsNullOrEmpty (str)) + return new Vector3(); + string[] components = str.Substring(1, str.Length - 2).Split (','); + if (components.Length != 3) + throw new System.Exception ("Vector3 Parse Error, expecting 3 components."); + return new Vector3( + float.Parse (components[0]), + float.Parse (components[1]), + float.Parse (components[2]) + ); + } + } +}
\ No newline at end of file |