I am attempting to investigate transformations between two distinct sets of vertices on ndimensional manifolds with a minimal change in the fundamental shape of the vertices. I will give some background so that when my question is asked it will be fully understood, the introductory explanation describes how the metric for configuration space is generated, and then my first question is in regards to computing explicit examples and minimizing my procedure. My second question is in regards to finding constraint conditions for my functional $L$, with the EulerLagrange equation, or something else. My main question though, is how to investigate the same type of geodesic equation in configuration space when the manifold is not endowed with a simple Pythagorean metric. Given an ndimensional manifold with any metric, I want to find a way to compute the geodesic for a set of $I$vertices traveling from one position to another. If we then consider these vertices as charges of masses, we have just found a way of minimizing the change in the electric field potential or gravitational field potential given any motion whatsoever.
NOTE: Do a quick check of the questions to see if you happen to know the answer right away in order to avoid reading something irrelevant if you are familiar with this type of stuff.
Part 1
The nonabelian similarity group $G_{\phi}$ with $\phi$ generations is given by, $$d + \frac{d(d1)}{2} + 1$$ where $d$ is the dimension as given by the translation $T^{d}$ and rotation $SO(d)$ subgroups with $+1$ for the constant scaling matrix $k$. This gives $\nu = dn  \phi$ shape degrees of freedom where $n$ is the number of vertices. My first approach to understanding the transformations between two distinct sets of vertices on an ndimensional manifold is when there is no curvature and the system is in 2dimensions. This process must be split into two explicit stages, the first defines the vertices $q_{i}(x_{i},y_{i})$ undergoing all possible gauge transformations to end up with an arbitrary system $f_{i}(g_{i},h_{i})$. The second minimizes the distance between $f_{i}(g_{i},h_{i})$ and $p_{i}(w_{i},z_{i})$, resulting in $\bar{q}(k_{i},j_{i})$. Representing the operations of rotation and translation explicitly with matrices we get that for the translation vector $\begin{pmatrix} c & d \end{pmatrix}$, $$ \begin{pmatrix} g_{i} & h_{i} \end{pmatrix} = \begin{pmatrix} x_{i}k\cos(\theta) + y_{i}k\sin(\theta) + c & x_{i}k\sin(\theta) + y_{i}k\cos(\theta) + d \end{pmatrix} $$ The result is the following function which can, given explicit $(x,y)$ coordinates, be simplified to give a solution by Mathematica, $$f(\theta,k,c,d) = \sum_{i=1}^{n} (w_{i}  g_{i})^2 + (z_{i}  h_{i})^2$$ So, we have that our metric $\omega$ is given by, $$\omega = \sum\limits_{i=1}^{n} \sqrt{(k_{i}  w_{i})^2 + (j_{i}  z_{i})^2}$$
Question 1: How would I compute this procedure explicitly with say a $47$dimensional system of particles? Could someone reference me a paper or give an explanation of how to find a general $n$dimensional rotation matrix? Everything else seems possible in principle, as Mathematica can likely compute $47$ partial derivatives concurrently.

Generalizing, the gauge transformations done to a system of vertices $q_{I}^{i}$ in configuration space, where $I$ is the number of vertices, and $i$ is the number of dimensions is: $$ q_{I}^{i} \rightarrow \sum_{j=1}^{d} s R_{j}^{i}(q_{I}^{j} + a^{j}) $$ Where $s$ is the scaling matrix, $R_{j}^{i}$ is the rotation matrix, $a^{j}$ is the translation row vector, and $j$ is an index defining the dimension. So, we then have that for the group action $G(\phi)$, the explicit process in 2dimensions described above can be represented in ndimensions as $$\minG(\phi(\lambda + \delta \lambda))(q_{I}^{j}(\lambda + \delta \lambda))  p_{I}^{i}$$ To illustrate, this process in 3dimensions is shown by the following figure:
With some effort, the following functional that gives the length of all possible paths between two distinct sets of $I$vertices in $n$dimensional space is as follows, $$L = \int\limits_{\lambda_{1}}^{\lambda_{2}} \sqrt{\sum_{I=1}^{n} \sum_{i=1}^{d} \left(\frac{d}{d\lambda}\left(\sum_{j=1}^{d} s(\lambda)R_{j}^{i}(\lambda)(q_{I}^{j}(\lambda) + a^{j}(\lambda))\right)\right)^2} d\lambda$$
So, we have a system of vertices $q_{I}^{j}$ parametrized by $\lambda$ and we want to find when this functional is stationary. Graphically, we can think of this as the functional which when minimized by the EulerLagrange equation gives (with a standard pythagorean metric) the straight line distance between two systems of vertices (points in configuration space) as,
Question 2: How can I, in practice, use the EulerLagrange equation to find the constraint conditions for when the functional is stationary? I have tried many different approaches and I just get dauntingly long computations where nothing simplifies. Are there any other methods for finding the constraint conditions for a functional to be stationary? Even if I somehow find constraint conditions, what will they look like and how can I compute an explicit example in say 3dimensions?

Part 2
My ideas for what I want to do if I figure out the difficulties I am having in my "Question 2" are as follows, I apologize for any blatant misconceptions about manifolds, singularities or curvature, as I have not fully formulated my ideas yet, I am looking for a direction and papers to read on closely related work. Essentially, I want to then find out how I can treat these "vertices" as above as actual masses or charges, and when the metric is not the pythagorean one. How will the same sort of geodesic equation in configuration space (in similar style to $L$) respond to these changes in the metric? Succinctly, my question can be posed as follows,
For a system of $I$vertices (with the possibility of being interpreted as charges or masses given the appropriate Lagrangian) in $n$dimensions, how can a geodesic equation in configuration space be developed to give a comprehensive account of the dynamics of the vertices as they traverse through space defined by the metric of any smooth manifold?
That is, I want to know how to generalize some of the procedures explained here for manifolds with metrics other than the standard pythagorean one. My motivation for wanting to know this, is I want to know how black holes interact with the gravitational field potential and electric field potential of charges and masses nearby. Maybe, sometime in the future, experiments can be done on the dynamics of neutron stars interacting closely with black holes.
Any responses are really appreciated for those of you who braved the wall of text! Comprehensive explanations of Questions 1 and 2 are required for an accepted answer and any suggestions or references to papers that might relate to part 3 are always welcome.