Skip to content

Commit

Permalink
values and params should be double
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Nov 6, 2023
1 parent 809471e commit e3997cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions WebARKit/WebARKitManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ cv::Mat WebARKitManager::getPoseMatrix() {
return m_tracker->getPoseMatrix();
}

std::array<float, 16> WebARKitManager::getTransformationMatrix() {
std::array<float, 16> transformationMatrix;
std::array<double, 16> WebARKitManager::getTransformationMatrix() {
std::array<double, 16> transformationMatrix;
arglCameraViewRHf(m_tracker->getPoseMatrix(), transformationMatrix, 1.0f);
return transformationMatrix;
}
Expand Down
26 changes: 13 additions & 13 deletions WebARKit/include/WebARKitGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ void arglCameraViewRHf(float para[3][4], float m_modelview[16], const float scal
}
}

void arglCameraViewRHf(cv::Mat para, std::array<float, 16>& m_modelview, const float scale) {
m_modelview[0 + 0 * 4] = para.at(0, 0); // R1C1
m_modelview[0 + 1 * 4] = para.at(0, 1); // R1C2
m_modelview[0 + 2 * 4] = para.at(0, 2);
m_modelview[0 + 3 * 4] = para.at(0, 3);
m_modelview[1 + 0 * 4] = -para.at(1, 0); // R2
m_modelview[1 + 1 * 4] = -para.at(1, 1);
m_modelview[1 + 2 * 4] = -para.at(1, 2);
m_modelview[1 + 3 * 4] = -para.at(1, 3);
m_modelview[2 + 0 * 4] = -para.at(2, 0); // R3
m_modelview[2 + 1 * 4] = -para.at(2, 1);
m_modelview[2 + 2 * 4] = -para.at(2, 2);
m_modelview[2 + 3 * 4] = -para.at(2, 3);
void arglCameraViewRHf(cv::Mat para, std::array<double, 16>& m_modelview, const double scale) {
m_modelview[0 + 0 * 4] = para<double>.at(0, 0); // R1C1
m_modelview[0 + 1 * 4] = para<double>.at(0, 1); // R1C2
m_modelview[0 + 2 * 4] = para<double>.at(0, 2);
m_modelview[0 + 3 * 4] = para<double>.at(0, 3);
m_modelview[1 + 0 * 4] = -para<double>.at(1, 0); // R2
m_modelview[1 + 1 * 4] = -para<double>.at(1, 1);
m_modelview[1 + 2 * 4] = -para<double>.at(1, 2);
m_modelview[1 + 3 * 4] = -para<double>.at(1, 3);
m_modelview[2 + 0 * 4] = -para<double>.at(2, 0); // R3
m_modelview[2 + 1 * 4] = -para<double>.at(2, 1);
m_modelview[2 + 2 * 4] = -para<double>.at(2, 2);
m_modelview[2 + 3 * 4] = -para<double>.at(2, 3);
m_modelview[3 + 0 * 4] = 0.0f;
m_modelview[3 + 1 * 4] = 0.0f;
m_modelview[3 + 2 * 4] = 0.0f;
Expand Down
2 changes: 1 addition & 1 deletion WebARKit/include/WebARKitManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class WebARKitManager {

cv::Mat getPoseMatrix();

std::array<float, 16> getTransformationMatrix();
std::array<double, 16> getTransformationMatrix();

bool isValid();
};
Expand Down

0 comments on commit e3997cb

Please sign in to comment.