[mocaptoolbox] mc2frontal centering

  • From: Juan Ignacio Mendoza Garay <juigmend@xxxxxxxxxxxxxx>
  • To: mocaptoolbox@xxxxxxxxxxxxx
  • Date: Fri, 8 Jan 2021 17:58:10 +0200

The Mocap Toolbox version 1.5 documentation for the function mc2frontal
says that the option
"
'frame' rotates each frame separately to have a frontal view with respect
to the instanta-neous locations of markers m1 and m2; with this method,
each individual frame is cen- tered as well
"
However, centering is not done. There is a line in the code that suggests a
previous version of "mccenter" was called to center to the centroid,
because it has three inputs, but mccenter of version 1.5 has only one input.

Anyway, below there is a bit of code that I used to solve the centering
problem.
It does not center to the centroid, though.

function d2 = mclocal(d,rm)
% Sets coordinates to reference marker at origin.
%
% syntax
% d2 = mclocal(d);
%
% input parameters
% d: MoCap structure
% rm: reference marker
%
% output
% d2: MoCap structure
%
%
% VERSION: 9 July 2020
%
% Juan Ignacio Mendoza
% University of Jyväskylä

d2 = d;

ref_cols = [0,0,0];
ref_cols(1:3) = ((rm - 1) * 3 ) + 1;
ref_cols = ref_cols + [0,1,2];

for i_row = 1:size(d.data,1)

    for i_dim = 1:3

        d2.data(i_row,i_dim:3:end) = d2.data(i_row,i_dim:3:end) -
d.data(i_row,ref_cols(i_dim));
    end
end

d2.other.origin_marker = rm;




Sent by *Juan Ignacio Mendoza*,
who is a *Doctoral Student*
at the *Department of Music, Art and Culture Studies*
of the *University of Jyväskylä*.
There is more information about Juan in the website whose address is
*http://users.jyu.fi/~juigmend/ ;<http://users.jyu.fi/~juigmend/>*

Other related posts: