Skip to content

Commit

Permalink
revert to old syntax pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Nov 6, 2023
1 parent ad15a7f commit d01a0a1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 46 deletions.
2 changes: 2 additions & 0 deletions WebARKit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ${PARENT_DIR}/WebARKitTrackers/WebARKitOpticalTracking/include/WebARKitTrackers/
${PARENT_DIR}/WebARKitTrackers/WebARKitOpticalTracking/include/WebARKitTrackers/WebARKitOpticalTracking/WebARKitUtils.h
${PARENT_DIR}/include/WebARKitCamera.h
${PARENT_DIR}/include/WebARKitLog.h
${PARENT_DIR}/include/WebARKitGL.h
${PARENT_DIR}/include/WebARKitManager.h
${PARENT_DIR}/include/WebARKitPattern.h
)
Expand All @@ -44,6 +45,7 @@ ${PARENT_DIR}/WebARKitTrackers/WebARKitOpticalTracking/WebARKitConfig.cpp
${PARENT_DIR}/WebARKitTrackers/WebARKitOpticalTracking/WebARKitTracker.cpp
${PARENT_DIR}/WebARKitCamera.cpp
${PARENT_DIR}/WebARKitLog.cpp
${PARENT_DIR}/WebARKitGL.cpp
${PARENT_DIR}/WebARKitManager.cpp
${PARENT_DIR}/WebARKitPattern.cpp
)
Expand Down
52 changes: 52 additions & 0 deletions WebARKit/WebARKitGL.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#include <WebARKitGL.h>

namespace webarkit {

void arglCameraViewRHf(float para[3][4], float m_modelview[16], const float scale) {
m_modelview[0 + 0 * 4] = para[0][0]; // R1C1
m_modelview[0 + 1 * 4] = para[0][1]; // R1C2
m_modelview[0 + 2 * 4] = para[0][2];
m_modelview[0 + 3 * 4] = para[0][3];
m_modelview[1 + 0 * 4] = -para[1][0]; // R2
m_modelview[1 + 1 * 4] = -para[1][1];
m_modelview[1 + 2 * 4] = -para[1][2];
m_modelview[1 + 3 * 4] = -para[1][3];
m_modelview[2 + 0 * 4] = -para[2][0]; // R3
m_modelview[2 + 1 * 4] = -para[2][1];
m_modelview[2 + 2 * 4] = -para[2][2];
m_modelview[2 + 3 * 4] = -para[2][3];
m_modelview[3 + 0 * 4] = 0.0f;
m_modelview[3 + 1 * 4] = 0.0f;
m_modelview[3 + 2 * 4] = 0.0f;
m_modelview[3 + 3 * 4] = 1.0f;
if (scale != 0.0f) {
m_modelview[12] *= scale;
m_modelview[13] *= scale;
m_modelview[14] *= scale;
}
}

void arglCameraViewRHf(cv::Mat para, std::array<double, 16>& m_modelview, const double scale) {
m_modelview[0 + 0 * 4] = para.at<double>(0, 0); // R1C1
m_modelview[0 + 1 * 4] = para.at<double>(0, 1); // R1C2
m_modelview[0 + 2 * 4] = para.at<double>(0, 2);
m_modelview[0 + 3 * 4] = para.at<double>(0, 3);
m_modelview[1 + 0 * 4] = -para.at<double>(1, 0); // R2
m_modelview[1 + 1 * 4] = -para.at<double>(1, 1);
m_modelview[1 + 2 * 4] = -para.at<double>(1, 2);
m_modelview[1 + 3 * 4] = -para.at<double>(1, 3);
m_modelview[2 + 0 * 4] = -para.at<double>(2, 0); // R3
m_modelview[2 + 1 * 4] = -para.at<double>(2, 1);
m_modelview[2 + 2 * 4] = -para.at<double>(2, 2);
m_modelview[2 + 3 * 4] = -para.at<double>(2, 3);
m_modelview[3 + 0 * 4] = 0.0f;
m_modelview[3 + 1 * 4] = 0.0f;
m_modelview[3 + 2 * 4] = 0.0f;
m_modelview[3 + 3 * 4] = 1.0f;
if (scale != 0.0f) {
m_modelview[12] *= scale;
m_modelview[13] *= scale;
m_modelview[14] *= scale;
}
}
} // namespace webarkit
48 changes: 2 additions & 46 deletions WebARKit/include/WebARKitGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,9 @@

namespace webarkit {

void arglCameraViewRHf(float para[3][4], float m_modelview[16], const float scale) {
m_modelview[0 + 0 * 4] = para[0][0]; // R1C1
m_modelview[0 + 1 * 4] = para[0][1]; // R1C2
m_modelview[0 + 2 * 4] = para[0][2];
m_modelview[0 + 3 * 4] = para[0][3];
m_modelview[1 + 0 * 4] = -para[1][0]; // R2
m_modelview[1 + 1 * 4] = -para[1][1];
m_modelview[1 + 2 * 4] = -para[1][2];
m_modelview[1 + 3 * 4] = -para[1][3];
m_modelview[2 + 0 * 4] = -para[2][0]; // R3
m_modelview[2 + 1 * 4] = -para[2][1];
m_modelview[2 + 2 * 4] = -para[2][2];
m_modelview[2 + 3 * 4] = -para[2][3];
m_modelview[3 + 0 * 4] = 0.0f;
m_modelview[3 + 1 * 4] = 0.0f;
m_modelview[3 + 2 * 4] = 0.0f;
m_modelview[3 + 3 * 4] = 1.0f;
if (scale != 0.0f) {
m_modelview[12] *= scale;
m_modelview[13] *= scale;
m_modelview[14] *= scale;
}
}
void arglCameraViewRHf(float para[3][4], float m_modelview[16], const float scale);

void arglCameraViewRHf(cv::Mat para, std::array<double, 16>& m_modelview, const double scale) {
m_modelview[0 + 0 * 4] = para.at<double>(0, 0); // R1C1
m_modelview[0 + 1 * 4] = para.at<double>(0, 1); // R1C2
m_modelview[0 + 2 * 4] = para.at<double>(0, 2);
m_modelview[0 + 3 * 4] = para.at<double>(0, 3);
m_modelview[1 + 0 * 4] = -para.at<double>(1, 0); // R2
m_modelview[1 + 1 * 4] = -para.at<double>(1, 1);
m_modelview[1 + 2 * 4] = -para.at<double>(1, 2);
m_modelview[1 + 3 * 4] = -para.at<double>(1, 3);
m_modelview[2 + 0 * 4] = -para.at<double>(2, 0); // R3
m_modelview[2 + 1 * 4] = -para.at<double>(2, 1);
m_modelview[2 + 2 * 4] = -para.at<double>(2, 2);
m_modelview[2 + 3 * 4] = -para.at<double>(2, 3);
m_modelview[3 + 0 * 4] = 0.0f;
m_modelview[3 + 1 * 4] = 0.0f;
m_modelview[3 + 2 * 4] = 0.0f;
m_modelview[3 + 3 * 4] = 1.0f;
if (scale != 0.0f) {
m_modelview[12] *= scale;
m_modelview[13] *= scale;
m_modelview[14] *= scale;
}
}
void arglCameraViewRHf(cv::Mat para, std::array<double, 16>& m_modelview, const double scale);
} // namespace webarkit

#endif // WEBARKITGL_H

0 comments on commit d01a0a1

Please sign in to comment.