Skip to content

Commit

Permalink
Merge pull request #4 from lagadic/feat_cpp11
Browse files Browse the repository at this point in the history
Update samples with c++11 as minimal standard version
  • Loading branch information
fspindle committed Nov 1, 2023
2 parents 34cf6e6 + f5c8ec4 commit 9d311c1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 30 deletions.
24 changes: 11 additions & 13 deletions core/sample-vpForceTwistMatrix-4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@

int main()
{
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
{
vpTranslationVector stp(0.1, 0.2, 0.3);
vpRotationMatrix sRp( {0, 0, -1,
0, -1, 0,
-1, 0, 0} );
vpForceTwistMatrix sFp(stp, sRp);
std::cout << "sFp:\n" << sFp << std::endl;
vpTranslationVector stp(0.1, 0.2, 0.3);
vpRotationMatrix sRp({ 0, 0, -1,
0, -1, 0,
-1, 0, 0 });
vpForceTwistMatrix sFp(stp, sRp);
std::cout << "sFp:\n" << sFp << std::endl;
}
{
vpRotationMatrix sRp( {0, 0, -1,
0, -1, 0,
-1, 0, 0} );
vpForceTwistMatrix sFp(sRp);
std::cout << "sFp:\n" << sFp << std::endl;
vpRotationMatrix sRp({ 0, 0, -1,
0, -1, 0,
-1, 0, 0 });
vpForceTwistMatrix sFp(sRp);
std::cout << "sFp:\n" << sFp << std::endl;
}
#endif
}
2 changes: 0 additions & 2 deletions core/sample-vpVelocityTwistMatrix-3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

int main()
{
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
{
vpTranslationVector cte(0.1, 0.2, 0.3);
vpRotationMatrix cRe( {0, 0, -1,
Expand All @@ -19,5 +18,4 @@ int main()
vpVelocityTwistMatrix cVe(cRe);
std::cout << "cVe:\n" << cVe << std::endl;
}
#endif
}
9 changes: 1 addition & 8 deletions json/sample-json-vpColVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@ int main()
#if defined(VISP_HAVE_NLOHMANN_JSON)
std::string filename = "col-vector.json";
{
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
vpColVector v({ 1, 2, 3, 4 });
#else
vpColVector v(4);
v[0] = 1;
v[1] = 2;
v[2] = 3;
v[3] = 4;
#endif

std::ofstream file(filename);
const nlohmann::json j = v;
file << j;
Expand Down
8 changes: 1 addition & 7 deletions json/sample-json-vpHomogeneousMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ int main()
#if defined(VISP_HAVE_NLOHMANN_JSON)
std::string filename = "homo-mat.json";
{
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
vpHomogeneousMatrix M(vpTranslationVector(0.1, 0.2, 0.3), vpRotationMatrix({ 0, 0, 1, 0, -1, 0, -1, 0, 0 }));
#else
vpHomogeneousMatrix M;
M[0][0] = 0; M[0][1] = 0; M[0][2] = 1; M[0][2] = 0.1;
M[1][0] = 0; M[1][1] = -1; M[1][2] = 0; M[1][2] = 0.2;
M[2][0] = -1; M[2][1] = 0; M[2][2] = 0; M[2][2] = 0.3;
#endif

std::ofstream file(filename);
const nlohmann::json j = M;
file << j;
Expand Down

0 comments on commit 9d311c1

Please sign in to comment.