From: Kimmo Hoikka Date: Tue, 14 Apr 2015 15:56:51 +0000 (+0100) Subject: Cleaned up Degree, Radian, AngleAxis and Quaternion classes X-Git-Tag: dali_1.0.39~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae0234f649dae770bff1a404de99ab2b5b3bdb54;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Cleaned up Degree, Radian, AngleAxis and Quaternion classes - Inline Degree, Radian and AngleAxis types to avoid unnecessary exports / export table lookups in using code - Change AngleAxis to store a Radian angle for better accuracy - Make Quaternion explicitly take a Radian as constructor Change-Id: I81f5478572322c65f87045d1b58c621da8989d27 --- diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h index 88315d4..44f2da9 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h @@ -139,13 +139,13 @@ inline bool CompareType(Quaternion q1, Quaternion q2, float epsilon) template <> inline bool CompareType(Radian q1, Radian q2, float epsilon) { - return CompareType(float(q1), float(q2), epsilon); + return CompareType(q1.radian, q2.radian, epsilon); } template <> inline bool CompareType(Degree q1, Degree q2, float epsilon) { - return CompareType(float(q1), float(q2), epsilon); + return CompareType(q1.degree, q2.degree, epsilon); } bool operator==(TimePeriod a, TimePeriod b); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Cluster.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Cluster.cpp index 6a35824..b83ff8c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Cluster.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Cluster.cpp @@ -169,7 +169,7 @@ int UtcDaliClusterExpandAndCollapseChild(void) DALI_TEST_CHECK( cluster.GetExpandedCount() == 0 ); // Transform and restore the child - cluster.TransformChild(1, Vector3(10.0f, 10.0f, 1.0f), Vector3(1.0f, 1.0f, 1.0f), Quaternion(0.0f, Vector3::YAXIS), AlphaFunctions::EaseOut, 0.5f); + cluster.TransformChild(1, Vector3(10.0f, 10.0f, 1.0f), Vector3(1.0f, 1.0f, 1.0f), Quaternion( Radian(0.0f), Vector3::YAXIS), AlphaFunctions::EaseOut, 0.5f); cluster.RestoreChild(1, AlphaFunctions::EaseOut, 0.25f, true); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-CubeTransitionEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-CubeTransitionEffect.cpp index 28690e8..055b122 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-CubeTransitionEffect.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-CubeTransitionEffect.cpp @@ -386,28 +386,28 @@ int UtcDaliCubeTransitionWaveEffectStartTransition(void) waveEffect.SetTargetImage( imageActor ); waveEffect.StartTransition(true); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); waveEffect.SetTargetImage( imageActor ); waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_180, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); waveEffect.SetTargetImage( imageActor ); waveEffect.StartTransition(false); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); waveEffect.SetTargetImage( imageActor ); waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -437,8 +437,8 @@ int UtcDaliCubeTransitionCrossEffectStartTransition(void) crossEffect.SetTargetImage( imageActor ); crossEffect.StartTransition(true); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -446,8 +446,8 @@ int UtcDaliCubeTransitionCrossEffectStartTransition(void) crossEffect.SetTargetImage( imageActor ); crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_180, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_180, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -455,16 +455,16 @@ int UtcDaliCubeTransitionCrossEffectStartTransition(void) crossEffect.SetTargetImage( imageActor ); crossEffect.StartTransition(false); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); crossEffect.SetTargetImage( imageActor ); crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -493,16 +493,16 @@ int UtcDaliCubeTransitionFoldEffectStartTransition(void) foldEffect.SetTargetImage( imageActor ); foldEffect.StartTransition(true); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); foldEffect.SetTargetImage( imageActor ); foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_180, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_180, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -510,16 +510,16 @@ int UtcDaliCubeTransitionFoldEffectStartTransition(void) foldEffect.SetTargetImage( imageActor ); foldEffect.StartTransition(false); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(),fullBrightness, FLT_EPISILON, TEST_LOCATION ); foldEffect.SetTargetImage( imageActor ); foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -749,7 +749,7 @@ int UtcDaliCubeTransitionWaveEffectStopTransition(void) waveEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -759,7 +759,7 @@ int UtcDaliCubeTransitionWaveEffectStopTransition(void) waveEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_180, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -769,7 +769,7 @@ int UtcDaliCubeTransitionWaveEffectStopTransition(void) waveEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -779,7 +779,7 @@ int UtcDaliCubeTransitionWaveEffectStopTransition(void) waveEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -813,8 +813,8 @@ int UtcDaliCubeTransitionCrossEffectStopTransition(void) crossEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -825,8 +825,8 @@ int UtcDaliCubeTransitionCrossEffectStopTransition(void) crossEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_180, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_180, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -836,8 +836,8 @@ int UtcDaliCubeTransitionCrossEffectStopTransition(void) crossEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -847,8 +847,8 @@ int UtcDaliCubeTransitionCrossEffectStopTransition(void) crossEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -881,8 +881,8 @@ int UtcDaliCubeTransitionFoldEffectStopTransition(void) foldEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -892,8 +892,8 @@ int UtcDaliCubeTransitionFoldEffectStopTransition(void) foldEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_180, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_180, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -903,8 +903,8 @@ int UtcDaliCubeTransitionFoldEffectStopTransition(void) foldEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -914,8 +914,8 @@ int UtcDaliCubeTransitionFoldEffectStopTransition(void) foldEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-DepthLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-DepthLayout.cpp index 9462c28..90b92f6 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-DepthLayout.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-DepthLayout.cpp @@ -164,7 +164,7 @@ int UtcDaliDepthLayoutSetAndGetTiltAngle(void) depthLayout->SetTiltAngle(Degree(25.0f)); // Check whether we get the correct tilt angle - DALI_TEST_EQUALS(float(depthLayout->GetTiltAngle()), 25.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(depthLayout->GetTiltAngle(), Degree(25.0f), 0.001f, TEST_LOCATION ); END_TEST; } @@ -209,7 +209,7 @@ int UtcDaliDepthLayoutSetAndGetItemTiltAngle(void) depthLayout->SetItemTiltAngle(Degree(5.0f)); // Check whether we get the correct item's tilt angle - DALI_TEST_EQUALS(float(depthLayout->GetItemTiltAngle()), 5.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(depthLayout->GetItemTiltAngle(), Degree(5.0f), 0.001f, TEST_LOCATION ); END_TEST; } @@ -587,7 +587,7 @@ int UtcDaliDepthLayoutScrollDirection(void) application.Render(); Degree deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 180.0f); + DALI_TEST_CHECK(deg.degree == 180.0f); navigationLayout->SetOrientation(ControlOrientation::Down); view.ActivateLayout(0, vec, 0.0f); @@ -595,7 +595,7 @@ int UtcDaliDepthLayoutScrollDirection(void) application.Render(); deg = layout->GetScrollDirection(); - DALI_TEST_CHECK((deg == 0.0f)); + DALI_TEST_CHECK((deg.degree == 0.0f)); layout->SetOrientation(ControlOrientation::Left); view.ActivateLayout(0, vec, 0.0f); @@ -603,7 +603,7 @@ int UtcDaliDepthLayoutScrollDirection(void) application.Render(); deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 270.0f); + DALI_TEST_CHECK(deg.degree == 270.0f); navigationLayout->SetOrientation(ControlOrientation::Right); view.ActivateLayout(0, vec, 0.0f); @@ -611,7 +611,7 @@ int UtcDaliDepthLayoutScrollDirection(void) application.Render(); deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 90.0f); + DALI_TEST_CHECK(deg.degree == 90.0f); Stage::GetCurrent().Remove(view); END_TEST; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp index 7e9d341..6b050bc 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp @@ -517,7 +517,7 @@ int UtcDaliGridLayoutScrollDirection(void) application.Render(); Degree deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 0.0f); + DALI_TEST_CHECK(deg.degree == 0.0f); gridLayout->SetOrientation(ControlOrientation::Down); view.ActivateLayout(0, vec, 0.0f); @@ -525,7 +525,7 @@ int UtcDaliGridLayoutScrollDirection(void) application.Render(); deg = layout->GetScrollDirection(); - DALI_TEST_CHECK((deg == 180.0f)); + DALI_TEST_CHECK((deg.degree == 180.0f)); layout->SetOrientation(ControlOrientation::Left); view.ActivateLayout(0, vec, 0.0f); @@ -533,7 +533,7 @@ int UtcDaliGridLayoutScrollDirection(void) application.Render(); deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 90.f); + DALI_TEST_CHECK(deg.degree == 90.f); gridLayout->SetOrientation(ControlOrientation::Right); view.ActivateLayout(0, vec, 0.0f); @@ -541,7 +541,7 @@ int UtcDaliGridLayoutScrollDirection(void) application.Render(); deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 270.0f); + DALI_TEST_CHECK(deg.degree == 270.0f); Stage::GetCurrent().Remove(view); END_TEST; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-SpiralLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-SpiralLayout.cpp index ea4e8d1..2bed81a 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-SpiralLayout.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-SpiralLayout.cpp @@ -130,7 +130,7 @@ int UtcDaliSpiralSetAndGetItemSpacing(void) spiralLayout->SetItemSpacing(Radian(0.6f)); // Check whether we get the correct item spacing - DALI_TEST_EQUALS(spiralLayout->GetItemSpacing(), 0.6f, TEST_LOCATION ); + DALI_TEST_EQUALS(spiralLayout->GetItemSpacing(), Radian(0.6f), TEST_LOCATION ); END_TEST; } @@ -464,7 +464,7 @@ int UtcDaliSpiralLayoutScrollDirection(void) application.Render(); Degree deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == -45.0f); + DALI_TEST_CHECK(deg.degree == -45.0f); navigationLayout->SetOrientation(ControlOrientation::Down); view.ActivateLayout(0, vec, 0.0f); @@ -472,7 +472,7 @@ int UtcDaliSpiralLayoutScrollDirection(void) application.Render(); deg = layout->GetScrollDirection(); - DALI_TEST_CHECK((deg == 180.0f - 45.0f)); + DALI_TEST_CHECK((deg.degree == 180.0f - 45.0f)); layout->SetOrientation(ControlOrientation::Left); view.ActivateLayout(0, vec, 0.0f); @@ -480,7 +480,7 @@ int UtcDaliSpiralLayoutScrollDirection(void) application.Render(); deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 45.0f); + DALI_TEST_CHECK(deg.degree == 45.0f); navigationLayout->SetOrientation(ControlOrientation::Right); view.ActivateLayout(0, vec, 0.0f); @@ -488,7 +488,7 @@ int UtcDaliSpiralLayoutScrollDirection(void) application.Render(); deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == (270.0f - 45.0f)); + DALI_TEST_CHECK(deg.degree == (270.0f - 45.0f)); Stage::GetCurrent().Remove(view); END_TEST; diff --git a/dali-toolkit/internal/controls/cluster/cluster-impl.cpp b/dali-toolkit/internal/controls/cluster/cluster-impl.cpp index d43d63a..e2b4297 100644 --- a/dali-toolkit/internal/controls/cluster/cluster-impl.cpp +++ b/dali-toolkit/internal/controls/cluster/cluster-impl.cpp @@ -285,7 +285,7 @@ void Cluster::ExpandChild( unsigned int index ) const float angle = (rand()%360) * Math::PI / 180.0f; Vector3 position(sin(angle) * length, -cos(angle) * length, zOffset); const float scale(1.2f); - const float rotate = ((rand()%30) - 15) * Math::PI / 180.0f; + const Radian rotate( Degree( (rand()%30) - 15 ) ); position += childInfo.mActor.GetCurrentPosition(); @@ -521,7 +521,7 @@ void Cluster::DoTransformAction(const PropertyValueContainer& attributes) unsigned int index = attributes[0].Get(); Vector3 position; Vector3 scale(Vector3::ONE); - Quaternion rotation(0.0f, Vector3::ZAXIS); + Quaternion rotation( Dali::ANGLE_0, Vector3::ZAXIS ); DALI_ASSERT_ALWAYS(attributes[1].GetType() == Property::VECTOR3); attributes[1].Get(position); diff --git a/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp b/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp index 4974ce1..16dd5ea 100644 --- a/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp +++ b/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp @@ -473,7 +473,7 @@ void ClusterStyleRandom::ApplyStyle(Actor child, unsigned int index, AlphaFuncti Apply( child, FirstOrderEquation( GetClusterSize(), Vector3(position.x, position.y, 0.0f), Vector3(0.0f, 0.0f, depthPropertyValue) ), FirstOrderEquation( GetClusterSize(), Vector3::ONE * size), - Quaternion(rotation, Vector3::ZAXIS), + Quaternion( Radian( rotation ), Vector3::ZAXIS ), Vector3::ONE, alpha, durationSeconds); diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index 39f8be3..fc464ad 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -113,7 +113,7 @@ struct RotationConstraint mStep = 1.f / pageWidth; mSign = isTurnBack ? -1.0f : 1.0f; mConst = isTurnBack ? -1.0f : 0.f; - mRotation = isTurnBack ? Quaternion( -Math::PI, Vector3::YAXIS ) : Quaternion( 0.f, Vector3::YAXIS ); + mRotation = isTurnBack ? Quaternion( Radian( -Math::PI ), Vector3::YAXIS ) : Quaternion( Radian(0.f), Vector3::YAXIS ); } void operator()( Quaternion& current, const PropertyInputContainer& inputs ) @@ -127,7 +127,7 @@ struct RotationConstraint { float coef = std::max(-1.0f, mStep*(mDistance-displacement)); float angle = Math::PI * ( mConst + mSign * coef ); - current = Quaternion( angle, Vector3::YAXIS ); + current = Quaternion( Radian( angle ), Vector3::YAXIS ); } } diff --git a/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp b/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp index a19e988..4b7760e 100755 --- a/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp @@ -134,11 +134,11 @@ struct ScrollBarInternalRotationConstraint if( (mVertical && Toolkit::IsVertical(orientation)) || (!mVertical && Toolkit::IsHorizontal(orientation)) ) { - current = Quaternion(0.0f, Vector3::ZAXIS); + current = Quaternion( Radian( 0.0f ), Vector3::ZAXIS ); } else { - current = Quaternion(0.5f * Math::PI, Vector3::ZAXIS); + current = Quaternion( Radian( 0.5f * Math::PI ), Vector3::ZAXIS); } } diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp index 35a61ac..0d2e728 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp @@ -254,12 +254,12 @@ void ScrollOvershootEffectRipple::UpdateVisibility( bool visible ) const Vector3 parentSize = self.GetCurrentSize(); if(IsVertical()) { - mOvershootOverlay.SetOrientation(Quaternion(0.0f, Vector3::ZAXIS)); + mOvershootOverlay.SetOrientation( Quaternion( Radian( 0.0f ), Vector3::ZAXIS ) ); mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width), size.depth); } else { - mOvershootOverlay.SetOrientation(Quaternion(1.5f * Math::PI, Vector3::ZAXIS)); + mOvershootOverlay.SetOrientation( Quaternion( Radian( 1.5f * Math::PI ), Vector3::ZAXIS ) ); mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height), size.depth); relativeOffset = Vector3(0.0f, 1.0f, 0.0f); } @@ -273,13 +273,13 @@ void ScrollOvershootEffectRipple::UpdateVisibility( bool visible ) const Vector3 parentSize = self.GetCurrentSize(); if(IsVertical()) { - mOvershootOverlay.SetOrientation(Quaternion(Math::PI, Vector3::ZAXIS)); + mOvershootOverlay.SetOrientation( Quaternion( Radian( Math::PI ), Vector3::ZAXIS ) ); mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width), size.depth); relativeOffset = Vector3(1.0f, 1.0f, 0.0f); } else { - mOvershootOverlay.SetOrientation(Quaternion(0.5f * Math::PI, Vector3::ZAXIS)); + mOvershootOverlay.SetOrientation( Quaternion( Radian( 0.5f * Math::PI ), Vector3::ZAXIS ) ); mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height), size.depth); relativeOffset = Vector3(1.0f, 0.0f, 0.0f); } diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp index 4f467f2..86ad736 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp @@ -144,8 +144,8 @@ public: angle *= activate; - current = Quaternion(-angle.x, Vector3::YAXIS) * - Quaternion(angle.y, Vector3::XAXIS) * + current = Quaternion( Radian( -angle.x ), Vector3::YAXIS ) * + Quaternion( Radian( angle.y ), Vector3::XAXIS ) * current; } diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp index cf28691..f7f3384 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp @@ -117,9 +117,9 @@ public: Vector2 angle( Clamp(position.x, -1.0f,1.0f), Clamp(position.y, -1.0f,1.0f) ); - current = Quaternion( angle.x * mAngleSwing.x, Vector3::YAXIS) * - Quaternion(-angle.y * mAngleSwing.y, Vector3::XAXIS) * - current; + current = Quaternion( Radian( angle.x * mAngleSwing.x ), Vector3::YAXIS ) * + Quaternion( Radian( -angle.y * mAngleSwing.y ), Vector3::XAXIS ) * + current; } /** @@ -255,9 +255,9 @@ public: // Rotate position (current) about point. Vector3 position = current - mAnchor; - Quaternion rotatorY(angle.x, Vector3::YAXIS); + Quaternion rotatorY( Radian( angle.x ), Vector3::YAXIS); position = rotatorY.Rotate(position); - Quaternion rotatorX(-angle.y, Vector3::XAXIS); + Quaternion rotatorX( Radian( -angle.y ), Vector3::XAXIS); position = rotatorX.Rotate(position); position += mAnchor; position += relativePosition * mPositionSwing; diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp index 66855a6..1184ca6 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp @@ -108,8 +108,8 @@ public: // our page by calculating the amount we've moved as a fraction of the total size of the page. Vector2 angle( position / pageSize * Dali::Math::PI_2 ); - current = Quaternion( -angle.x * mAngleSwing.x, Vector3::YAXIS ) * - Quaternion( angle.y * mAngleSwing.y, Vector3::XAXIS ) * + current = Quaternion( Radian( -angle.x * mAngleSwing.x ), Vector3::YAXIS ) * + Quaternion( Radian( angle.y * mAngleSwing.y ), Vector3::XAXIS ) * current; } diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp index 0871b57..10d6d1e 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp @@ -145,8 +145,8 @@ public: } ClampInPlace( angle.y, -angleMaxMin.y, angleMaxMin.y ); - current = Quaternion( angle.x, Vector3::YAXIS ) * - Quaternion( angle.y, Vector3::XAXIS ) * + current = Quaternion( Radian( angle.x ), Vector3::YAXIS ) * + Quaternion( Radian( angle.y ), Vector3::XAXIS ) * current; } diff --git a/dali-toolkit/internal/controls/view/view-impl.cpp b/dali-toolkit/internal/controls/view/view-impl.cpp index 19dd781..0262bb7 100644 --- a/dali-toolkit/internal/controls/view/view-impl.cpp +++ b/dali-toolkit/internal/controls/view/view-impl.cpp @@ -162,10 +162,10 @@ void View::SetBackground( ImageActor backgroundImage ) void View::SetOrientationFunction( Degree portrait, Degree landscale, Degree portraitInverse, Degree landscapeInverse ) { - mOrientationFunction[View::PORTRAIT] = portrait; - mOrientationFunction[View::LANDSCAPE] = landscale; - mOrientationFunction[View::PORTRAIT_INVERSE] = portraitInverse; - mOrientationFunction[View::LANDSCAPE_INVERSE] = landscapeInverse; + mOrientationFunction[View::PORTRAIT] = portrait.degree; + mOrientationFunction[View::LANDSCAPE] = landscale.degree; + mOrientationFunction[View::PORTRAIT_INVERSE] = portraitInverse.degree; + mOrientationFunction[View::LANDSCAPE_INVERSE] = landscapeInverse.degree; } void View::OrientationChanged( Dali::Orientation orientation ) @@ -182,7 +182,7 @@ void View::OrientationChanged( Dali::Orientation orientation ) // has parent so we expect it to be on stage mRotateAnimation = Animation::New( ROTATION_ANIMATION_DURATION ); - mRotateAnimation.AnimateTo( Property( self, Actor::Property::ORIENTATION ), Quaternion( -orientation.GetRadians(), Vector3::ZAXIS ), AlphaFunctions::EaseOut ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::ORIENTATION ), Quaternion( Radian( -orientation.GetRadians() ), Vector3::ZAXIS ), AlphaFunctions::EaseOut ); // Resize the view if( mFullScreen ) @@ -300,19 +300,19 @@ View::Orientation View::DegreeToViewOrientation( Degree degree ) { View::Orientation orientation = PORTRAIT; - if( fabsf( mOrientationFunction[PORTRAIT] - degree ) <= GetRangedEpsilon( mOrientationFunction[PORTRAIT], degree ) ) + if( fabsf( mOrientationFunction[PORTRAIT] - degree.degree ) <= GetRangedEpsilon( mOrientationFunction[PORTRAIT], degree.degree ) ) { orientation = PORTRAIT; } - else if( fabsf( mOrientationFunction[LANDSCAPE] - degree ) <= GetRangedEpsilon( mOrientationFunction[LANDSCAPE], degree ) ) + else if( fabsf( mOrientationFunction[LANDSCAPE] - degree.degree ) <= GetRangedEpsilon( mOrientationFunction[LANDSCAPE], degree.degree ) ) { orientation = LANDSCAPE; } - else if( fabsf( mOrientationFunction[PORTRAIT_INVERSE] - degree ) <= GetRangedEpsilon( mOrientationFunction[PORTRAIT_INVERSE], degree ) ) + else if( fabsf( mOrientationFunction[PORTRAIT_INVERSE] - degree.degree ) <= GetRangedEpsilon( mOrientationFunction[PORTRAIT_INVERSE], degree.degree ) ) { orientation = PORTRAIT_INVERSE; } - else if( fabsf( mOrientationFunction[LANDSCAPE_INVERSE] - degree ) <= GetRangedEpsilon( mOrientationFunction[LANDSCAPE_INVERSE], degree ) ) + else if( fabsf( mOrientationFunction[LANDSCAPE_INVERSE] - degree.degree ) <= GetRangedEpsilon( mOrientationFunction[LANDSCAPE_INVERSE], degree.degree ) ) { orientation = LANDSCAPE_INVERSE; } diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.cpp index 564235c..7b4e3f6 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.cpp +++ b/dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.cpp @@ -235,62 +235,62 @@ struct DepthPositionConstraint270 struct DepthRotationConstraint0 { - DepthRotationConstraint0(float angleRadians) + DepthRotationConstraint0(Radian angleRadians) : mTiltAngle(angleRadians) { } Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) { - return Quaternion(0.0f, Vector3::ZAXIS) * Quaternion(mTiltAngle, Vector3::XAXIS); + return Quaternion( Radian( 0.0f ), Vector3::ZAXIS ) * Quaternion( mTiltAngle, Vector3::XAXIS ); } - float mTiltAngle; + Radian mTiltAngle; }; struct DepthRotationConstraint90 { - DepthRotationConstraint90(float angleRadians) + DepthRotationConstraint90(Radian angleRadians) : mTiltAngle(angleRadians) { } Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) { - return Quaternion(1.5f * Math::PI, Vector3::ZAXIS) * Quaternion(mTiltAngle, Vector3::XAXIS); + return Quaternion( Radian( 1.5f * Math::PI ), Vector3::ZAXIS) * Quaternion( mTiltAngle, Vector3::XAXIS ); } - float mTiltAngle; + Radian mTiltAngle; }; struct DepthRotationConstraint180 { - DepthRotationConstraint180(float angleRadians) + DepthRotationConstraint180(Radian angleRadians) : mTiltAngle(angleRadians) { } Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) { - return Quaternion(-Math::PI, Vector3::ZAXIS) * Quaternion(mTiltAngle, Vector3::XAXIS); + return Quaternion( Radian( -Math::PI ), Vector3::ZAXIS) * Quaternion( mTiltAngle, Vector3::XAXIS ); } - float mTiltAngle; + Radian mTiltAngle; }; struct DepthRotationConstraint270 { - DepthRotationConstraint270(float angleRadians) + DepthRotationConstraint270(Radian angleRadians) : mTiltAngle(angleRadians) { } Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) { - return Quaternion(0.5f * Math::PI, Vector3::ZAXIS) * Quaternion(mTiltAngle, Vector3::XAXIS); + return Quaternion( Radian( 0.5f * Math::PI ), Vector3::ZAXIS) * Quaternion( mTiltAngle, Vector3::XAXIS ); } - float mTiltAngle; + Radian mTiltAngle; }; struct DepthColorConstraint @@ -450,12 +450,12 @@ float DepthLayout::GetRowSpacing() const void DepthLayout::SetTiltAngle(Degree angle) { - mImpl->mTiltAngle = Degree( Clamp(angle, -45.0f, 45.0f) ); + mImpl->mTiltAngle = Degree( Clamp( angle, -45.0f, 45.0f ) ); } Degree DepthLayout::GetTiltAngle() const { - return mImpl->mTiltAngle; + return Degree( mImpl->mTiltAngle ); } void DepthLayout::SetItemSizeFunction(ItemSizeFunction function) @@ -485,7 +485,7 @@ void DepthLayout::SetItemTiltAngle(Degree angle) Degree DepthLayout::GetItemTiltAngle() const { - return mImpl->mItemTiltAngle; + return Degree( mImpl->mItemTiltAngle ); } void DepthLayout::SetColumnPositionFunction(ColumnPositionFunction function) @@ -673,19 +673,19 @@ Degree DepthLayout::GetScrollDirection() const if (mOrientation == ControlOrientation::Up) { - scrollDirection = 180.0f; + scrollDirection = Degree( 180.0f ); } else if (mOrientation == ControlOrientation::Left) { - scrollDirection = 270.0f; + scrollDirection = Degree( 270.0f ); } else if (mOrientation == ControlOrientation::Down) { - scrollDirection = 0.0f; + scrollDirection = Degree( 0.0f ); } else // mOrientation == ControlOrientation::Right { - scrollDirection = 90.0f; + scrollDirection = Degree( 90.0f ); } return scrollDirection; diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.cpp index 93e9956..35d5ab6 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.cpp +++ b/dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.cpp @@ -193,7 +193,7 @@ struct GridRotationConstraint0 { Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) { - return Quaternion(0.0f, Vector3::ZAXIS); + return Quaternion( Radian( 0.0f ), Vector3::ZAXIS); } }; @@ -201,7 +201,7 @@ struct GridRotationConstraint90 { Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) { - return Quaternion(1.5f * Math::PI, Vector3::ZAXIS); + return Quaternion( Radian( 1.5f * Math::PI ), Vector3::ZAXIS); } }; @@ -209,7 +209,7 @@ struct GridRotationConstraint180 { Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) { - return Quaternion(Math::PI, Vector3::ZAXIS); + return Quaternion( Radian( Math::PI ), Vector3::ZAXIS); } }; @@ -217,7 +217,7 @@ struct GridRotationConstraint270 { Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) { - return Quaternion(0.5f * Math::PI, Vector3::ZAXIS); + return Quaternion( Radian( 0.5f * Math::PI ), Vector3::ZAXIS); } }; @@ -692,19 +692,19 @@ Degree GridLayout::GetScrollDirection() const if (mOrientation == ControlOrientation::Up) { - scrollDirection = 0.0f; + scrollDirection = Degree( 0.0f ); } else if (mOrientation == ControlOrientation::Left) { - scrollDirection = 90.0f; + scrollDirection = Degree( 90.0f ); } else if (mOrientation == ControlOrientation::Down) { - scrollDirection = 180.0f; + scrollDirection = Degree( 180.0f ); } else // mOrientation == ControlOrientation::Right { - scrollDirection = 270.0f; + scrollDirection = Degree( 270.0f ); } return scrollDirection; diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.cpp index 07b5a78..71bf4a8 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.cpp +++ b/dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.cpp @@ -178,7 +178,7 @@ struct SpiralRotationConstraintUp { float angle = -mItemSpacingRadians * layoutPosition; - return Quaternion(angle, Vector3::YAXIS); + return Quaternion( Radian( angle ), Vector3::YAXIS); } float mItemSpacingRadians; @@ -195,7 +195,7 @@ struct SpiralRotationConstraintLeft { float angle = -mItemSpacingRadians * layoutPosition; - return Quaternion(-Math::PI*0.5f, Vector3::ZAXIS) * Quaternion(angle, Vector3::YAXIS); + return Quaternion( Radian( -Math::PI * 0.5f ), Vector3::ZAXIS ) * Quaternion( Radian( angle ), Vector3::YAXIS ); } float mItemSpacingRadians; @@ -212,7 +212,7 @@ struct SpiralRotationConstraintDown { float angle = -mItemSpacingRadians * layoutPosition; - return Quaternion(-Math::PI, Vector3::ZAXIS) * Quaternion(angle, Vector3::YAXIS); + return Quaternion( Radian( -Math::PI ), Vector3::ZAXIS) * Quaternion( Radian( angle ), Vector3::YAXIS ); } float mItemSpacingRadians; @@ -229,7 +229,7 @@ struct SpiralRotationConstraintRight { float angle = -mItemSpacingRadians * layoutPosition; - return Quaternion(-Math::PI*1.5f, Vector3::ZAXIS) * Quaternion(angle, Vector3::YAXIS); + return Quaternion( Radian( -Math::PI * 1.5f ), Vector3::ZAXIS) * Quaternion( Radian( angle ), Vector3::YAXIS ); } float mItemSpacingRadians; @@ -244,10 +244,9 @@ struct SpiralColorConstraint Vector4 operator()(const Vector4& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) { - Degree angle = Radian(mItemSpacingRadians * fabsf(layoutPosition)); - angle = (float)((int)angle % 360); + Radian angle( mItemSpacingRadians * fabsf(layoutPosition) / Dali::ANGLE_360 ); - float progress = angle / 360.0f; + float progress = angle - floorf( angle ); // take fractional bit only to get between 0.0 - 1.0 progress = (progress > 0.5f) ? 2.0f*(1.0f - progress) : progress*2.0f; float darkness(1.0f); @@ -568,19 +567,19 @@ Degree SpiralLayout::GetScrollDirection() const if (mOrientation == ControlOrientation::Up) { - scrollDirection = 0.0f - 45.0f; // Allow swiping horizontally & vertically + scrollDirection = Degree( -45.0f ); // Allow swiping horizontally & vertically } else if (mOrientation == ControlOrientation::Left) { - scrollDirection = 90.0f - 45.0f; + scrollDirection = Degree( 45.0f ); } else if (mOrientation == ControlOrientation::Down) { - scrollDirection = 180.0f - 45.0f; + scrollDirection = Degree( 180.0f - 45.0f ); } else // mOrientation == ControlOrientation::Right { - scrollDirection = 270.0f - 45.0f; + scrollDirection = Degree( 270.0f - 45.0f ); } return scrollDirection; diff --git a/plugins/dali-script-v8/src/object/property-value-wrapper.cpp b/plugins/dali-script-v8/src/object/property-value-wrapper.cpp index 5dccbee..61159e6 100644 --- a/plugins/dali-script-v8/src/object/property-value-wrapper.cpp +++ b/plugins/dali-script-v8/src/object/property-value-wrapper.cpp @@ -224,14 +224,14 @@ v8::Handle< v8::Value > GetV8ValueFrom( v8::Isolate* isolate, else if(field == "axis") { Dali::Vector3 axis; - float angle; + Radian angle; value.Get().ToAxisAngle(axis, angle); ret = PropertyValueWrapper::WrapDaliProperty( isolate , Dali::Property::Value( axis ) ); } else if(field == "angle") { Dali::Vector3 axis; - float angle; + Radian angle; value.Get().ToAxisAngle(axis, angle); ret = PropertyValueWrapper::WrapDaliProperty( isolate , Dali::Property::Value( angle ) ); } @@ -384,24 +384,24 @@ void SetFromV8Value(v8::Isolate* isolate, { Dali::Vector4 v4 = value.Get().EulerAngles(); v4.z = asFloat; - value = Dali::Quaternion(v4.x, v4.y, v4.z); + value = Dali::Quaternion( Radian(Degree(v4.x)), Radian(Degree(v4.y)), Radian(Degree(v4.z)) ); } else if(field == "pitch") { Dali::Vector4 v4 = value.Get().EulerAngles(); v4.x = asFloat; - value = Dali::Quaternion(v4.x, v4.y, v4.z); + value = Dali::Quaternion( Radian(Degree(v4.x)), Radian(Degree(v4.y)), Radian(Degree(v4.z)) ); } else if(field == "yaw") { Dali::Vector4 v4 = value.Get().EulerAngles(); v4.y = asFloat; - value = Dali::Quaternion(v4.x, v4.y, v4.z); + value = Dali::Quaternion( Radian(Degree(v4.x)), Radian(Degree(v4.y)), Radian(Degree(v4.z)) ); } else if(field == "axis") { Dali::Vector3 axis; - float angle; + Radian angle; value.Get().ToAxisAngle(axis, angle); if( v8Value->IsObject() ) @@ -426,9 +426,9 @@ void SetFromV8Value(v8::Isolate* isolate, else if(field == "angle") { Dali::Vector3 axis; - float angle; - value.Get().ToAxisAngle(axis, angle); - value = Dali::Quaternion(asFloat, axis); + Radian angle; + value.Get().ToAxisAngle( axis, angle ); + value = Dali::Quaternion( Radian( Degree( asFloat ) ), axis ); } else { @@ -734,9 +734,9 @@ Dali::Property::Value PropertyValueWrapper::ExtractPropertyValue( v8::Isolate* i } else if(array.GetType() == Dali::Property::VECTOR3) { - // v3 treated as euler + // v3 treated as euler in degrees Dali::Vector3 v = array.Get(); - daliPropertyValue = Dali::Quaternion(v[0], v[1], v[2]); + daliPropertyValue = Dali::Quaternion( Radian(Degree(v[0])), Radian(Degree(v[1])), Radian(Degree(v[2])) ); } break; } @@ -785,24 +785,23 @@ void PropertyValueWrapper::NewRotation( const v8::FunctionCallbackInfo< v8::Valu bool foundAllArguments(false); V8Utils::ReadFloatArguments( foundAllArguments, v, 4, args, 0.f ); - int len = args.Length(); + int length = args.Length(); // if length = 4 create AngleAxis, else create Quaternion - if(len > 3) + if( length > 3 ) { - Dali::AngleAxis axis( Dali::Degree(v[0] ), Dali::Vector3(v[1], v[2], v[3]) ); - object = WrapDaliProperty( isolate , Dali::Property::Value( axis ) ); + Dali::AngleAxis axis( Degree( v[0] ), Vector3(v[1], v[2], v[3]) ); + object = WrapDaliProperty( isolate, Dali::Property::Value( axis ) ); } - else if(len > 2) + else if( length > 2 ) { - Dali::Quaternion quaternion( v[0], v[1], v[2] ); - object = WrapDaliProperty( isolate , Dali::Property::Value( quaternion ) ); + object = WrapDaliProperty( isolate, Dali::Property::Value( Dali::Quaternion( Radian( Degree(v[0]) ), Radian( Degree(v[1]) ), Radian( Degree(v[2]) ) ) ) ); } else { - Dali::Quaternion quaternion( Dali::Quaternion(0.f, Dali::Vector4::YAXIS)); - object = WrapDaliProperty( isolate , Dali::Property::Value( quaternion ) ); + Dali::Quaternion quaternion( Dali::Quaternion( Dali::ANGLE_0, Dali::Vector3::YAXIS)); + object = WrapDaliProperty( isolate, Dali::Property::Value( quaternion ) ); } args.GetReturnValue().Set( object );