diff options
author | lbsa71 | 2007-12-27 21:41:48 +0000 |
---|---|---|
committer | lbsa71 | 2007-12-27 21:41:48 +0000 |
commit | efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch) | |
tree | bf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Region/ScriptEngine/Common | |
parent | * removed always true if (diff) | |
download | opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2 opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz |
* Optimized usings
* shortened references
* Removed redundant 'this'
* Normalized EOF
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 66 |
2 files changed, 37 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 6ba7018..9c595ed 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -634,4 +634,4 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
634 | //OpenSim functions | 634 | //OpenSim functions |
635 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); | 635 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); |
636 | } | 636 | } |
637 | } | 637 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index 3a0b8ed..232baf8 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
80 | { | 80 | { |
81 | if (!(o is Vector3)) return false; | 81 | if (!(o is Vector3)) return false; |
82 | 82 | ||
83 | Vector3 vector = (Vector3)o; | 83 | Vector3 vector = (Vector3) o; |
84 | 84 | ||
85 | return (x == vector.x && x == vector.x && z == vector.z); | 85 | return (x == vector.x && x == vector.x && z == vector.z); |
86 | } | 86 | } |
@@ -88,11 +88,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
88 | #endregion | 88 | #endregion |
89 | 89 | ||
90 | #region Vector & Vector Math | 90 | #region Vector & Vector Math |
91 | |||
91 | // Vector-Vector Math | 92 | // Vector-Vector Math |
92 | public static Vector3 operator +(Vector3 lhs, Vector3 rhs) | 93 | public static Vector3 operator +(Vector3 lhs, Vector3 rhs) |
93 | { | 94 | { |
94 | return new Vector3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z); | 95 | return new Vector3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z); |
95 | } | 96 | } |
96 | 97 | ||
97 | public static Vector3 operator -(Vector3 lhs, Vector3 rhs) | 98 | public static Vector3 operator -(Vector3 lhs, Vector3 rhs) |
98 | { | 99 | { |
@@ -101,51 +102,53 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
101 | 102 | ||
102 | public static Vector3 operator *(Vector3 lhs, Vector3 rhs) | 103 | public static Vector3 operator *(Vector3 lhs, Vector3 rhs) |
103 | { | 104 | { |
104 | return new Vector3(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z); | 105 | return new Vector3(lhs.x*rhs.x, lhs.y*rhs.y, lhs.z*rhs.z); |
105 | } | 106 | } |
106 | 107 | ||
107 | public static Vector3 operator %(Vector3 v1, Vector3 v2) | 108 | public static Vector3 operator %(Vector3 v1, Vector3 v2) |
108 | { | 109 | { |
109 | //Cross product | 110 | //Cross product |
110 | Vector3 tv; | 111 | Vector3 tv; |
111 | tv.x = (v1.y * v2.z) - (v1.z * v2.y); | 112 | tv.x = (v1.y*v2.z) - (v1.z*v2.y); |
112 | tv.y = (v1.z * v2.x) - (v1.x * v2.z); | 113 | tv.y = (v1.z*v2.x) - (v1.x*v2.z); |
113 | tv.z = (v1.x * v2.y) - (v1.y * v2.x); | 114 | tv.z = (v1.x*v2.y) - (v1.y*v2.x); |
114 | return tv; | 115 | return tv; |
115 | } | 116 | } |
116 | 117 | ||
117 | #endregion | 118 | #endregion |
118 | 119 | ||
119 | #region Vector & Float Math | 120 | #region Vector & Float Math |
121 | |||
120 | // Vector-Float and Float-Vector Math | 122 | // Vector-Float and Float-Vector Math |
121 | public static Vector3 operator *(Vector3 vec, float val) | 123 | public static Vector3 operator *(Vector3 vec, float val) |
122 | { | 124 | { |
123 | return new Vector3(vec.x * val, vec.y * val, vec.z * val); | 125 | return new Vector3(vec.x*val, vec.y*val, vec.z*val); |
124 | } | 126 | } |
125 | 127 | ||
126 | public static Vector3 operator *(float val, Vector3 vec) | 128 | public static Vector3 operator *(float val, Vector3 vec) |
127 | { | 129 | { |
128 | return new Vector3(vec.x * val, vec.y * val, vec.z * val); | 130 | return new Vector3(vec.x*val, vec.y*val, vec.z*val); |
129 | } | 131 | } |
130 | 132 | ||
131 | public static Vector3 operator /(Vector3 v, float f) | 133 | public static Vector3 operator /(Vector3 v, float f) |
132 | { | 134 | { |
133 | v.x = v.x / f; | 135 | v.x = v.x/f; |
134 | v.y = v.y / f; | 136 | v.y = v.y/f; |
135 | v.z = v.z / f; | 137 | v.z = v.z/f; |
136 | return v; | 138 | return v; |
137 | } | 139 | } |
138 | 140 | ||
139 | #endregion | 141 | #endregion |
140 | 142 | ||
141 | #region Vector & Rotation Math | 143 | #region Vector & Rotation Math |
144 | |||
142 | // Vector-Rotation Math | 145 | // Vector-Rotation Math |
143 | public static Vector3 operator *(Vector3 v, Quaternion r) | 146 | public static Vector3 operator *(Vector3 v, Quaternion r) |
144 | { | 147 | { |
145 | Quaternion vq = new Quaternion(v.x, v.y, v.z, 0); | 148 | Quaternion vq = new Quaternion(v.x, v.y, v.z, 0); |
146 | Quaternion nq = new Quaternion(-r.x, -r.y, -r.z, r.s); | 149 | Quaternion nq = new Quaternion(-r.x, -r.y, -r.z, r.s); |
147 | 150 | ||
148 | Quaternion result = (r * vq) * nq; | 151 | Quaternion result = (r*vq)*nq; |
149 | 152 | ||
150 | return new Vector3(result.x, result.y, result.z); | 153 | return new Vector3(result.x, result.y, result.z); |
151 | } | 154 | } |
@@ -157,38 +160,41 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
157 | Quaternion vq = new Quaternion(vec.x, vec.y, vec.z, 0); | 160 | Quaternion vq = new Quaternion(vec.x, vec.y, vec.z, 0); |
158 | Quaternion nq = new Quaternion(-quat.x, -quat.y, -quat.z, quat.s); | 161 | Quaternion nq = new Quaternion(-quat.x, -quat.y, -quat.z, quat.s); |
159 | 162 | ||
160 | Quaternion result = (quat * vq) * nq; | 163 | Quaternion result = (quat*vq)*nq; |
161 | 164 | ||
162 | return new Vector3(result.x, result.y, result.z); | 165 | return new Vector3(result.x, result.y, result.z); |
163 | } | 166 | } |
167 | |||
164 | #endregion | 168 | #endregion |
165 | 169 | ||
166 | #region Static Helper Functions | 170 | #region Static Helper Functions |
171 | |||
167 | public static double Dot(Vector3 v1, Vector3 v2) | 172 | public static double Dot(Vector3 v1, Vector3 v2) |
168 | { | 173 | { |
169 | return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z); | 174 | return (v1.x*v2.x) + (v1.y*v2.y) + (v1.z*v2.z); |
170 | } | 175 | } |
171 | 176 | ||
172 | public static Vector3 Cross(Vector3 v1, Vector3 v2) | 177 | public static Vector3 Cross(Vector3 v1, Vector3 v2) |
173 | { | 178 | { |
174 | return new Vector3 | 179 | return new Vector3 |
175 | ( | 180 | ( |
176 | v1.y * v2.z - v1.z * v2.y, | 181 | v1.y*v2.z - v1.z*v2.y, |
177 | v1.z * v2.x - v1.x * v2.z, | 182 | v1.z*v2.x - v1.x*v2.z, |
178 | v1.x * v2.y - v1.y * v2.x | 183 | v1.x*v2.y - v1.y*v2.x |
179 | ); | 184 | ); |
180 | } | 185 | } |
181 | 186 | ||
182 | public static float Mag(Vector3 v) | 187 | public static float Mag(Vector3 v) |
183 | { | 188 | { |
184 | return (float)Math.Sqrt(v.x * v.y + v.y * v.y + v.z * v.z); | 189 | return (float) Math.Sqrt(v.x*v.y + v.y*v.y + v.z*v.z); |
185 | } | 190 | } |
186 | 191 | ||
187 | public static Vector3 Norm(Vector3 vector) | 192 | public static Vector3 Norm(Vector3 vector) |
188 | { | 193 | { |
189 | float mag = Mag(vector); | 194 | float mag = Mag(vector); |
190 | return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); | 195 | return new Vector3(vector.x/mag, vector.y/mag, vector.z/mag); |
191 | } | 196 | } |
197 | |||
192 | #endregion | 198 | #endregion |
193 | } | 199 | } |
194 | 200 | ||
@@ -227,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
227 | { | 233 | { |
228 | if (!(o is Quaternion)) return false; | 234 | if (!(o is Quaternion)) return false; |
229 | 235 | ||
230 | Quaternion quaternion = (Quaternion)o; | 236 | Quaternion quaternion = (Quaternion) o; |
231 | 237 | ||
232 | return x == quaternion.x && y == quaternion.y && z == quaternion.z && s == quaternion.s; | 238 | return x == quaternion.x && y == quaternion.y && z == quaternion.z && s == quaternion.s; |
233 | } | 239 | } |
@@ -253,10 +259,10 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
253 | public static Quaternion operator *(Quaternion a, Quaternion b) | 259 | public static Quaternion operator *(Quaternion a, Quaternion b) |
254 | { | 260 | { |
255 | Quaternion c; | 261 | Quaternion c; |
256 | c.x = a.s * b.x + a.x * b.s + a.y * b.z - a.z * b.y; | 262 | c.x = a.s*b.x + a.x*b.s + a.y*b.z - a.z*b.y; |
257 | c.y = a.s * b.y + a.y * b.s + a.z * b.x - a.x * b.z; | 263 | c.y = a.s*b.y + a.y*b.s + a.z*b.x - a.x*b.z; |
258 | c.z = a.s * b.z + a.z * b.s + a.x * b.y - a.y * b.x; | 264 | c.z = a.s*b.z + a.z*b.s + a.x*b.y - a.y*b.x; |
259 | c.s = a.s * b.s - a.x * b.x - a.y * b.y - a.z * b.z; | 265 | c.s = a.s*b.s - a.x*b.x - a.y*b.y - a.z*b.z; |
260 | return c; | 266 | return c; |
261 | } | 267 | } |
262 | } | 268 | } |
@@ -324,7 +330,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
324 | { | 330 | { |
325 | if (start >= m_data.Length) | 331 | if (start >= m_data.Length) |
326 | { | 332 | { |
327 | return this.GetSublist(0, end); | 333 | return GetSublist(0, end); |
328 | } | 334 | } |
329 | if (end >= m_data.Length) | 335 | if (end >= m_data.Length) |
330 | { | 336 | { |
@@ -334,7 +340,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
334 | //ret = new object[m_data.Length - Math.Abs(end - start + 1)]; | 340 | //ret = new object[m_data.Length - Math.Abs(end - start + 1)]; |
335 | //Array.Copy(m_data, 0, ret, m_data.Length - start, end + 1); | 341 | //Array.Copy(m_data, 0, ret, m_data.Length - start, end + 1); |
336 | //Array.Copy(m_data, start, ret, 0, m_data.Length - start); | 342 | //Array.Copy(m_data, start, ret, 0, m_data.Length - start); |
337 | return this.GetSublist(0, end) + this.GetSublist(start, this.Data.Length - 1); | 343 | return GetSublist(0, end) + GetSublist(start, Data.Length - 1); |
338 | //return new list(ret); | 344 | //return new list(ret); |
339 | } | 345 | } |
340 | } | 346 | } |
@@ -379,4 +385,4 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
379 | } | 385 | } |
380 | } | 386 | } |
381 | } | 387 | } |
382 | } | 388 | } \ No newline at end of file |