function [nMat, source_control_points] = rigid_body_translation_to_triple_zero(nMat, source_control_points)
% Translate the nodal coordinates and the source control points so that the average nodal coordinate
% is (0, 0, 0)
%
% INPUTS: 		nMat - [n x 4] matrix of nodal IDs and x, y, z coordinates.
%				source_control_points - [m x 3] matrix of source control point x, y, z coordinates.
%
% OUTPUTS: 		nMat - [n x 4] matrix of nodal IDs and x, y, z coordinates, with average nodal
%                      coordinate 0, 0, 0
%               source_control_points - [m x 3] matrix of source control points, translated using the same
%                      vector as for the nodes to ensure that nodes and control points remain coincident.
%
% created by : ABR
% date : 2024-04-16
%
mean_position_of_baby = [0 mean(nMat(:,2:4))];
nMat_translated = nMat - mean_position_of_baby;
source_control_points_translated = source_control_points - mean_position_of_baby(2:4);

nMat = nMat_translated;
source_control_points = source_control_points_translated;
