diff options
author | Micheil Merlin | 2010-08-28 22:44:18 -0500 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-09-03 21:11:13 +0100 |
commit | 8daea4d7c005d746989a5635c71bd11cdb034482 (patch) | |
tree | 3ce79d033fdfa7b00f63902ca35e960e5fba8e82 /OpenSim | |
parent | Fix sqlite migration problems by moving migrations in 019_RegionStore.sql and... (diff) | |
download | opensim-SC_OLD-8daea4d7c005d746989a5635c71bd11cdb034482.zip opensim-SC_OLD-8daea4d7c005d746989a5635c71bd11cdb034482.tar.gz opensim-SC_OLD-8daea4d7c005d746989a5635c71bd11cdb034482.tar.bz2 opensim-SC_OLD-8daea4d7c005d746989a5635c71bd11cdb034482.tar.xz |
llRot2Euler Tests
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 358ce22..dfc9aa3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -134,5 +134,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
134 | 134 | ||
135 | #endregion | 135 | #endregion |
136 | 136 | ||
137 | [Test] | ||
138 | // llRot2Euler test. | ||
139 | public void TestllRot2Euler() | ||
140 | { | ||
141 | // 180, 90 and zero degree rotations. | ||
142 | CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 0.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, 0.0f)); | ||
143 | CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 1.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, Math.PI)); | ||
144 | CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 1.0f, 0.0f), new LSL_Types.Vector3(0.0f, 0.0f, Math.PI)); | ||
145 | CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f), new LSL_Types.Vector3(0.0f, 0.0f, 0.0f)); | ||
146 | CheckllRot2Euler(new LSL_Types.Quaternion(-0.5f, -0.5f, 0.5f, 0.5f), new LSL_Types.Vector3(0, -Math.PI / 2.0f, Math.PI / 2.0f)); | ||
147 | CheckllRot2Euler(new LSL_Types.Quaternion(-0.707107f, 0.0f, 0.0f, -0.707107f), new LSL_Types.Vector3(Math.PI / 2.0f, 0.0f, 0.0f)); | ||
148 | // A couple of messy rotations. | ||
149 | CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 5.651f, -3.1f, 67.023f), new LSL_Types.Vector3(0.037818f, 0.166447f, -0.095595f)); | ||
150 | CheckllRot2Euler(new LSL_Types.Quaternion(0.719188f, -0.408934f, -0.363998f, -0.427841f), new LSL_Types.Vector3(-1.954769f, -0.174533f, 1.151917f)); | ||
151 | } | ||
152 | |||
153 | private void CheckllRot2Euler(LSL_Types.Quaternion rot, LSL_Types.Vector3 eulerCheck) | ||
154 | { | ||
155 | // Call LSL function to convert quaternion rotaion to euler radians. | ||
156 | LSL_Types.Vector3 eulerCalc = m_lslApi.llRot2Euler(rot); | ||
157 | // Check upper and lower bounds of x, y and z. | ||
158 | // This type of check is performed as opposed to comparing for equal numbers, in order to allow slight | ||
159 | // differences in accuracy. | ||
160 | Assert.Greater(eulerCalc.x, eulerCheck.x - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X lower bounds check fail"); | ||
161 | Assert.Less(eulerCalc.x, eulerCheck.x + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X upper bounds check fail"); | ||
162 | Assert.Greater(eulerCalc.y, eulerCheck.y - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y lower bounds check fail"); | ||
163 | Assert.Less(eulerCalc.y, eulerCheck.y + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y upper bounds check fail"); | ||
164 | Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); | ||
165 | Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); | ||
166 | } | ||
137 | } | 167 | } |
138 | } | 168 | } |