- 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: Ie359fb5a876ef395f85e8ef15857c6cc75389bef
mSensorFrameworkHandle( -1 ),
mRoll( 0.0f ),
mPitch( 0.0f ),
- mRotation( 0.0f, Vector3::YAXIS ),
+ mRotation( Radian( 0.0f), Vector3::YAXIS ),
mRotationThreshold( 0.0f )
{
mRollValues.resize( NUMBER_OF_SAMPLES, 0.0f );
newRoll = Clamp( float(averageRoll / MAX_ACCELEROMETER_XY_VALUE), -1.0f/*min*/, 1.0f/*max*/ );
newPitch = Clamp( float(averagePitch / MAX_ACCELEROMETER_XY_VALUE), -1.0f/*min*/, 1.0f/*max*/ );
- newRotation = Quaternion( newRoll * Math::PI * -0.5f, Vector3::YAXIS ) *
- Quaternion( newPitch * Math::PI * -0.5f, Vector3::XAXIS );
+ newRotation = Quaternion( Radian( newRoll * Math::PI * -0.5f ), Vector3::YAXIS ) *
+ Quaternion( Radian( newPitch * Math::PI * -0.5f ), Vector3::XAXIS );
#endif // SENSOR_ENABLED
Radian angle(Quaternion::AngleBetween(newRotation, mRotation));
mSensorFrameworkHandle( -1 ),
mRoll( 0.0f ),
mPitch( 0.0f ),
- mRotation( 0.0f, Vector3::YAXIS ),
+ mRotation( Dali::ANGLE_0, Vector3::YAXIS ),
mRotationThreshold( 0.0f )
{
mRollValues.resize( NUMBER_OF_SAMPLES, 0.0f );
#include <dali/public-api/common/ref-counted-dali-vector.h>
#include <sys/mman.h>
+#include <unistd.h>
using namespace Dali::Internal::Platform;
Quaternion rotation = sensor.GetRotation();
- float roll = sensor.GetRoll();
- float pitch = sensor.GetPitch();
+ Radian roll( sensor.GetRoll() );
+ Radian pitch( sensor.GetPitch() );
Quaternion expectedRotation = Quaternion( roll * Math::PI * -0.5f, Vector3::YAXIS ) *
Quaternion( pitch * Math::PI * -0.5f, Vector3::XAXIS );
template <>
inline bool CompareType<Radian>(Radian q1, Radian q2, float epsilon)
{
- return CompareType<float>(float(q1), float(q2), epsilon);
+ return CompareType<float>(q1.radian, q2.radian, epsilon);
}
template <>
inline bool CompareType<Degree>(Degree q1, Degree q2, float epsilon)
{
- return CompareType<float>(float(q1), float(q2), epsilon);
+ return CompareType<float>(q1.degree, q2.degree, epsilon);
}
bool operator==(TimePeriod a, TimePeriod b);