Ok so I have a systems with 6 inequations and 3 variables, and a point that may or may not solve this system. To check whether this point solves the inequations is straightforward, my problem is when it does not solve the inequations to find the closest point that does solve the problem.
I will present an example of such a system: Ax<=b
A=
[ C11, C12, C13]
[ -C21, -C22, -C23]
[ C31, C32, C33]
[ -C41, -C42, -C43]
[ C51, C52, C53]
[ -C61, -C62, -C63]
b=
[ Cb1]
[ Cb2]
[ Cb3]
[ Cb4]
[ Cb5]
[ Cb6]
Pxyz=
[ pX, pY, pZ]
Does Pxyz solve Ax<=B ?
if all(A*Pxyz<=b)
accept point
else
get the closest point to Pxyz (by Euclidean distance) that solves the system. How?
end