aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs57
1 files changed, 55 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 232baf8..e4c1229 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -40,6 +40,8 @@ namespace OpenSim.Region.ScriptEngine.Common
40 public double y; 40 public double y;
41 public double z; 41 public double z;
42 42
43 #region Constructors
44
43 public Vector3(Vector3 vector) 45 public Vector3(Vector3 vector)
44 { 46 {
45 x = (float) vector.x; 47 x = (float) vector.x;
@@ -54,7 +56,20 @@ namespace OpenSim.Region.ScriptEngine.Common
54 z = Z; 56 z = Z;
55 } 57 }
56 58
57 #region Overriders 59 public Vector3(string str)
60 {
61 str = str.Replace('<', ' ');
62 str = str.Replace('>', ' ');
63 string[] tmps = str.Split(new Char[] { ',', '<', '>' });
64 bool res;
65 res = Double.TryParse(tmps[0], out x);
66 res = res & Double.TryParse(tmps[1], out y);
67 res = res & Double.TryParse(tmps[2], out z);
68 }
69
70 #endregion
71
72 #region Overriders
58 73
59 public override string ToString() 74 public override string ToString()
60 { 75 {
@@ -140,6 +155,28 @@ namespace OpenSim.Region.ScriptEngine.Common
140 155
141 #endregion 156 #endregion
142 157
158 #region Vector & Double Math
159
160 public static Vector3 operator *(Vector3 vec, double val)
161 {
162 return new Vector3(vec.x * val, vec.y * val, vec.z * val);
163 }
164
165 public static Vector3 operator *(double val, Vector3 vec)
166 {
167 return new Vector3(vec.x * val, vec.y * val, vec.z * val);
168 }
169
170 public static Vector3 operator /(Vector3 v, double f)
171 {
172 v.x = v.x / f;
173 v.y = v.y / f;
174 v.z = v.z / f;
175 return v;
176 }
177
178 #endregion
179
143 #region Vector & Rotation Math 180 #region Vector & Rotation Math
144 181
145 // Vector-Rotation Math 182 // Vector-Rotation Math
@@ -206,6 +243,8 @@ namespace OpenSim.Region.ScriptEngine.Common
206 public double z; 243 public double z;
207 public double s; 244 public double s;
208 245
246 #region Constructors
247
209 public Quaternion(Quaternion Quat) 248 public Quaternion(Quaternion Quat)
210 { 249 {
211 x = (float) Quat.x; 250 x = (float) Quat.x;
@@ -222,6 +261,20 @@ namespace OpenSim.Region.ScriptEngine.Common
222 s = S; 261 s = S;
223 } 262 }
224 263
264 public Quaternion(string str)
265 {
266 str = str.Replace('<', ' ');
267 str = str.Replace('>', ' ');
268 string[] tmps = str.Split(new Char[] { ',', '<', '>' });
269 bool res;
270 res = Double.TryParse(tmps[0], out x);
271 res = res & Double.TryParse(tmps[1], out y);
272 res = res & Double.TryParse(tmps[2], out z);
273 res = res & Double.TryParse(tmps[3], out s);
274 }
275
276 #endregion
277
225 #region Overriders 278 #region Overriders
226 279
227 public override int GetHashCode() 280 public override int GetHashCode()
@@ -385,4 +438,4 @@ namespace OpenSim.Region.ScriptEngine.Common
385 } 438 }
386 } 439 }
387 } 440 }
388} \ No newline at end of file 441}