-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
// CLASS HEADER
#include <dali/public-api/math/matrix3.h>
// EXTERNAL INCLUDES
-#include <string.h>
+#include <cstring> // for memcpy
+#include <ostream>
// INTERNAL INCLUDES
#include <dali/public-api/math/math-utils.h>
#define S22 8
/*
- * S00 S01 S02
- * S10 S11 S12
- * S20 S21 S22
+ * S00 S10 S20
+ * S01 S11 S21
+ * S02 S12 S22
*/
namespace
{
float* m = AsFloat();
memset(m, 0, NUM_BYTES_IN_MATRIX);
- mElements[S00]=1.0f;
- mElements[S11]=1.0f;
- mElements[S22]=1.0f;
}
Matrix3::Matrix3(const Matrix3& m)
// In the case where the determinant is exactly zero, the matrix is non-invertible
if( ! EqualsZero( det ) )
{
- det = 1.0 / det;
- for (int i = 0; i < 9; i++)
+ det = 1.0f / det;
+ for( int32_t i = 0; i < 9; i++ )
{
mElements[i] = cof[i] * det;
}
const float* rhsPtr = rhs.AsFloat();
const float* lhsPtr = lhs.AsFloat();
- for( int i=0; i < 3; i++ )
+ for( int32_t i=0; i < 3; i++ )
{
- int loc = i * 3;
- int loc1 = loc + 1;
- int loc2 = loc + 2;
+ int32_t loc = i * 3;
+ int32_t loc1 = loc + 1;
+ int32_t loc2 = loc + 2;
float value0 = lhsPtr[loc];
float value1 = lhsPtr[loc1];
std::ostream& operator<< (std::ostream& o, const Matrix3& matrix)
{
- return o << "[ [" << matrix.mElements[0] << ", " << matrix.mElements[1] << ", " << matrix.mElements[2] << "], "
- << "[" << matrix.mElements[3] << ", " << matrix.mElements[4] << ", " << matrix.mElements[5] << "], "
- << "[" << matrix.mElements[6] << ", " << matrix.mElements[7] << ", " << matrix.mElements[8] << "] ]";
+ return o << "[ " << matrix.mElements[0] << ", " << matrix.mElements[1] << ", " << matrix.mElements[2] << ", "
+ << matrix.mElements[3] << ", " << matrix.mElements[4] << ", " << matrix.mElements[5] << ", "
+ << matrix.mElements[6] << ", " << matrix.mElements[7] << ", " << matrix.mElements[8] << " ]";
}
} // namespace Dali