# closest point to a polyhedral cone

I have a 6-sided equilateral polyhedral cone in $R^3$ defined by a symmetric set of equations:

$C=\{(X_1,X_2,X_3)\ |\ K X_i\leq X_j \forall i,j\in\{1,2,3\}\}$

Given an point $P=(P_1,P_2,P_3)$, I would like to know what is the closest point on the cone to $P$.

I will need to implement this as an algorithm, so the more elegant a solution the better.

You can minimize the squared distance to $X$ subject to the six linear constraints. this is a strictly convex quadratic program.