Skip to content

Commit ba564e1

Browse files
authored
Merge pull request #143 from pariterre/master
Made it possible to send None for Q, Qdot and Qddot pointers
2 parents 05811c2 + 224d1fd commit ba564e1

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.0")
33
cmake_policy(SET CMP0042 NEW)
44
endif()
55

6-
project(biorbd VERSION 1.2.3)
6+
project(biorbd VERSION 1.3.0)
77
set (CMAKE_CXX_STANDARD 11)
88
set (BIORBD_NAME ${PROJECT_NAME})
99

binding/python3/biorbd_python.i.in

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,7 @@ biorbd::rigidbody::GeneralizedCoordinates & {
444444
}
445445
}
446446
};
447-
%typemap(typecheck, precedence=2101)
448-
biorbd::rigidbody::GeneralizedCoordinates * {
447+
%typemap(typecheck, precedence=2101) biorbd::rigidbody::GeneralizedCoordinates * {
449448
void *argp1 = 0;
450449
#ifdef BIORBD_USE_CASADI_MATH
451450
if (SWIG_IsOK(SWIG_ConvertPtr($input, &argp1, SWIGTYPE_p_casadi__MX, 0 | 0)) && argp1) {
@@ -465,7 +464,10 @@ biorbd::rigidbody::GeneralizedCoordinates * {
465464
// test if it is a numpy array
466465
$1 = true;
467466
}
468-
else {
467+
else if ($input == Py_None){
468+
$1 = true;
469+
}
470+
else{
469471
$1 = false;
470472
}
471473
}
@@ -506,6 +508,9 @@ biorbd::rigidbody::GeneralizedCoordinates * {
506508
(*$1)[q] = *(double*)PyArray_GETPTR1((PyArrayObject*)data, q);
507509
}
508510
}
511+
else if ($input == Py_None) {
512+
$1 = nullptr;
513+
}
509514
};
510515

511516
// --- GeneralizedVelocity --- //
@@ -594,6 +599,9 @@ biorbd::rigidbody::GeneralizedVelocity * {
594599
// test if it is a numpy array
595600
$1 = true;
596601
}
602+
else if ($input == Py_None){
603+
$1 = true;
604+
}
597605
else {
598606
$1 = false;
599607
}
@@ -635,6 +643,9 @@ biorbd::rigidbody::GeneralizedVelocity * {
635643
(*$1)[qdot] = *(double*)PyArray_GETPTR1((PyArrayObject*)data, qdot);
636644
}
637645
}
646+
else if ($input == Py_None){
647+
$1 = nullptr;
648+
}
638649
};
639650

640651
// --- GeneralizedAcceleration --- //
@@ -723,6 +734,9 @@ biorbd::rigidbody::GeneralizedAcceleration * {
723734
// test if it is a numpy array
724735
$1 = true;
725736
}
737+
else if ($input == Py_None){
738+
$1 = true;
739+
}
726740
else {
727741
$1 = false;
728742
}
@@ -764,6 +778,9 @@ biorbd::rigidbody::GeneralizedAcceleration * {
764778
(*$1)[qddot] = *(double*)PyArray_GETPTR1((PyArrayObject*)data, qddot);
765779
}
766780
}
781+
else if ($input == Py_None){
782+
$1 = nullptr;
783+
}
767784
};
768785

769786
// --- GeneralizedTorque --- //

0 commit comments

Comments
 (0)