@@ -176,7 +176,7 @@ class PlaceDirectionTest {
176176 }
177177
178178 @Test
179- fun `test yaw and pitch snapping for East direction` () {
179+ fun `test yaw and pitch snapping for East direction from up ` () {
180180 val direction = PlaceDirection .East
181181 val rot = Rotation (0.0 , - 90.0 )
182182 val snapped = direction.snapToArea(rot)
@@ -185,6 +185,128 @@ class PlaceDirectionTest {
185185 assertEquals(direction, PlaceDirection .fromRotation(snapped))
186186 }
187187
188+ @Test
189+ fun `test yaw and pitch snapping for South direction from up` () {
190+ val direction = PlaceDirection .South
191+ val rot = Rotation (90.0 , - 90.0 )
192+ val snapped = direction.snapToArea(rot)
193+
194+ // Verify that the yaw and pitch are snapped to the boundary
195+ assertEquals(direction, PlaceDirection .fromRotation(snapped))
196+ }
197+
198+ @Test
199+ fun `test yaw and pitch snapping for West direction from up` () {
200+ val direction = PlaceDirection .West
201+ val rot = Rotation (- 180.0 , - 90.0 )
202+ val snapped = direction.snapToArea(rot)
203+
204+ // Verify that the yaw and pitch are snapped to the boundary
205+ assertEquals(direction, PlaceDirection .fromRotation(snapped))
206+ }
207+
208+ @Test
209+ fun `test yaw and pitch snapping for North direction from up` () {
210+ val direction = PlaceDirection .North
211+ val rot = Rotation (- 90.0 , - 90.0 )
212+ val snapped = direction.snapToArea(rot)
213+
214+ // Verify that the yaw and pitch are snapped to the boundary
215+ assertEquals(direction, PlaceDirection .fromRotation(snapped))
216+ }
217+
218+ @Test
219+ fun `test yaw and pitch snapping for East direction from down` () {
220+ val direction = PlaceDirection .East
221+ val rot = Rotation (0.0 , 90.0 )
222+ val snapped = direction.snapToArea(rot)
223+
224+ // Verify that the yaw and pitch are snapped to the boundary
225+ assertEquals(direction, PlaceDirection .fromRotation(snapped))
226+ }
227+
228+ @Test
229+ fun `test yaw and pitch snapping for South direction from down` () {
230+ val direction = PlaceDirection .South
231+ val rot = Rotation (90.0 , 90.0 )
232+ val snapped = direction.snapToArea(rot)
233+
234+ // Verify that the yaw and pitch are snapped to the boundary
235+ assertEquals(direction, PlaceDirection .fromRotation(snapped))
236+ }
237+
238+ @Test
239+ fun `test yaw and pitch snapping for West direction from down` () {
240+ val direction = PlaceDirection .West
241+ val rot = Rotation (- 180.0 , 90.0 )
242+ val snapped = direction.snapToArea(rot)
243+
244+ // Verify that the yaw and pitch are snapped to the boundary
245+ assertEquals(direction, PlaceDirection .fromRotation(snapped))
246+ }
247+
248+ @Test
249+ fun `test yaw and pitch snapping for North direction from down` () {
250+ val direction = PlaceDirection .North
251+ val rot = Rotation (- 90.0 , 90.0 )
252+ val snapped = direction.snapToArea(rot)
253+
254+ // Verify that the yaw and pitch are snapped to the boundary
255+ assertEquals(direction, PlaceDirection .fromRotation(snapped))
256+ }
257+
258+ @Test
259+ fun `test yaw and pitch snapping from one snap to another starting with East from up` () {
260+ val direction = PlaceDirection .East
261+ val rot = Rotation (0.0 , - 90.0 )
262+ val firstSnapped = direction.snapToArea(rot)
263+
264+ val nextDirection = PlaceDirection .South
265+ val secondSnapped = nextDirection.snapToArea(firstSnapped)
266+
267+ // Verify that the yaw and pitch are snapped to the boundary
268+ assertEquals(direction, PlaceDirection .fromRotation(secondSnapped))
269+ }
270+
271+ @Test
272+ fun `test yaw and pitch snapping from one snap to another starting with South from up` () {
273+ val direction = PlaceDirection .South
274+ val rot = Rotation (90.0 , - 90.0 )
275+ val firstSnapped = direction.snapToArea(rot)
276+
277+ val nextDirection = PlaceDirection .West
278+ val secondSnapped = nextDirection.snapToArea(firstSnapped)
279+
280+ // Verify that the yaw and pitch are snapped to the boundary
281+ assertEquals(direction, PlaceDirection .fromRotation(secondSnapped))
282+ }
283+
284+ @Test
285+ fun `test yaw and pitch snapping from one snap to another starting with West from up` () {
286+ val direction = PlaceDirection .West
287+ val rot = Rotation (- 180.0 , - 90.0 )
288+ val firstSnapped = direction.snapToArea(rot)
289+
290+ val nextDirection = PlaceDirection .North
291+ val secondSnapped = nextDirection.snapToArea(firstSnapped)
292+
293+ // Verify that the yaw and pitch are snapped to the boundary
294+ assertEquals(direction, PlaceDirection .fromRotation(secondSnapped))
295+ }
296+
297+ @Test
298+ fun `test yaw and pitch snapping from one snap to another starting with North from up` () {
299+ val direction = PlaceDirection .North
300+ val rot = Rotation (- 90.0 , - 90.0 )
301+ val firstSnapped = direction.snapToArea(rot)
302+
303+ val nextDirection = PlaceDirection .East
304+ val secondSnapped = nextDirection.snapToArea(firstSnapped)
305+
306+ // Verify that the yaw and pitch are snapped to the boundary
307+ assertEquals(direction, PlaceDirection .fromRotation(secondSnapped))
308+ }
309+
188310 // Tests for when rotation is already in the area
189311
190312 @Test
0 commit comments