diff options
author | Teravus Ovares | 2008-05-29 20:20:50 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-29 20:20:50 +0000 |
commit | 918f887c0c10fda33633548f3601bdf07d74edfd (patch) | |
tree | 2db5459288f52117a071fcc51c7f2d1d7a19a3b3 /OpenSim/Region/Physics/Meshing/HelperTypes.cs | |
parent | Mantis#1416. Thank you very much, Melanie for a patch that: (diff) | |
download | opensim-SC_OLD-918f887c0c10fda33633548f3601bdf07d74edfd.zip opensim-SC_OLD-918f887c0c10fda33633548f3601bdf07d74edfd.tar.gz opensim-SC_OLD-918f887c0c10fda33633548f3601bdf07d74edfd.tar.bz2 opensim-SC_OLD-918f887c0c10fda33633548f3601bdf07d74edfd.tar.xz |
* Applying Dahlia's interim path curve patch. it adds initial support for some tori/ring parameters. Thanks Dahlia!
* Some situations do not match the client's render of the tori, we know and are working on it. This is an initial support patch, so expect it to not be exact.
* Some tapers are acting slightly odd. Will fix.
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/HelperTypes.cs')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/HelperTypes.cs | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs index 584133c..f031fb6 100644 --- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs +++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs | |||
@@ -51,9 +51,13 @@ public class Quaternion | |||
51 | { | 51 | { |
52 | // using (* 0.5) instead of (/2) | 52 | // using (* 0.5) instead of (/2) |
53 | w = (float)Math.Cos(angle * 0.5f); | 53 | w = (float)Math.Cos(angle * 0.5f); |
54 | x = axis.X * (float)Math.Sin(angle * 0.5f); | 54 | float sin = (float)Math.Sin(angle * 0.5f); |
55 | y = axis.Y * (float)Math.Sin(angle * 0.5f); | 55 | //x = axis.X * (float)Math.Sin(angle * 0.5f); |
56 | z = axis.Z * (float)Math.Sin(angle * 0.5f); | 56 | //y = axis.Y * (float)Math.Sin(angle * 0.5f); |
57 | //z = axis.Z * (float)Math.Sin(angle * 0.5f); | ||
58 | x = axis.X * sin; | ||
59 | y = axis.Y * sin; | ||
60 | z = axis.Z * sin; | ||
57 | normalize(); | 61 | normalize(); |
58 | } | 62 | } |
59 | public static Quaternion operator *(Quaternion a, Quaternion b) | 63 | public static Quaternion operator *(Quaternion a, Quaternion b) |
@@ -73,12 +77,18 @@ public class Quaternion | |||
73 | } | 77 | } |
74 | public void normalize() | 78 | public void normalize() |
75 | { | 79 | { |
76 | float mag = length(); | 80 | //float mag = length(); |
77 | 81 | ||
78 | w /= mag; | 82 | //w /= mag; |
79 | x /= mag; | 83 | //x /= mag; |
80 | y /= mag; | 84 | //y /= mag; |
81 | z /= mag; | 85 | //z /= mag; |
86 | float iMag = 1.0f / length(); | ||
87 | |||
88 | w *= iMag; | ||
89 | x *= iMag; | ||
90 | y *= iMag; | ||
91 | z *= iMag; | ||
82 | } | 92 | } |
83 | public float length() | 93 | public float length() |
84 | { | 94 | { |
@@ -169,7 +179,8 @@ public class Vertex : PhysicsVector, IComparable<Vertex> | |||
169 | float tlength = length(); | 179 | float tlength = length(); |
170 | if (tlength != 0) | 180 | if (tlength != 0) |
171 | { | 181 | { |
172 | return new Vertex(X / tlength, Y / tlength, Z / tlength); | 182 | float mul = 1.0f / tlength; |
183 | return new Vertex(X * mul, Y * mul, Z * mul); | ||
173 | } | 184 | } |
174 | else | 185 | else |
175 | { | 186 | { |
@@ -230,9 +241,10 @@ public class Vertex : PhysicsVector, IComparable<Vertex> | |||
230 | { | 241 | { |
231 | return new Vertex(0f,0f,0f); | 242 | return new Vertex(0f,0f,0f); |
232 | } | 243 | } |
233 | v1.X /= am; | 244 | float mul = 1.0f / am; |
234 | v1.Y /= am; | 245 | v1.X *= mul; |
235 | v1.Z /= am; | 246 | v1.Y *= mul; |
247 | v1.Z *= mul; | ||
236 | return v1; | 248 | return v1; |
237 | } | 249 | } |
238 | 250 | ||