function [r_x,r_y,r_z,s_x,s_y,s_z,t_x,t_y,t_z,J] = GeometricFactors3D_my(x,y,z,D_r,D_s,D_t)

% compute the metric elements for the local mappings of the elements

x_r = D_r * x; x_s = D_s * x; x_t = D_t * x;
y_r = D_r * y; y_s = D_s * y; y_t = D_t * y;
z_r = D_r * z; z_s = D_s * z; z_t = D_t * z;

J = x_r .* (y_s .* z_t - z_s .* y_t) - y_r .* (x_s .* z_t - z_s .* x_t) + z_r .* (x_s .* y_t - y_s .* x_t);

r_x = (y_s .* z_t - z_s .* y_t) ./ J; r_y = -(x_s .* z_t - z_s .* x_t) ./ J; r_z = (x_s .* y_t - y_s .* x_t) ./ J;
s_x = -(y_r .* z_t - z_r .* y_t) ./ J; s_y = (x_r .* z_t - z_r .* x_t) ./ J; s_z = -(x_r .* y_t - y_r .* x_t) ./ J;
t_x = (y_r .* z_s - z_r .* y_s) ./ J; t_y = -(x_r .* z_s - z_r .* x_s) ./ J; t_z = (x_r .* y_s - y_r .* x_s) ./ J;

J = abs(J); % aby jakobiany byly kladne

end