definitely.  code duplication is one of the number one things to avoid - it always leads to bugs (e.g., in the future we change something one place but not the other).

great to hear you found the other bug!

On May 12, 2014, at 12:33 AM, Benoit Landry <notifications@github.com> wrote:

> In systems/plants/bodyKinmex.cpp:
> 
> > @@ -49,10 +49,23 @@ void mexFunction( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] ) {
> >    pts << pts_tmp, MatrixXd::Ones(1,n_pts);
> >  
> >    if (nlhs>0) {
> > -  	plhs[0] = mxCreateDoubleMatrix(dim,n_pts,mxREAL);
> > -  	if (n_pts>0) {
> > -  		Map<MatrixXd> x(mxGetPr(plhs[0]),dim,n_pts);
> > -  		model->bodyKin(body_ind,pts,x);
> > -  	}
> > +    if (nlhs==3) {
> I think I should redo this too. So that there is only one bodyKin in RigidBodyManipulator.cpp and using NULL pointers as arguments for J and P when they are not requested.
> 
> —
> Reply to this email directly or view it on GitHub.
>