aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs98
1 files changed, 98 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index f0177db..7b56b90 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -5305,5 +5305,103 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5305 5305
5306 return ((string)src).Replace(oldvalue, newvalue); 5306 return ((string)src).Replace(oldvalue, newvalue);
5307 } 5307 }
5308
5309 public LSL_Integer osApproxEquals(LSL_Float a, LSL_Float b)
5310 {
5311 if (a > b + 1.0e-6 || a < b - 1.0e-6)
5312 return 0;
5313 return 1;
5314 }
5315
5316 public LSL_Integer osApproxEquals(LSL_Float a, LSL_Float b, LSL_Float margin)
5317 {
5318 double e = Math.Abs(margin);
5319 if (a > b + e || a < b - e)
5320 return 0;
5321 return 1;
5322 }
5323
5324 public LSL_Integer osApproxEquals(LSL_Vector va, LSL_Vector vb)
5325 {
5326 double a = va.x;
5327 double b = vb.x;
5328 if (a > b + 1.0e-6 || a < b - 1.0e-6)
5329 return 0;
5330 a = va.y;
5331 b = vb.y;
5332 if (a > b + 1.0e-6 || a < b - 1.0e-6)
5333 return 0;
5334 a = va.z;
5335 b = vb.z;
5336 if (a > b + 1.0e-6 || a < b - 1.0e-6)
5337 return 0;
5338
5339 return 1;
5340 }
5341
5342 public LSL_Integer osApproxEquals(LSL_Vector va, LSL_Vector vb, LSL_Float margin)
5343 {
5344 double e = Math.Abs(margin);
5345 double a = va.x;
5346 double b = vb.x;
5347 if (a > b + e || a < b - e)
5348 return 0;
5349 a = va.y;
5350 b = vb.y;
5351 if (a > b + e || a < b - e)
5352 return 0;
5353 a = va.z;
5354 b = vb.z;
5355 if (a > b + e || a < b - e)
5356 return 0;
5357
5358 return 1;
5359 }
5360
5361 public LSL_Integer osApproxEquals(LSL_Rotation ra, LSL_Rotation rb)
5362 {
5363 double a = ra.x;
5364 double b = rb.x;
5365 if (a > b + 1.0e-6 || a < b - 1.0e-6)
5366 return 0;
5367 a = ra.y;
5368 b = rb.y;
5369 if (a > b + 1.0e-6 || a < b - 1.0e-6)
5370 return 0;
5371 a = ra.z;
5372 b = rb.z;
5373 if (a > b + 1.0e-6 || a < b - 1.0e-6)
5374 return 0;
5375 a = ra.s;
5376 b = rb.s;
5377 if (a > b + 1.0e-6 || a < b - 1.0e-6)
5378 return 0;
5379
5380 return 1;
5381 }
5382
5383 public LSL_Integer osApproxEquals(LSL_Rotation ra, LSL_Rotation rb, LSL_Float margin)
5384 {
5385 double e = Math.Abs(margin);
5386 double a = ra.x;
5387 double b = rb.x;
5388 if (a > b + e || a < b - e)
5389 return 0;
5390 a = ra.y;
5391 b = rb.y;
5392 if (a > b + e || a < b - e)
5393 return 0;
5394 a = ra.z;
5395 b = rb.z;
5396 if (a > b + e || a < b - e)
5397 return 0;
5398 a = ra.s;
5399 b = rb.s;
5400 if (a > b + e || a < b - e)
5401 return 0;
5402
5403 return 1;
5404 }
5405
5308 } 5406 }
5309} \ No newline at end of file 5407} \ No newline at end of file