void ManipulatorJointTrajectory::setNumJoints(Int numJoints, bool truncateInitial) { Int currsize = qs[0].size(); if (numJoints < currsize) { // discard elements from end (or start if truncateInitial is true) for(Int i=0; i<qs.size(); i++) { Vector nq( numJoints ); if (!truncateInitial) nq = vectorRange(qs[i], Range(0, numJoints) ); else nq = vectorRange(qs[i], Range(currsize-numJoints, currsize)); qs[i].reset(nq); } } else if (numJoints > currsize) { // add zero elements on end const Int currentNum = qs[0].size(); for(Int i=0; i<qs.size(); i++) { Vector nq( zeroVector(numJoints) ); vectorRange(nq, Range(0, currentNum)) = qs[i]; qs[i].reset(nq); } } }