aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Manager
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs14
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsVector.cs50
2 files changed, 64 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index bfe1d0b..b151e16 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -26,6 +26,7 @@
26* 26*
27*/ 27*/
28using Axiom.Math; 28using Axiom.Math;
29using OpenSim.Framework;
29 30
30namespace OpenSim.Region.Physics.Manager 31namespace OpenSim.Region.Physics.Manager
31{ 32{
@@ -50,6 +51,11 @@ namespace OpenSim.Region.Physics.Manager
50 51
51 public abstract PhysicsVector Size { get; set; } 52 public abstract PhysicsVector Size { get; set; }
52 53
54 public abstract PrimitiveBaseShape Shape
55 {
56 set;
57 }
58
53 public abstract PhysicsVector Position { get; set; } 59 public abstract PhysicsVector Position { get; set; }
54 60
55 public abstract PhysicsVector Velocity { get; set; } 61 public abstract PhysicsVector Velocity { get; set; }
@@ -85,6 +91,14 @@ namespace OpenSim.Region.Physics.Manager
85 set { return; } 91 set { return; }
86 } 92 }
87 93
94 public override PrimitiveBaseShape Shape
95 {
96 set
97 {
98 return;
99 }
100 }
101
88 public override PhysicsVector Velocity 102 public override PhysicsVector Velocity
89 { 103 {
90 get { return PhysicsVector.Zero; } 104 get { return PhysicsVector.Zero; }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
index 7de37e4..ada2297 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
@@ -25,6 +25,10 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
29using System;
30
31
28namespace OpenSim.Region.Physics.Manager 32namespace OpenSim.Region.Physics.Manager
29{ 33{
30 public class PhysicsVector 34 public class PhysicsVector
@@ -50,5 +54,51 @@ namespace OpenSim.Region.Physics.Manager
50 { 54 {
51 return "<" + X + "," + Y + "," + Z + ">"; 55 return "<" + X + "," + Y + "," + Z + ">";
52 } 56 }
57
58 // Operations
59 public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b)
60 {
61 return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
62 }
63
64 public static PhysicsVector operator -(PhysicsVector a, PhysicsVector b)
65 {
66 return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
67 }
68
69 public static PhysicsVector cross(PhysicsVector a, PhysicsVector b)
70 {
71 return new PhysicsVector(a.Y * b.Z - a.Z * b.Y, a.Z * b.X - a.X * b.Z, a.X * b.Y - a.Y * b.X);
72 }
73
74 public float length()
75 {
76 return (float)Math.Sqrt(X*X + Y*Y + Z*Z);
77 }
78
79 public static PhysicsVector operator / (PhysicsVector v, float f)
80 {
81 return new PhysicsVector(v.X / f, v.Y / f, v.Z / f);
82 }
83
84 public static PhysicsVector operator *(PhysicsVector v, float f)
85 {
86 return new PhysicsVector(v.X * f, v.Y * f, v.Z * f);
87 }
88
89 public static PhysicsVector operator *(float f, PhysicsVector v)
90 {
91 return v * f;
92 }
93
94 public virtual bool IsIdentical(PhysicsVector v, float tolerance)
95 {
96 PhysicsVector diff = this - v;
97 float d = diff.length();
98 if (d < tolerance)
99 return true;
100
101 return false;
102 }
53 } 103 }
54} \ No newline at end of file 104} \ No newline at end of file