Skip to content

Commit d06a446

Browse files
DmitryNeverovCyrilWaechter
authored andcommitted
Fixed ordering mismatch bug
1 parent 674ac7d commit d06a446

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

fcl/fcl.pyx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ cdef class Cylinder(CollisionGeometry):
334334
(<defs.Cylinderd*> self.thisptr).lz = <double?> value
335335

336336
cdef class Halfspace(CollisionGeometry):
337-
def __cinit__(self, np.ndarray[double, ndim=1, mode="c"] n, d):
337+
def __cinit__(self, np.ndarray[double, ndim=1] n, d):
338338
self.thisptr = new defs.Halfspaced(defs.Vector3d(&n[0]),
339339
<double?> d)
340340

@@ -353,7 +353,7 @@ cdef class Halfspace(CollisionGeometry):
353353
(<defs.Halfspaced*> self.thisptr).d = <double?> value
354354

355355
cdef class Plane(CollisionGeometry):
356-
def __cinit__(self, np.ndarray[double, ndim=1, mode="c"] n, d):
356+
def __cinit__(self, np.ndarray[double, ndim=1] n, d):
357357
self.thisptr = new defs.Planed(defs.Vector3d(&n[0]),
358358
<double?> d)
359359

@@ -390,7 +390,7 @@ cdef class BVHModel(CollisionGeometry):
390390
return n
391391

392392
def addVertex(self, x, y, z):
393-
cdef np.ndarray[double, ndim=1, mode="c"] n = numpy.array([x, y, z])
393+
cdef np.ndarray[double, ndim=1] n = numpy.array([x, y, z])
394394
n = (<defs.BVHModel*> self.thisptr).addVertex(defs.Vector3d(&n[0]))
395395
return self._check_ret_value(n)
396396

@@ -750,16 +750,19 @@ cdef defs.Quaterniond numpy_to_quaternion3d(a):
750750
cdef vec3d_to_numpy(defs.Vector3d vec):
751751
return numpy.array([vec[0], vec[1], vec[2]])
752752

753-
cdef defs.Vector3d numpy_to_vec3d(np.ndarray[double, ndim=1, mode="c"] a):
753+
cdef defs.Vector3d numpy_to_vec3d(np.ndarray[double, ndim=1] a):
754754
return defs.Vector3d(&a[0])
755755

756756
cdef mat3d_to_numpy(defs.Matrix3d m):
757757
return numpy.array([[m(0,0), m(0,1), m(0,2)],
758758
[m(1,0), m(1,1), m(1,2)],
759759
[m(2,0), m(2,1), m(2,2)]])
760760

761-
cdef defs.Matrix3d numpy_to_mat3d(np.ndarray[double, ndim=2, mode="c"] a):
762-
return defs.Matrix3d(&a[0, 0])
761+
cdef defs.Matrix3d numpy_to_mat3d(np.ndarray[double, ndim=2] a):
762+
# NOTE Eigen defaults to column-major storage,
763+
# which corresponds to non-default Fortran mode of ordering in numpy
764+
cdef np.ndarray[double, ndim=2, mode='fortran'] f = np.ndarray.copy(a, order='F')
765+
return defs.Matrix3d(&f[0, 0])
763766

764767
cdef c_to_python_collision_geometry(defs.const_CollisionGeometryd*geom, CollisionObject o1, CollisionObject o2):
765768
cdef CollisionGeometry o1_py_geom = <CollisionGeometry> ((<defs.CollisionObjectd*> o1.thisptr).getUserData())

0 commit comments

Comments
 (0)