# Composite cost function using angular distance between vectors and distance between points

I am trying to come up with a way to find the transformation parameters between two sets of planes and would like to get a cost function C which incorporates two functions C1 and C2 where

C1 = dot(n1,n2)
C2 = dist(p1,p2)


n1 and n2 are normal vectors and p1 and p2 are means of planes. However, I am not sure if

C = C1 + C2


can be used as a cost function to minimize the angle and distance together? If not, do I need to maximize them separately?

• You can use whatever cost function you want to use. Just set up your mind and you will do. – Brethlosze Jun 4 '17 at 15:09
• Jokes aside, we can do few for help if nothing about the problem we know. – Brethlosze Jun 4 '17 at 15:10
• Sorry for that. I have added the explanation of the problem. – shunyo Jun 4 '17 at 15:17

If two planes must be fitted to be equal, for a given unitary normal and distance from the origin: $$n_i\cdot (x - n_i\rho_i)=0$$

with $n_1 \cdot n_2 \in [-1 \ 1]$, and $\rho \in$ , lets say, $[0 \ \rho_0]$.

If so, the cost function would be: $$C(\mathcal P_1,\mathcal P_2)=\frac12n_1\cdot n_2 + \frac1{\rho_0}(\rho_1-\rho_2)^2$$
• $\rho$ in here is the distance to the origin, unlike any arbitrary point, the closest point $n_i\rho$ is fixed, hence this equation is always unique. – Brethlosze Jun 5 '17 at 2:34