diff options
author | Charles Krinke | 2007-12-12 17:18:15 +0000 |
---|---|---|
committer | Charles Krinke | 2007-12-12 17:18:15 +0000 |
commit | 47b091f6630a4db2df72b4b2a0bc877287a751f1 (patch) | |
tree | d3990f3015be184330c9ac8dc50b4527e71c9dd1 /OpenSim/Region/ScriptEngine/Common | |
parent | couple of small fixes. (diff) | |
download | opensim-SC_OLD-47b091f6630a4db2df72b4b2a0bc877287a751f1.zip opensim-SC_OLD-47b091f6630a4db2df72b4b2a0bc877287a751f1.tar.gz opensim-SC_OLD-47b091f6630a4db2df72b4b2a0bc877287a751f1.tar.bz2 opensim-SC_OLD-47b091f6630a4db2df72b4b2a0bc877287a751f1.tar.xz |
Thanks to Alondria for: Adding vector->string and rotation->string,
float * vector, vector * float, vector / float, vector + vector,
vector - vector, vector * vector, vector % vector and changing
x, y, z, (and r) parts of vector and rotation to be lower case
(similar to LL's LSL vectors/rots). With these changes we should
expect to run kan-ed#1, kan-ed#2 and most of kan-ed#3.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 114 |
1 files changed, 90 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index df3d752..5618db6 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -36,48 +36,114 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
36 | [Serializable] | 36 | [Serializable] |
37 | public struct Vector3 | 37 | public struct Vector3 |
38 | { | 38 | { |
39 | public double X; | 39 | public double x; |
40 | public double Y; | 40 | public double y; |
41 | public double Z; | 41 | public double z; |
42 | 42 | ||
43 | public Vector3(Vector3 vector) | 43 | public Vector3(Vector3 vector) |
44 | { | 44 | { |
45 | X = (float) vector.X; | 45 | x = (float) vector.x; |
46 | Y = (float) vector.Y; | 46 | y = (float) vector.y; |
47 | Z = (float) vector.Z; | 47 | z = (float) vector.z; |
48 | } | 48 | } |
49 | 49 | ||
50 | public Vector3(double x, double y, double z) | 50 | public Vector3(double X, double Y, double Z) |
51 | { | 51 | { |
52 | X = x; | 52 | x = X; |
53 | Y = y; | 53 | y = Y; |
54 | Z = z; | 54 | z = Z; |
55 | } | ||
56 | public string ToString() | ||
57 | { | ||
58 | return "<" + x.ToString() + ", " + y.ToString() + ", " + z.ToString() + ">"; | ||
59 | } | ||
60 | public static Vector3 operator *(Vector3 v, float f) | ||
61 | { | ||
62 | v.x = v.x * f; | ||
63 | v.y = v.y * f; | ||
64 | v.z = v.z * f; | ||
65 | return v; | ||
66 | } | ||
67 | public static Vector3 operator /(Vector3 v, float f) | ||
68 | { | ||
69 | v.x = v.x / f; | ||
70 | v.y = v.y / f; | ||
71 | v.z = v.z / f; | ||
72 | return v; | ||
73 | } | ||
74 | public static Vector3 operator /(float f, Vector3 v) | ||
75 | { | ||
76 | v.x = v.x / f; | ||
77 | v.y = v.y / f; | ||
78 | v.z = v.z / f; | ||
79 | return v; | ||
80 | } | ||
81 | public static Vector3 operator *(float f, Vector3 v) | ||
82 | { | ||
83 | v.x = v.x * f; | ||
84 | v.y = v.y * f; | ||
85 | v.z = v.z * f; | ||
86 | return v; | ||
87 | } | ||
88 | public static Vector3 operator *(Vector3 v1, Vector3 v2) | ||
89 | { | ||
90 | v1.x = v1.x * v2.x; | ||
91 | v1.y = v1.y * v2.y; | ||
92 | v1.z = v1.z * v2.z; | ||
93 | return v1; | ||
94 | } | ||
95 | public static Vector3 operator +(Vector3 v1, Vector3 v2) | ||
96 | { | ||
97 | v1.x = v1.x + v2.x; | ||
98 | v1.y = v1.y + v2.y; | ||
99 | v1.z = v1.z + v2.z; | ||
100 | return v1; | ||
101 | } | ||
102 | public static Vector3 operator -(Vector3 v1, Vector3 v2) | ||
103 | { | ||
104 | v1.x = v1.x - v2.x; | ||
105 | v1.y = v1.y - v2.y; | ||
106 | v1.z = v1.z - v2.z; | ||
107 | return v1; | ||
108 | } | ||
109 | public static Vector3 operator %(Vector3 v1, Vector3 v2) | ||
110 | { | ||
111 | //Cross product | ||
112 | Vector3 tv; | ||
113 | tv.x = (v1.y * v2.z) - (v1.z * v2.y); | ||
114 | tv.y = (v1.z * v2.x) - (v1.x * v2.z); | ||
115 | tv.z = (v1.x * v2.y) - (v1.y * v2.x); | ||
116 | return tv; | ||
55 | } | 117 | } |
56 | } | 118 | } |
57 | 119 | ||
58 | [Serializable] | 120 | [Serializable] |
59 | public struct Quaternion | 121 | public struct Quaternion |
60 | { | 122 | { |
61 | public double X; | 123 | public double x; |
62 | public double Y; | 124 | public double y; |
63 | public double Z; | 125 | public double z; |
64 | public double R; | 126 | public double r; |
65 | 127 | ||
66 | public Quaternion(Quaternion Quat) | 128 | public Quaternion(Quaternion Quat) |
67 | { | 129 | { |
68 | X = (float) Quat.X; | 130 | x = (float) Quat.x; |
69 | Y = (float) Quat.Y; | 131 | y = (float) Quat.y; |
70 | Z = (float) Quat.Z; | 132 | z = (float) Quat.z; |
71 | R = (float) Quat.R; | 133 | r = (float) Quat.r; |
72 | } | 134 | } |
73 | 135 | ||
74 | public Quaternion(double x, double y, double z, double r) | 136 | public Quaternion(double X, double Y, double Z, double R) |
137 | { | ||
138 | x = X; | ||
139 | y = Y; | ||
140 | z = Z; | ||
141 | r = R; | ||
142 | } | ||
143 | public string ToString() | ||
75 | { | 144 | { |
76 | X = x; | 145 | return "<" + x.ToString() + ", " + y.ToString() + ", " + z.ToString() + ", " + r.ToString() + ">"; |
77 | Y = y; | ||
78 | Z = z; | ||
79 | R = r; | ||
80 | } | 146 | } |
81 | } | 147 | } |
82 | } | 148 | } |
83 | } \ No newline at end of file | 149 | } |